X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fuams%2Fuams_dhx_pam.c;h=8d589836d1897ae668eddd4ff6d0c07ccd01c8fe;hb=5c44fef72776e8e48ffc1a3df102ebcd04da0e4e;hp=51f99e579ab231316e444f44ab556a90b33b1675;hpb=84819a74eb43c4b35865a1f55dc2409637d506f5;p=netatalk.git diff --git a/etc/uams/uams_dhx_pam.c b/etc/uams/uams_dhx_pam.c index 51f99e57..8d589836 100644 --- a/etc/uams/uams_dhx_pam.c +++ b/etc/uams/uams_dhx_pam.c @@ -1,5 +1,5 @@ /* - * $Id: uams_dhx_pam.c,v 1.24.6.5 2004-06-24 01:20:12 bfernhomberg Exp $ + * $Id: uams_dhx_pam.c,v 1.24.6.5.2.2 2008-12-03 19:17:27 didg Exp $ * * Copyright (c) 1990,1993 Regents of The University of Michigan. * Copyright (c) 1999 Adrian Sun (asun@u.washington.edu) @@ -83,7 +83,7 @@ static char *PAM_password; static int PAM_conv (int num_msg, const struct pam_message **msg, struct pam_response **resp, - void *appdata_ptr) { + void *appdata_ptr _U_) { int count = 0; struct pam_response *reply; @@ -185,7 +185,7 @@ static struct pam_conv PAM_conversation = { }; -static int dhx_setup(void *obj, char *ibuf, int ibuflen, +static int dhx_setup(void *obj, char *ibuf, int ibuflen _U_, char *rbuf, int *rbuflen) { u_int16_t sessid; @@ -193,12 +193,6 @@ static int dhx_setup(void *obj, char *ibuf, int ibuflen, BIGNUM *bn, *gbn, *pbn; DH *dh; - /* TODO: seed dhx_setup properly... this is a hack */ -#ifdef sun - /* *SEVERE* hack... fix */ - RAND_load_file("/var/adm/messages", KEYSIZE); -#endif /* sun */ - /* get the client's public key */ if (!(bn = BN_bin2bn(ibuf, KEYSIZE, NULL))) { /* Log Entry */ @@ -243,12 +237,22 @@ static int dhx_setup(void *obj, char *ibuf, int ibuflen, /* generate key and make sure that we have enough space */ dh->p = pbn; dh->g = gbn; - if (!DH_generate_key(dh) || (BN_num_bytes(dh->pub_key) > KEYSIZE)) { - /* Log Entry */ - LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key -- Not enough Space? -- %s", - strerror(errno)); - /* Log Entry */ - goto pam_fail; + if (DH_generate_key(dh) == 0) { + unsigned long dherror; + char errbuf[256]; + + ERR_load_crypto_strings(); + dherror = ERR_get_error(); + ERR_error_string_n(dherror, errbuf, 256); + + LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key (OpenSSL error code: %u, %s)", dherror, errbuf); + + ERR_free_strings(); + goto pam_fail; + } + if (BN_num_bytes(dh->pub_key) > KEYSIZE) { + LOG(log_info, logtype_uams, "uams_dhx_pam.c :PAM: Err Generating Key -- Not enough Space? -- %s", strerror(errno)); + goto pam_fail; } /* figure out the key. store the key in rbuf for now. */ @@ -316,7 +320,7 @@ pam_fail: } /* -------------------------------- */ -static int login(void *obj, char *username, int ulen, struct passwd **uam_pwd, +static int login(void *obj, char *username, int ulen, struct passwd **uam_pwd _U_, char *ibuf, int ibuflen, char *rbuf, int *rbuflen) { @@ -404,7 +408,7 @@ 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, + char *ibuf, int ibuflen _U_, char *rbuf, int *rbuflen) { char *hostname; @@ -561,7 +565,7 @@ static void pam_logout() { /* 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, char *ibuf, int ibuflen, + struct passwd *pwd _U_, char *ibuf, int ibuflen, char *rbuf, int *rbuflen) { BIGNUM *bn1, *bn2, *bn3;