]> arthur.barton.de Git - netatalk.git/blobdiff - etc/uams/uams_pgp.c
Posix/SUS portability cleanup
[netatalk.git] / etc / uams / uams_pgp.c
index ced79fe54d4871875217ecf156cf93ea98d95fe5..ec6d4095e17db4eea8caf3342e06d9a3cf0e0e4d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: uams_pgp.c,v 1.5 2001-06-25 20:13:45 rufustfirefly 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) 
 
 #ifdef UAM_PGP
 
+#include <atalk/standards.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
+#ifdef HAVE_CRYPT_H
+#include <crypt.h>
+#endif /* HAVE_CRYPT_H */
 #include <pwd.h>
-#include <syslog.h>
+#include <atalk/logger.h>
 
-#ifdef OPENSSL_DHX
+#if defined(GNUTLS_DHX)
+#include <gnutls/openssl.h>
+#elif defined(OPENSSL_DHX)
 #include <openssl/bn.h>
 #include <openssl/dh.h>
 #include <openssl/cast.h>
@@ -50,12 +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)
 {
-    BIGNUM *bn, *gbn, *pbn;
-    u_int16_t sessid;
-    int len, i;
+    size_t len, i;
     char *name;
 
     *rbuflen = 0;
@@ -74,11 +79,11 @@ static int pgp_login(void *obj, struct passwd **uam_pwd,
     if ((unsigned long) ibuf & 1) /* padding */
       ++ibuf;
 
-    if (( pgppwd = uam_getname(name, i)) == NULL ) {
+    if (( pgppwd = uam_getname(obj, name, i)) == NULL ) {
       return AFPERR_PARAM;
     }
 
-    syslog( LOG_INFO, "pgp login: %s", name);
+    LOG(log_info, logtype_uams, "pgp login: %s", name);
     if (uam_checkuser(pgppwd) < 0)
       return AFPERR_NOTAUTH;
 
@@ -99,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;