summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-12-31 15:48:03 +0000
committerSimo Sorce <idra@samba.org>2001-12-31 15:48:03 +0000
commitf796f18a83cd2fc0988612aa38c794f005efbfaf (patch)
tree455d57cdc65ed6ac05b54e8547be0c749c68cc3c
parent466f515240aaeca7b0fe2b7b3474ab23cab687cc (diff)
downloadsamba-f796f18a83cd2fc0988612aa38c794f005efbfaf.tar.gz
samba-f796f18a83cd2fc0988612aa38c794f005efbfaf.tar.xz
samba-f796f18a83cd2fc0988612aa38c794f005efbfaf.zip
port mods from 2.2
-rw-r--r--source/passdb/pdb_tdb.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/source/passdb/pdb_tdb.c b/source/passdb/pdb_tdb.c
index bc3062aedb5..69b2aab2299 100644
--- a/source/passdb/pdb_tdb.c
+++ b/source/passdb/pdb_tdb.c
@@ -141,8 +141,14 @@ static BOOL init_sam_from_buffer (SAM_ACCOUNT *sampass, uint8 *buf, uint32 bufle
pdb_set_acct_desc (sampass, acct_desc_len?acct_desc:NULL);
pdb_set_workstations (sampass, workstations_len?workstations:NULL);
pdb_set_munged_dial (sampass, munged_dial_len?munged_dial:NULL);
- pdb_set_lanman_passwd(sampass, lmpwlen?lm_pw_ptr:NULL);
- pdb_set_nt_passwd (sampass, ntpwlen?nt_pw_ptr:NULL);
+ if (!pdb_set_lanman_passwd(sampass, lmpwlen?lm_pw_ptr:NULL)) {
+ ret = False;
+ goto done;
+ }
+ if (!pdb_set_nt_passwd(sampass, ntpwlen?nt_pw_ptr:NULL)) {
+ ret = False;
+ goto done;
+ }
/*pdb_set_uid(sampass, uid);
pdb_set_gid(sampass, gid);*/
@@ -427,6 +433,9 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
char *prefix = USERPREFIX;
int prefixlen = strlen (prefix);
+ const char *sam_user;
+ pstring sam_subst;
+
if (user==NULL) {
DEBUG(0,("pdb_get_sampwent: SAM_ACCOUNT is NULL.\n"));
return False;
@@ -471,6 +480,17 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user)
pdb_set_uid(user, uid);
pdb_set_gid(user, gid);
+ /* 21 days from present */
+ pdb_set_pass_must_change_time(user, time(NULL)+1814400);
+
+ sam_user = pdb_get_username(user);
+ pstrcpy(sam_subst, pdb_get_logon_script(user));
+ standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst);
+ pstrcpy(sam_subst, pdb_get_profile_path(user));
+ standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst);
+ pstrcpy(sam_subst, pdb_get_homedir(user));
+ standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst);
+
/* increment to next in line */
global_tdb_ent.key = tdb_nextkey(global_tdb_ent.passwd_tdb, global_tdb_ent.key);
@@ -492,6 +512,8 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname)
uid_t uid;
gid_t gid;
+ char *sam_user;
+ pstring sam_subst;
if (user==NULL) {
DEBUG(0,("pdb_getsampwnam: SAM_ACCOUNT is NULL.\n"));
@@ -533,7 +555,7 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname)
}
SAFE_FREE(data.dptr);
- /* cleanup */
+ /* no further use for database, close it now */
tdb_close(pwd_tdb);
/* validate the account and fill in UNIX uid and gid. sys_getpwnam()
@@ -544,6 +566,17 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname)
gid = pw->pw_gid;
pdb_set_uid(user, uid);
pdb_set_gid(user, gid);
+
+ /* 21 days from present */
+ pdb_set_pass_must_change_time(user, time(NULL)+1814400);
+
+ sam_user = pdb_get_username(user);
+ pstrcpy(sam_subst, pdb_get_logon_script(user));
+ standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst);
+ pstrcpy(sam_subst, pdb_get_profile_path(user));
+ standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst);
+ pstrcpy(sam_subst, pdb_get_homedir(user));
+ standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst);
}
else {
DEBUG(0,("pdb_getsampwent: getpwnam(%s) return NULL. User does not exist!\n",