summaryrefslogtreecommitdiff
path: root/source3/passdb/pass_check.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>1999-06-13 04:14:24 +0000
committerTim Potter <tpot@samba.org>1999-06-13 04:14:24 +0000
commit731c7f2ecfe17651506ba05b88358360e4654a37 (patch)
tree57213f534b2bf1c8f53994a14884abbebfefde47 /source3/passdb/pass_check.c
parenteaa085e8a7106d595235b36d1592ca38b47ba53f (diff)
downloadsamba-731c7f2ecfe17651506ba05b88358360e4654a37.tar.gz
samba-731c7f2ecfe17651506ba05b88358360e4654a37.tar.bz2
samba-731c7f2ecfe17651506ba05b88358360e4654a37.zip
Moved code that changes the pw_passwd entry (i.e shadow password and
weird unixware stuff) into _Get_Pwnam() to fix a memory allocation bug. Note that the Get_Pwnam() function now returns a const struct passwd * as a hint to other developers not to change entries in the struct passwd. (This used to be commit 36d7cb4ccc42268e8e6a7b783c945d1853624958)
Diffstat (limited to 'source3/passdb/pass_check.c')
-rw-r--r--source3/passdb/pass_check.c64
1 files changed, 1 insertions, 63 deletions
diff --git a/source3/passdb/pass_check.c b/source3/passdb/pass_check.c
index f07f0e1abb..7effbfef8d 100644
--- a/source3/passdb/pass_check.c
+++ b/source3/passdb/pass_check.c
@@ -753,7 +753,7 @@ BOOL pass_check(char *user,char *password, int pwlen, struct passwd *pwd,
{
pstring pass2;
int level = lp_passwordlevel();
- struct passwd *pass;
+ const struct passwd *pass;
if (password) password[pwlen] = 0;
@@ -785,68 +785,6 @@ BOOL pass_check(char *user,char *password, int pwlen, struct passwd *pwd,
return(False);
}
-#ifdef HAVE_GETSPNAM
- {
- struct spwd *spass;
-
- /* many shadow systems require you to be root to get
- the password, in most cases this should already be
- the case when this function is called, except
- perhaps for IPC password changing requests */
-
- spass = getspnam(pass->pw_name);
- if (spass && spass->sp_pwdp) {
- pass->pw_passwd = spass->sp_pwdp;
- }
- }
-#elif defined(IA_UINFO)
- {
- /* Need to get password with SVR4.2's ia_ functions
- instead of get{sp,pw}ent functions. Required by
- UnixWare 2.x, tested on version
- 2.1. (tangent@cyberport.com) */
- uinfo_t uinfo;
- if (ia_openinfo(pass->pw_name, &uinfo) != -1) {
- ia_get_logpwd(uinfo, &(pass->pw_passwd));
- }
- }
-#endif
-
-#ifdef HAVE_GETPRPWNAM
- {
- struct pr_passwd *pr_pw = getprpwnam(pass->pw_name);
- if (pr_pw && pr_pw->ufld.fd_encrypt)
- pass->pw_passwd = pr_pw->ufld.fd_encrypt;
- }
-#endif
-
-#ifdef OSF1_ENH_SEC
- {
- struct pr_passwd *mypasswd;
- DEBUG(5,("Checking password for user %s in OSF1_ENH_SEC\n",
- user));
- mypasswd = getprpwnam (user);
- if (mypasswd) {
- fstrcpy(pass->pw_name,mypasswd->ufld.fd_name);
- fstrcpy(pass->pw_passwd,mypasswd->ufld.fd_encrypt);
- } else {
- DEBUG(5,("No entry for user %s in protected database !\n",
- user));
- return(False);
- }
- }
-#endif
-
-#ifdef ULTRIX_AUTH
- {
- AUTHORIZATION *ap = getauthuid(pass->pw_uid);
- if (ap) {
- fstrcpy(pass->pw_passwd, ap->a_password);
- endauthent();
- }
- }
-#endif
-
/* extract relevant info */
fstrcpy(this_user,pass->pw_name);
fstrcpy(this_salt,pass->pw_passwd);