]> arthur.barton.de Git - netatalk.git/blobdiff - etc/uams/uams_dhx_pam.c
Merge master
[netatalk.git] / etc / uams / uams_dhx_pam.c
index ec3501f14fb37e3e99961a5d3e8bb158846dd3bc..7bad2fa0472ef3a833ca6792c28327158014ac3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx_pam.c,v 1.31 2009-10-15 11:39:48 didg Exp $
+ * $Id: uams_dhx_pam.c,v 1.33 2010-03-30 10:25:49 franklahm Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -26,7 +26,7 @@
 #ifdef HAVE_PAM_PAM_APPL_H
 #include <pam/pam_appl.h>
 #endif
-
+#include <arpa/inet.h>
 
 #if defined(GNUTLS_DHX)
 #include <gnutls/openssl.h>
 /* the secret key */
 static CAST_KEY castkey;
 static struct passwd *dhxpwd;
-static u_int8_t randbuf[KEYSIZE];
+static uint8_t randbuf[KEYSIZE];
 
 /* diffie-hellman bits */
 static unsigned char msg2_iv[] = "CJalbert";
 static unsigned char msg3_iv[] = "LWallace";
-static const u_int8_t p[] = {0xBA, 0x28, 0x73, 0xDF, 0xB0, 0x60, 0x57, 0xD4,
+static const uint8_t p[] = {0xBA, 0x28, 0x73, 0xDF, 0xB0, 0x60, 0x57, 0xD4,
                             0x3F, 0x20, 0x24, 0x74, 0x4C, 0xEE, 0xE7, 0x5B};
-static const u_int8_t g = 0x07;
+static const uint8_t g = 0x07;
 
 
 /* Static variables used to communicate between the conversation function
@@ -187,7 +187,7 @@ static struct pam_conv PAM_conversation = {
 static int dhx_setup(void *obj, char *ibuf, size_t ibuflen _U_, 
                     char *rbuf, size_t *rbuflen)
 {
-    u_int16_t sessid;
+    uint16_t sessid;
     size_t i;
     BIGNUM *bn, *gbn, *pbn;
     DH *dh;
@@ -325,7 +325,7 @@ static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _
 {
     if (( dhxpwd = uam_getname(obj, username, ulen)) == NULL ) {
         LOG(log_info, logtype_uams, "uams_dhx_pam.c: unknown username");
-       return AFPERR_PARAM;
+        return AFPERR_NOTAUTH;
     }
 
     PAM_username = username;
@@ -375,8 +375,9 @@ static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
                     char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
-    u_int16_t  temp16;
+    int len;
+    size_t ulen;
+    uint16_t  temp16;
 
     *rbuflen = 0;
 
@@ -410,9 +411,9 @@ static int pam_logincont(void *obj, struct passwd **uam_pwd,
                         char *ibuf, size_t ibuflen _U_, 
                         char *rbuf, size_t *rbuflen)
 {
-    char *hostname;
+    const char *hostname;
     BIGNUM *bn1, *bn2, *bn3;
-    u_int16_t sessid;
+    uint16_t sessid;
     int err, PAM_error;
 
     *rbuflen = 0;
@@ -572,7 +573,7 @@ static int pam_changepw(void *obj, char *username,
     char *hostname;
     pam_handle_t *lpamh;
     uid_t uid;
-    u_int16_t sessid;
+    uint16_t sessid;
     int PAM_error;
 
     if (ibuflen < sizeof(sessid)) {