]> arthur.barton.de Git - netatalk.git/commitdiff
move login buffer size to size_t
authordidg <didg>
Thu, 15 Oct 2009 11:39:48 +0000 (11:39 +0000)
committerdidg <didg>
Thu, 15 Oct 2009 11:39:48 +0000 (11:39 +0000)
14 files changed:
etc/afpd/uam.c
etc/papd/uam.c
etc/uams/uams_dhx2_pam.c
etc/uams/uams_dhx2_passwd.c
etc/uams/uams_dhx_pam.c
etc/uams/uams_dhx_passwd.c
etc/uams/uams_gss.c
etc/uams/uams_guest.c
etc/uams/uams_krb4/uams_krb4.c
etc/uams/uams_pam.c
etc/uams/uams_passwd.c
etc/uams/uams_pgp.c
etc/uams/uams_randnum.c
include/atalk/uam.h

index 4b275f188268240a0cd54c471a1de5ff4f1b2fd5..946af2cf250f37cc339dc8371c2bf145882519a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uam.c,v 1.28 2009-09-14 00:02:21 didg Exp $
+ * $Id: uam.c,v 1.29 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -363,7 +363,7 @@ int uam_random_string (AFPObj *obj, char *buf, int len)
 
 /* afp-specific functions */
 int uam_afpserver_option(void *private, const int what, void *option,
-                         int *len)
+                         size_t *len)
 {
 AFPObj *obj = private;
     char **buf = (char **) option; /* most of the options are this */
index c406b1b4745d2b90bd0126536f8edf9f8cd7fc94..2962fad0b10194d0cf9ae1a7d19a47c41bebcabb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uam.c,v 1.10 2005-04-28 20:49:49 bfernhomberg Exp $
+ * $Id: uam.c,v 1.11 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1999 Adrian Sun (asun@zoology.washington.edu)
  * All Rights Reserved.  See COPYRIGHT.
@@ -184,7 +184,7 @@ void uam_unregister(const int type, const char *name)
 
 /* Crap to support uams which call this afpd function */
 int uam_afpserver_option(void *private _U_, const int what _U_, void *option _U_,
-                         int *len _U_)
+                         size_t *len _U_)
 {
        return(0);
 }
index 94c3377dc4d4526ac6d55ead3617e3f32e21a316..48c407c72f7c412e0ab1d9c6d71c8813fa69fb42 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx2_pam.c,v 1.7 2009-10-13 22:55:37 didg Exp $
+ * $Id: uams_dhx2_pam.c,v 1.8 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
@@ -253,8 +253,8 @@ static struct pam_conv PAM_conversation = {
 };
 
 
