-/* Copyright (c) 1990,1993 Regents of The University of Michigan.
+/*
+ *
+ * Copyright (c) 1990,1993 Regents of The University of Michigan.
* Copyright (c) 1999 Adrian Sun (asun@u.washington.edu)
* All Rights Reserved. See COPYRIGHT.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
#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>
+
+#if defined(GNUTLS_DHX)
+#include <gnutls/openssl.h>
+#elif defined(OPENSSL_DHX)
+#include <openssl/bn.h>
+#include <openssl/dh.h>
+#include <openssl/cast.h>
+#else /* OPENSSL_DHX */
#include <bn.h>
+#include <dh.h>
+#include <cast.h>
+#endif /* OPENSSL_DHX */
#include <atalk/afp.h>
#include <atalk/uam.h>
/* the secret key */
static struct passwd *pgppwd;
-
+static CAST_KEY castkey;
+static uint8_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;
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;
if (uam_afpserver_option(obj, UAM_OPTION_SIGNATURE,
(void *) &name, NULL) < 0) {
*rbuflen = 0;
- goto passwd_fail;
+ goto pgp_fail;
}
memcpy(rbuf + KEYSIZE, name, KEYSIZE);
}
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;
- u_int16_t sessid;
+ uint16_t sessid;
char *p;
*rbuflen = 0;
*uam_pwd = pgppwd;
return AFP_OK;
}
-#endif AFS
+#endif /* AFS */
rbuf[PASSWDLEN] = '\0';
p = crypt( rbuf, pgppwd->pw_passwd );
UAM_MODULE_VERSION,
uam_setup, uam_cleanup
};
-#endif
+
+#endif /* UAM_PGP */