Rename some globals to reduce namespace pollution.
This commit is contained in:
parent
54b13b2539
commit
27b3c47e84
@ -52,8 +52,9 @@ static const char sccsid[] = "@(#)klogin.c 8.3 (Berkeley) 4/2/94";
|
||||
#define INITIAL_TICKET "krbtgt"
|
||||
#define VERIFY_SERVICE "rcmd"
|
||||
|
||||
extern int notickets;
|
||||
extern char *krbtkfile_env;
|
||||
extern int _pam_notickets;
|
||||
extern char *_pam_krbtkfile_env;
|
||||
extern int _pam_noticketsdontcomplain;
|
||||
|
||||
/*
|
||||
* Attempt to log the user in using Kerberos authentication
|
||||
@ -62,7 +63,7 @@ extern char *krbtkfile_env;
|
||||
* 1 if Kerberos failed (try local password in login)
|
||||
*/
|
||||
int
|
||||
klogin(pw, instance, localhost, password)
|
||||
_pam_klogin(pw, instance, localhost, password)
|
||||
struct passwd *pw;
|
||||
char *instance, *localhost, *password;
|
||||
{
|
||||
@ -70,7 +71,6 @@ klogin(pw, instance, localhost, password)
|
||||
char realm[REALM_SZ], savehost[MAXHOSTNAMELEN];
|
||||
char tkt_location[MAXPATHLEN];
|
||||
char *krb_get_phost();
|
||||
extern int noticketsdontcomplain;
|
||||
|
||||
#ifdef KLOGIN_PARANOID
|
||||
AUTH_DAT authdata;
|
||||
@ -78,7 +78,7 @@ klogin(pw, instance, localhost, password)
|
||||
struct hostent *hp;
|
||||
unsigned long faddr;
|
||||
|
||||
noticketsdontcomplain = 0; /* enable warning message */
|
||||
_pam_noticketsdontcomplain = 0; /* enable warning message */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -93,7 +93,7 @@ klogin(pw, instance, localhost, password)
|
||||
krb_get_lrealm(realm, 0) != KSUCCESS)
|
||||
return (1);
|
||||
|
||||
noticketsdontcomplain = 0; /* enable warning message */
|
||||
_pam_noticketsdontcomplain = 0; /* enable warning message */
|
||||
|
||||
/*
|
||||
* get TGT for local realm
|
||||
@ -105,7 +105,7 @@ klogin(pw, instance, localhost, password)
|
||||
(void)sprintf(tkt_location, "%s%d", TKT_ROOT, pw->pw_uid);
|
||||
else {
|
||||
(void)sprintf(tkt_location, "%s_root_%d", TKT_ROOT, pw->pw_uid);
|
||||
krbtkfile_env = tkt_location;
|
||||
_pam_krbtkfile_env = tkt_location;
|
||||
}
|
||||
(void)krb_set_tkt_string(tkt_location);
|
||||
|
||||
@ -155,7 +155,7 @@ klogin(pw, instance, localhost, password)
|
||||
syslog(LOG_NOTICE,
|
||||
"warning: TGT not verified (%s); %s.%s not registered, or srvtab is wrong?",
|
||||
krb_err_txt[kerror], VERIFY_SERVICE, savehost);
|
||||
notickets = 0;
|
||||
_pam_notickets = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ klogin(pw, instance, localhost, password)
|
||||
&authdata, "");
|
||||
|
||||
if (kerror == KSUCCESS) {
|
||||
notickets = 0;
|
||||
_pam_notickets = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ klogin(pw, instance, localhost, password)
|
||||
dest_tkt();
|
||||
return (1);
|
||||
#else
|
||||
notickets = 0;
|
||||
_pam_notickets = 0;
|
||||
return (0);
|
||||
#endif
|
||||
}
|
||||
|
@ -39,12 +39,12 @@
|
||||
|
||||
#define PASSWORD_PROMPT "Password:"
|
||||
|
||||
extern int klogin(struct passwd *, char *, char *, char *);
|
||||
extern int _pam_klogin(struct passwd *, char *, char *, char *);
|
||||
|
||||
/* Globals used by klogin.c */
|
||||
int notickets = 1;
|
||||
int noticketsdontcomplain = 1;
|
||||
char *krbtkfile_env;
|
||||
/* Globals used by _pam_klogin.c */
|
||||
int _pam_notickets = 1;
|
||||
int _pam_noticketsdontcomplain = 1;
|
||||
char *_pam_krbtkfile_env;
|
||||
|
||||
PAM_EXTERN int
|
||||
pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
|
||||
@ -77,17 +77,17 @@ pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
|
||||
else
|
||||
instance = "";
|
||||
if ((pwd = getpwnam(user)) != NULL &&
|
||||
klogin(pwd, instance, localhost, (char *)password) == 0) {
|
||||
if (!(flags & PAM_SILENT) && notickets &&
|
||||
!noticketsdontcomplain)
|
||||
_pam_klogin(pwd, instance, localhost, (char *)password) == 0) {
|
||||
if (!(flags & PAM_SILENT) && _pam_notickets &&
|
||||
!_pam_noticketsdontcomplain)
|
||||
pam_prompt(pamh, PAM_ERROR_MSG,
|
||||
"Warning: no Kerberos tickets issued", NULL);
|
||||
/*
|
||||
* XXX - I think the ticket file really isn't supposed to
|
||||
* be even created until pam_sm_setcred() is called.
|
||||
*/
|
||||
if (krbtkfile_env != NULL)
|
||||
setenv("KRBTKFILE", krbtkfile_env, 1);
|
||||
if (_pam_krbtkfile_env != NULL)
|
||||
setenv("KRBTKFILE", _pam_krbtkfile_env, 1);
|
||||
retval = PAM_SUCCESS;
|
||||
} else
|
||||
retval = PAM_AUTH_ERR;
|
||||
|
Loading…
x
Reference in New Issue
Block a user