-static int dhx2_setup(void *obj, char *ibuf _U_, int ibuflen _U_,
-                     char *rbuf, int *rbuflen)
+static int dhx2_setup(void *obj, char *ibuf _U_, size_t ibuflen _U_,
+                     char *rbuf, size_t *rbuflen)
 {
     int ret;
     size_t nwritten;
@@ -338,8 +338,8 @@ error:                              /* We exit here anyway */
 
 /* -------------------------------- */
 static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _U_,
-                 char *ibuf, int ibuflen,
-                 char *rbuf, int *rbuflen)
+                 char *ibuf, size_t ibuflen,
+                 char *rbuf, size_t *rbuflen)
 {
     if (( dhxpwd = uam_getname(obj, username, ulen)) == NULL ) {
         LOG(log_info, logtype_uams, "DHX2: unknown username");
@@ -355,11 +355,11 @@ static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _
 /* dhx login: things are done in a slightly bizarre order to avoid
  * having to clean things up if there's an error. */
 static int pam_login(void *obj, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -389,11 +389,11 @@ static int pam_login(void *obj, struct passwd **uam_pwd,
 
 /* ----------------------------- */
 static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
@@ -424,7 +424,7 @@ static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
 
 /* -------------------------------- */
 
-static int logincont1(void *obj _U_, char *ibuf, int ibuflen, char *rbuf, int *rbuflen)
+static int logincont1(void *obj _U_, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 {
     int ret;
     size_t nwritten;
@@ -561,8 +561,8 @@ exit:
 }
 
 static int logincont2(void *obj, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf _U_, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf _U_, size_t *rbuflen)
 {
     int ret;
     int PAM_error;
@@ -575,7 +575,7 @@ static int logincont2(void *obj, struct passwd **uam_pwd,
 
     /* Packet size should be: Session ID + ServerNonce + Passwd buffer (evantually +10 extra bytes, see Apples Docs) */
     if ((ibuflen != 2 + 16 + 256) && (ibuflen != 2 + 16 + 256 + 10)) {
-        LOG(log_error, logtype_uams, "DHX2: Paket length not correct: %d. Should be 274 or 284.", ibuflen);
+        LOG(log_error, logtype_uams, "DHX2: Paket length not correct: %u. Should be 274 or 284.", ibuflen);
         ret = AFPERR_PARAM;
         goto error_noctx;
     }
@@ -699,8 +699,8 @@ error_noctx:
 }
 
 static int pam_logincont(void *obj, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     u_int16_t retID;
     int ret;
@@ -730,7 +730,7 @@ static void pam_logout(void) {
  * --- Change pwd stuff --- */
 
 static int changepw_1(void *obj, char *uname,
-                     char *ibuf, int ibuflen, char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 {
     *rbuflen = 0;
 
@@ -740,14 +740,14 @@ static int changepw_1(void *obj, char *uname,
 }
 
 static int changepw_2(void *obj, 
-                     char *ibuf, int ibuflen, char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 {
     return( logincont1(obj, ibuf, ibuflen, rbuf, rbuflen) );
 }
 
 static int changepw_3(void *obj _U_,
-                     char *ibuf, int ibuflen _U_, 
-                     char *rbuf _U_, int *rbuflen _U_)
+                     char *ibuf, size_t ibuflen _U_, 
+                     char *rbuf _U_, size_t *rbuflen _U_)
 {
     int ret;
     int PAM_error;
@@ -869,8 +869,8 @@ error_noctx:
 }
 
 static int dhx2_changepw(void *obj _U_, char *uname,
-                        struct passwd *pwd _U_, char *ibuf, int ibuflen _U_,
-                        char *rbuf _U_, int *rbuflen _U_)
+                        struct passwd *pwd _U_, char *ibuf, size_t ibuflen _U_,
+                        char *rbuf _U_, size_t *rbuflen _U_)
 {
     /* We use this to serialize the three incoming FPChangePassword calls */
     static int dhx2_changepw_status = 1;
index 2f41a4299eec68ca03c57b3468bb6a84235ac0e3..7cca2658d8f02fe45299733ffe6df004c081da5a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx2_passwd.c,v 1.5 2009-01-15 04:16:32 didg Exp $
+ * $Id: uams_dhx2_passwd.c,v 1.6 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
@@ -162,8 +162,8 @@ error:
     return result;
 }
 
-static int dhx2_setup(void *obj, char *ibuf _U_, int ibuflen _U_,
-                     char *rbuf, int *rbuflen)
+static int dhx2_setup(void *obj, char *ibuf _U_, size_t ibuflen _U_,
+                     char *rbuf, size_t *rbuflen)
 {
     int ret;
     size_t nwritten;
@@ -264,8 +264,8 @@ error:                              /* We exit here anyway */
 
 /* -------------------------------- */
 static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _U_,
-                 char *ibuf, int ibuflen,
-                 char *rbuf, int *rbuflen)
+                 char *ibuf, size_t ibuflen,
+                 char *rbuf, size_t *rbuflen)
 {
     if (( dhxpwd = uam_getname(obj, username, ulen)) == NULL ) {
         LOG(log_info, logtype_uams, "DHX2: unknown username");
@@ -280,11 +280,11 @@ static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _
 /* dhx login: things are done in a slightly bizarre order to avoid
  * having to clean things up if there's an error. */
 static int passwd_login(void *obj, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -314,11 +314,11 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
 
 /* ----------------------------- */
 static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
@@ -350,8 +350,8 @@ static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
 /* -------------------------------- */
 
 static int logincont1(void *obj _U_, struct passwd **uam_pwd _U_,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     size_t nwritten;
     int ret;
@@ -488,8 +488,8 @@ exit:
 }
 
 static int logincont2(void *obj _U_, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf _U_, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf _U_, size_t *rbuflen)
 {
 #ifdef SHADOWPW
     struct spwd *sp;
@@ -589,8 +589,8 @@ exit:
 }
 
 static int passwd_logincont(void *obj, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     u_int16_t retID;
     int ret;
index d50950cd2fbb6c1623e3f1fac20384bc752b93bf..ec3501f14fb37e3e99961a5d3e8bb158846dd3bc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx_pam.c,v 1.30 2009-10-13 22:55:37 didg Exp $
+ * $Id: uams_dhx_pam.c,v 1.31 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -184,11 +184,11 @@ static struct pam_conv PAM_conversation = {
 };
 
 
-static int dhx_setup(void *obj, char *ibuf, int ibuflen _U_, 
-                    char *rbuf, int *rbuflen)
+static int dhx_setup(void *obj, char *ibuf, size_t ibuflen _U_, 
+                    char *rbuf, size_t *rbuflen)
 {
     u_int16_t sessid;
-    int i;
+    size_t i;
     BIGNUM *bn, *gbn, *pbn;
     DH *dh;
 
@@ -320,8 +320,8 @@ pam_fail:
 
 /* -------------------------------- */
 static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _U_,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
     if (( dhxpwd = uam_getname(obj, username, ulen)) == NULL ) {
         LOG(log_info, logtype_uams, "uams_dhx_pam.c: unknown username");
@@ -337,11 +337,11 @@ static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd _
 /* dhx login: things are done in a slightly bizarre order to avoid
  * having to clean things up if there's an error. */
 static int pam_login(void *obj, struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -371,8 +371,8 @@ static int pam_login(void *obj, struct passwd **uam_pwd,
 
 /* ----------------------------- */
 static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
     char *username;
     int len, ulen;
@@ -407,8 +407,8 @@ static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
 /* -------------------------------- */
 
 static int pam_logincont(void *obj, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen _U_, 
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen _U_, 
+                        char *rbuf, size_t *rbuflen)
 {
     char *hostname;
     BIGNUM *bn1, *bn2, *bn3;
@@ -564,8 +564,8 @@ static void pam_logout(void) {
 /* change pw for dhx needs a couple passes to get everything all
  * right. basically, it's like the login/logincont sequence */
 static int pam_changepw(void *obj, char *username,
-                       struct passwd *pwd _U_, char *ibuf, int ibuflen,
-                       char *rbuf, int *rbuflen)
+                       struct passwd *pwd _U_, char *ibuf, size_t ibuflen,
+                       char *rbuf, size_t *rbuflen)
 {
     BIGNUM *bn1, *bn2, *bn3;
 
@@ -575,6 +575,10 @@ static int pam_changepw(void *obj, char *username,
     u_int16_t sessid;
     int PAM_error;
 
+    if (ibuflen < sizeof(sessid)) {
+      return AFPERR_PARAM;
+    }
+
     /* grab the id */
     memcpy(&sessid, ibuf, sizeof(sessid));
     ibuf += sizeof(sessid);
index 719bfc3397e0f8c6537177df39c5432644c1744a..f31c5dcbf7b964ad4bcb35d2326bc0f76186a16e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_dhx_passwd.c,v 1.24 2006-12-03 06:04:43 didg Exp $
+ * $Id: uams_dhx_passwd.c,v 1.25 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -75,8 +75,8 @@ static char *clientname;
 
 /* dhx passwd */
 static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pwd _U_,
-                       char *ibuf, int ibuflen _U_,
-                       char *rbuf, int *rbuflen)
+                       char *ibuf, size_t ibuflen _U_,
+                       char *rbuf, size_t *rbuflen)
 {
     unsigned char iv[] = "CJalbert";
     u_int8_t p[] = {0xBA, 0x28, 0x73, 0xDF, 0xB0, 0x60, 0x57, 0xD4,
@@ -87,7 +87,7 @@ static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pw
 #endif /* SHADOWPW */
     BIGNUM *bn, *gbn, *pbn;
     u_int16_t sessid;
-    int i;
+    size_t i;
     DH *dh;
 
 #ifdef TRU64
@@ -209,11 +209,11 @@ passwd_fail:
 
 /* cleartxt login */
 static int passwd_login(void *obj, struct passwd **uam_pwd,
-                       char *ibuf, int ibuflen,
-                       char *rbuf, int *rbuflen)
+                       char *ibuf, size_t ibuflen,
+                       char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -221,7 +221,7 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
                             (void *) &username, &ulen) < 0)
        return AFPERR_MISC;
 
-    if (ibuflen <= 1) {
+    if (ibuflen < 2) {
        return( AFPERR_PARAM );
     }
 
@@ -250,11 +250,11 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
     len bytes utf8 name
 */
 static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                       char *ibuf, int ibuflen,
-                       char *rbuf, int *rbuflen)
+                       char *ibuf, size_t ibuflen,
+                       char *rbuf, size_t *rbuflen)
 {
     char       *username;
-    int        len, ulen;
+    size_t     len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
@@ -277,8 +277,8 @@ static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
 }
                        
 static int passwd_logincont(void *obj, struct passwd **uam_pwd,
-                           char *ibuf, int ibuflen _U_, 
-                           char *rbuf, int *rbuflen)
+                           char *ibuf, size_t ibuflen _U_, 
+                           char *rbuf, size_t *rbuflen)
 {
 #ifdef SHADOWPW
     struct spwd *sp;
index 2a1e85e2b5b33c01d7696279d37f18c9cff6abcb..40fc2d9b200a5472ebb72fd89eb2c5a93e3acf80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_gss.c,v 1.7 2009-09-28 13:19:48 franklahm Exp $
+ * $Id: uams_gss.c,v 1.8 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
@@ -141,7 +141,7 @@ static int get_afpd_principal(void *obj, gss_name_t *server_name)
 {
     OM_uint32 major_status = 0, minor_status = 0;
     char *realm, *fqdn, *service, *principal, *p;
-    int realmlen=0, fqdnlen=0, servicelen=0;
+    size_t realmlen=0, fqdnlen=0, servicelen=0;
     size_t principal_length;
     gss_buffer_desc s_princ_buffer;
 
@@ -454,8 +454,8 @@ cleanup_vars:
 
 /* -------------------------- */
 static int gss_login(void *obj, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf, size_t *rbuflen)
 {
 
     u_int16_t  temp16;
@@ -472,8 +472,8 @@ static int gss_login(void *obj, struct passwd **uam_pwd,
 }
 
 static int gss_logincont(void *obj, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     struct passwd *pwd = NULL;
     u_int16_t login_id;
@@ -481,7 +481,7 @@ static int gss_logincont(void *obj, struct passwd **uam_pwd,
     u_int16_t ticket_len;
     char *p;
     int rblen;
-    int userlen;
+    size_t userlen;
     struct session_info *sinfo;
 
     /* Apple's AFP 3.1 documentation specifies that this command
@@ -510,7 +510,7 @@ static int gss_logincont(void *obj, struct passwd **uam_pwd,
 
     rblen = *rbuflen = 0;
 
-    if (ibuflen < 3) {
+    if (ibuflen < 1 +sizeof(login_id)) {
         LOG(log_info, logtype_uams, "uams_gss.c :LoginCont: received incomplete packet");
         return AFPERR_PARAM;
     }
@@ -591,8 +591,8 @@ static int gss_logincont(void *obj, struct passwd **uam_pwd,
  * point is trustworthy as we'll have a signed ticket to parse in logincont.
  */
 static int gss_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     u_int16_t  temp16;
 
index 963c34ee9d1979776e26024d8971289212d140af..02ce34f7790dfb1fb4545f097e652d8d614a2847 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_guest.c,v 1.16 2009-10-14 01:38:28 didg Exp $
+ * $Id: uams_guest.c,v 1.17 2009-10-15 11:39:48 didg Exp $
  *
  * (c) 2001 (see COPYING)
  */
@@ -44,8 +44,8 @@ extern void append(struct papfile *, const char *, int);
 
 /* login and login_ext are almost the same */
 static int noauth_login(void *obj, struct passwd **uam_pwd,
-                       char *ibuf _U_, int ibuflen _U_, 
-                       char *rbuf _U_, int *rbuflen)
+                       char *ibuf _U_, size_t ibuflen _U_, 
+                       char *rbuf _U_, size_t *rbuflen)
 {
     struct passwd *pwent;
     char *guest, *username;
@@ -80,8 +80,8 @@ static int noauth_login(void *obj, struct passwd **uam_pwd,
 }
 
 static int noauth_login_ext(void *obj, char *uname _U_, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf, int *rbuflen)
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf, size_t *rbuflen)
 {
         return ( noauth_login (obj, uam_pwd, ibuf, ibuflen, rbuf, rbuflen));
 }
index f2c6d420b1672197223c0c054ab55cb5f78588a5..ff7c2c0a4767e9ac7af0eee3394b59173fc08603 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_krb4.c,v 1.9 2008-12-03 18:35:44 didg Exp $
+ * $Id: uams_krb4.c,v 1.10 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -121,8 +121,8 @@ static void ucase( p )
 #define KRB4CMD_SKIP   11
 
 static int krb4_login(void *obj, struct passwd **uam_pwd,
-                     char *ibuf, int ibuflen,
-                     char *rbuf, int *rbuflen )
+                     char *ibuf, size_t ibuflen,
+                     char *rbuf, size_t *rbuflen )
 {
     char               *p;
     char               *username;
@@ -130,7 +130,8 @@ static int krb4_login(void *obj, struct passwd **uam_pwd,
     u_int16_t          len;
     KTEXT_ST           tkt;
     static AUTH_DAT    ad;
-    int                        rc, ulen, proto;
+    int                        rc, proto;
+    size_t             ulen;
     char               inst[ 40 ], princ[ 40 ];
 
     if (uam_afpserver_option(obj, UAM_OPTION_USERNAME, &username, &ulen) < 0)
@@ -252,8 +253,8 @@ static int krb4_action( void *v1, void *v2, const int i )
    with non-16bit short's and non-32bit int's
 */
 static int krb4_logincont(void *obj, struct passwd **uam_pwd,
-                         char *ibuf, int ibuflen,
-                         char *rbuf, int *rbuflen)
+                         char *ibuf, size_t ibuflen,
+                         char *rbuf, size_t *rbuflen)
 {
     static struct passwd       *pwd;
     KTEXT_ST           tkt;
@@ -567,8 +568,8 @@ static void authenticate(cells,name,passwd)
 
 #if defined( UAM_AFSKRB ) && defined( AFS )
 static int afskrb_login(void *obj, struct passwd *uam_pwd,
-                       char *ibuf, int ibuflen, 
-                       char *rbuf, int *rbuflen )
+                       char *ibuf, size_t ibuflen, 
+                       char *rbuf, size_t *rbuflen )
 {
     KTEXT_ST   authent, rpkt;
     CREDENTIALS        cr;
@@ -671,8 +672,8 @@ static int afskrb_login(void *obj, struct passwd *uam_pwd,
 }
 
 static int afskrb_logincont(void *obj, struct passwd *uam_pwd,
-                           char *ibuf, int ibuflen, 
-                           char *rbuf, int *rbuflen )
+                           char *ibuf, size_t ibuflen, 
+                           char *rbuf, size_t *rbuflen )
 {
     CREDENTIALS                cr;
     struct ViceIoctl   vi;
index ebf483b5535fc33a6b6627e6454a7b6ad92b882a..37597f75bea20cbdea532e6df40f90b3c978d6d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_pam.c,v 1.20 2009-10-14 01:38:28 didg Exp $
+ * $Id: uams_pam.c,v 1.21 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -140,8 +140,8 @@ static struct pam_conv PAM_conversation = {
 };
 
 static int login(void *obj, char *username, int ulen,  struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen _U_,
-                    char *rbuf _U_, int *rbuflen _U_)
+                    char *ibuf, size_t ibuflen _U_,
+                    char *rbuf _U_, size_t *rbuflen _U_)
 {
     struct passwd *pwd;
     int err, PAM_error;
@@ -219,11 +219,11 @@ login_err:
    cleartxt login 
 */
 static int pam_login(void *obj, struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
     char *username; 
-    int  len, ulen;
+    size_t  len, ulen;
 
     *rbuflen = 0;
 
@@ -248,11 +248,11 @@ static int pam_login(void *obj, struct passwd **uam_pwd,
 
 /* ----------------------------- */
 static int pam_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
     char *username; 
-    int  len, ulen;
+    size_t  len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
@@ -284,8 +284,8 @@ static void pam_logout(void) {
 
 /* change passwd */
 static int pam_changepw(void *obj _U_, char *username,
-                       struct passwd *pwd _U_, char *ibuf, int ibuflen _U_,
-                       char *rbuf _U_, int *rbuflen _U_)
+                       struct passwd *pwd _U_, char *ibuf, size_t ibuflen _U_,
+                       char *rbuf _U_, size_t *rbuflen _U_)
 {
     char pw[PASSWDLEN + 1];
     pam_handle_t *lpamh;
index 799cdc28360e26d003e03e908783c15749694de3..66dd2d142c44126f777b532133fda5b600682ff9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_passwd.c,v 1.26 2009-10-13 22:55:37 didg Exp $
+ * $Id: uams_passwd.c,v 1.27 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -76,8 +76,8 @@ struct papfile;
 extern void append(struct papfile *, const char *, int);
 
 static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen,
-                        char *rbuf _U_, int *rbuflen _U_)
+                        char *ibuf, size_t ibuflen,
+                        char *rbuf _U_, size_t *rbuflen _U_)
 {
     char  *p;
     struct passwd *pwd;
@@ -158,11 +158,11 @@ static int pwd_login(void *obj, char *username, int ulen, struct passwd **uam_pw
 
 /* cleartxt login */
 static int passwd_login(void *obj, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen,
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen,
+                        char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -170,7 +170,7 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
                              (void *) &username, &ulen) < 0)
         return AFPERR_MISC;
 
-    if (ibuflen <= 1) {
+    if (ibuflen < 2) {
         return( AFPERR_PARAM );
     }
 
@@ -199,11 +199,11 @@ static int passwd_login(void *obj, struct passwd **uam_pwd,
     len bytes unicode name
 */
 static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen,
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen,
+                        char *rbuf, size_t *rbuflen)
 {
     char       *username;
-    int        len, ulen;
+    size_t     len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
@@ -230,7 +230,7 @@ static int passwd_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
 /* change passwd */
 static int passwd_changepw(void *obj, char *username,
                            struct passwd *pwd, char *ibuf,
-                           int ibuflen, char *rbuf, int *rbuflen)
+                           size_t ibuflen, char *rbuf, size_t *rbuflen)
 {
 #ifdef SHADOWPW
     struct spwd *sp;
index 03670c298de948f0d0cb291704d42248c4369b4a..e3892573f22ddf7e43cb8c1025dd159755f1100c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_pgp.c,v 1.11 2005-04-28 20:49:50 bfernhomberg Exp $
+ * $Id: uams_pgp.c,v 1.12 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -57,10 +57,10 @@ static u_int8_t randbuf[16];
 
 /* pgp passwd */
 static int pgp_login(void *obj, struct passwd **uam_pwd,
-                    char *ibuf, int ibuflen,
-                    char *rbuf, int *rbuflen)
+                    char *ibuf, size_t ibuflen,
+                    char *rbuf, size_t *rbuflen)
 {
-    int len, i;
+    size_t len, i;
     char *name;
 
     *rbuflen = 0;
@@ -104,8 +104,8 @@ pgp_fail:
 }
 
 static int pgp_logincont(void *obj, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen, 
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen, 
+                        char *rbuf, size_t *rbuflen)
 {
        unsigned char iv[] = "RJscorat";
     BIGNUM *bn1, *bn2, *bn3;
index f4c5cde53c69cf381e95283eb034103efa8c756d..8adebec705519d939508fdf96f435a96d9f0287f 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: uams_randnum.c,v 1.18 2008-12-03 18:35:44 didg Exp $
+ * $Id: uams_randnum.c,v 1.19 2009-10-15 11:39:48 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) 
@@ -300,13 +300,14 @@ static int randpass(const struct passwd *pwd, const char *file,
 /* randnum sends an 8-byte number and uses the user's password to
  * check against the encrypted reply. */
 static int rand_login(void *obj, char *username, int ulen, struct passwd **uam_pwd _U_,
-                        char *ibuf _U_, int ibuflen _U_,
-                        char *rbuf, int *rbuflen)
+                        char *ibuf _U_, size_t ibuflen _U_,
+                        char *rbuf, size_t *rbuflen)
 {
 
   char *passwdfile;
   u_int16_t sessid;
-  int len, err;
+  size_t len;
+  int err;
  
   if (( randpwd = uam_getname(obj, username, ulen)) == NULL )
     return AFPERR_PARAM; /* unknown user */
@@ -346,8 +347,8 @@ static int rand_login(void *obj, char *username, int ulen, struct passwd **uam_p
 /* check encrypted reply. we actually setup the encryption stuff
  * here as the first part of randnum and rand2num are identical. */
 static int randnum_logincont(void *obj, struct passwd **uam_pwd,
-                            char *ibuf, int ibuflen _U_, 
-                            char *rbuf _U_, int *rbuflen)
+                            char *ibuf, size_t ibuflen _U_, 
+                            char *rbuf _U_, size_t *rbuflen)
 {
   u_int16_t sessid;
 
@@ -385,8 +386,8 @@ static int randnum_logincont(void *obj, struct passwd **uam_pwd,
  *    and sends it back as part of the reply.
  */
 static int rand2num_logincont(void *obj, struct passwd **uam_pwd,
-                             char *ibuf, int ibuflen _U_, 
-                             char *rbuf, int *rbuflen)
+                             char *ibuf, size_t ibuflen _U_, 
+                             char *rbuf, size_t *rbuflen)
 {
   u_int16_t sessid;
   unsigned int i;
@@ -435,10 +436,11 @@ static int rand2num_logincont(void *obj, struct passwd **uam_pwd,
  */
 static int randnum_changepw(void *obj, const char *username _U_, 
                            struct passwd *pwd, char *ibuf,
-                           int ibuflen _U_, char *rbuf _U_, int *rbuflen _U_)
+                           size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen _U_)
 {
     char *passwdfile;
-    int err, len;
+    int err;
+    size_t len;
 
     if (uam_checkuser(pwd) < 0)
       return AFPERR_ACCESS;
@@ -490,11 +492,11 @@ static int randnum_changepw(void *obj, const char *username _U_,
 
 /* randnum login */
 static int randnum_login(void *obj, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen,
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen,
+                        char *rbuf, size_t *rbuflen)
 {
     char *username;
-    int len, ulen;
+    size_t len, ulen;
 
     *rbuflen = 0;
 
@@ -502,7 +504,7 @@ static int randnum_login(void *obj, struct passwd **uam_pwd,
                              (void *) &username, &ulen) < 0)
         return AFPERR_MISC;
 
-    if (ibuflen <= 1) {
+    if (ibuflen < 2) {
         return( AFPERR_PARAM );
     }
 
@@ -525,11 +527,11 @@ static int randnum_login(void *obj, struct passwd **uam_pwd,
 
 /* randnum login ext */
 static int randnum_login_ext(void *obj, char *uname, struct passwd **uam_pwd,
-                        char *ibuf, int ibuflen,
-                        char *rbuf, int *rbuflen)
+                        char *ibuf, size_t ibuflen,
+                        char *rbuf, size_t *rbuflen)
 {
     char       *username;
-    int        len, ulen;
+    size_t     len, ulen;
     u_int16_t  temp16;
 
     *rbuflen = 0;
index f969a1c5d0f6007f15ea566f0fdf009618251bbe..ed79772d44950f6e4a42aea2d13c657191a71bad 100644 (file)
@@ -88,7 +88,7 @@ extern int uam_checkuser (const struct passwd *);
 /* afp helper functions */
 extern int uam_afp_read (void *, char *, int *,
                             int (*)(void *, void *, const int));
-extern int uam_afpserver_option (void *, const int, void *, int *);
+extern int uam_afpserver_option (void *, const int, void *, size_t *);
 #ifdef TRU64
 extern void uam_afp_getcmdline (int *, char ***);
 extern int uam_sia_validate_user (sia_collect_func_t *, int, char **,