diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2001-12-09 22:15:11 +0000 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2001-12-09 22:15:11 +0000 |
commit | da67a7d6126846939fd43b1ddb5aa8c06ee09301 (patch) | |
tree | e9df9e69023b0e8584ee85cd8a44daf210bee75d /modules/pam_rhosts/pam_rhosts_auth.c | |
parent | cb7734d4080f3673a34594ee4c6e7b02dcd89f33 (diff) | |
download | pam-da67a7d6126846939fd43b1ddb5aa8c06ee09301.tar.gz pam-da67a7d6126846939fd43b1ddb5aa8c06ee09301.tar.bz2 pam-da67a7d6126846939fd43b1ddb5aa8c06ee09301.zip |
Relevant BUGIDs: 490938
Purpose of commit: new feature
Commit summary:
---------------
Added libpammodutil and link it with every module as its built.
The issue here is that there is a lot of code that the various modules
use in common, and this staic library can be used to help make this code
more maintainable. I do not intend to make this library dynamic. Especially
right now, as I want to be free to chop and change the API and don't want
to deal with revision control and third party modules.
This checkin makes the pam_rhost_auth module make some use of this new
library. I don't intend to add support for any other module prior to
releasing 0.76.
Diffstat (limited to 'modules/pam_rhosts/pam_rhosts_auth.c')
-rw-r--r-- | modules/pam_rhosts/pam_rhosts_auth.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modules/pam_rhosts/pam_rhosts_auth.c b/modules/pam_rhosts/pam_rhosts_auth.c index 7ee77f1d..7266b4e8 100644 --- a/modules/pam_rhosts/pam_rhosts_auth.c +++ b/modules/pam_rhosts/pam_rhosts_auth.c @@ -96,6 +96,7 @@ int innetgr(const char *, const char *, const char *,const char *); #include <security/pam_modules.h> #include <security/_pam_macros.h> +#include <security/_pam_modutil.h> /* to the best of my knowledge, all modern UNIX boxes have 32 bit integers */ #define U32 unsigned int @@ -232,15 +233,16 @@ static int pam_get_rhost(pam_handle_t *pamh, const char **rhost * requesting the contents of the PAM_RUSER item. */ -static int pam_get_ruser(pam_handle_t *pamh, const char **ruser - , const char *prompt) +static int pam_get_ruser(pam_handle_t *pamh, const char **ruser, + const char *prompt) { int retval; const char *current; retval = pam_get_item (pamh, PAM_RUSER, (const void **)¤t); - if (retval != PAM_SUCCESS) + if (retval != PAM_SUCCESS) { return retval; + } if (current == NULL) { return PAM_AUTH_ERR; @@ -491,7 +493,7 @@ pam_iruserok(pam_handle_t *pamh, * Identify user's local .rhosts file */ - pwd = getpwnam(luser); + pwd = _pammodutil_getpwnam(pamh, luser); if (pwd == NULL) { /* * luser is assumed to be valid because of an earlier check for uid = 0 @@ -660,10 +662,11 @@ static int _pam_auth_rhosts (pam_handle_t *pamh, const char **argv) { int retval; - const char *luser; - const char *ruser,*rhost; + const char *luser = NULL; + const char *ruser = NULL, *rhost = NULL; struct _options opts; int as_root = 0; + /* * Look at the options and set the flags accordingly. */ @@ -675,6 +678,7 @@ static int _pam_auth_rhosts (pam_handle_t *pamh, for (;;) { /* abuse loop to avoid goto */ /* get the remotehost */ + D(("getting rhost")); retval = pam_get_rhost(pamh, &rhost, NULL); (void) pam_set_item(pamh, PAM_RHOST, rhost); if (retval != PAM_SUCCESS) { @@ -685,6 +689,7 @@ static int _pam_auth_rhosts (pam_handle_t *pamh, } /* get the remote user */ + D(("getting ruser")); retval = pam_get_ruser(pamh, &ruser, NULL); (void) pam_set_item(pamh, PAM_RUSER, ruser); if (retval != PAM_SUCCESS) { @@ -694,8 +699,8 @@ static int _pam_auth_rhosts (pam_handle_t *pamh, } /* get the local user */ + D(("getting user")); retval = pam_get_user(pamh, &luser, NULL); - if (retval != PAM_SUCCESS) { if (opts.opt_debug) _pam_log(LOG_DEBUG, "could not determine name of local user"); @@ -710,7 +715,7 @@ static int _pam_auth_rhosts (pam_handle_t *pamh, if (! opts.opt_no_uid_check) { struct passwd *luser_pwd; - luser_pwd = getpwnam(luser); + luser_pwd = _pammodutil_getpwnam(pamh, luser); if (luser_pwd == NULL) { if (opts.opt_debug) _pam_log(LOG_DEBUG, "user '%s' unknown to this system", |