diff options
author | Gerald Carter <jerry@samba.org> | 2005-01-19 22:50:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:54:00 -0500 |
commit | 811df6699c76a2d6f7561efc27c1bdfa0a8d5c4d (patch) | |
tree | 1072ce90b5948adb666a535da51db29847efb414 | |
parent | 372440f207d88e058af76cf7ce4c5901ba7a7547 (diff) | |
download | samba-811df6699c76a2d6f7561efc27c1bdfa0a8d5c4d.tar.gz samba-811df6699c76a2d6f7561efc27c1bdfa0a8d5c4d.tar.bz2 samba-811df6699c76a2d6f7561efc27c1bdfa0a8d5c4d.zip |
r4860: fix silly limitation in ldapsam and tdbsam. Expand variables in the profile path, logon home and logon script values
(This used to be commit 504ea4ac68f47b71542a88b17cbb6b546e1cb881)
-rw-r--r-- | source3/passdb/passdb.c | 26 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 17 |
2 files changed, 27 insertions, 16 deletions
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index aeea4316f3..1f5e4be6cf 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -1777,6 +1777,7 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) uint32 lm_pw_len, nt_pw_len, nt_pw_hist_len, hourslen; uint32 pwHistLen = 0; BOOL ret = True; + fstring tmpstring; if(sampass == NULL || buf == NULL) { DEBUG(0, ("init_sam_from_buffer_v2: NULL parameters found!\n")); @@ -1840,7 +1841,9 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) pdb_set_fullname(sampass, fullname, PDB_SET); if (homedir) { - pdb_set_homedir(sampass, homedir, PDB_SET); + fstrcpy( tmpstring, homedir ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_homedir(sampass, tmpstring, PDB_SET); } else { pdb_set_homedir(sampass, @@ -1850,14 +1853,14 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) if (dir_drive) pdb_set_dir_drive(sampass, dir_drive, PDB_SET); - else { - pdb_set_dir_drive(sampass, - talloc_sub_basic(sampass->mem_ctx, username, lp_logon_drive()), - PDB_DEFAULT); - } + else + pdb_set_dir_drive(sampass, lp_logon_drive(), PDB_DEFAULT ); - if (logon_script) - pdb_set_logon_script(sampass, logon_script, PDB_SET); + if (logon_script) { + fstrcpy( tmpstring, logon_script ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_logon_script(sampass, tmpstring, PDB_SET); + } else { pdb_set_logon_script(sampass, talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()), @@ -1865,8 +1868,11 @@ BOOL init_sam_from_buffer_v2(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen) } if (profile_path) { - pdb_set_profile_path(sampass, profile_path, PDB_SET); - } else { + fstrcpy( tmpstring, profile_path ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_profile_path(sampass, tmpstring, PDB_SET); + } + else { pdb_set_profile_path(sampass, talloc_sub_basic(sampass->mem_ctx, username, lp_logon_path()), PDB_DEFAULT); diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 0c6e59b2fc..8b7661d9a3 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -476,6 +476,7 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, pstring temp; LOGIN_CACHE *cache_entry = NULL; int pwHistLen; + pstring tmpstring; /* * do a little initialization @@ -635,9 +636,7 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, if (!smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, get_userattr_key2string(ldap_state->schema_ver, LDAP_ATTR_HOME_DRIVE), dir_drive)) { - pdb_set_dir_drive( sampass, - talloc_sub_basic(sampass->mem_ctx, username, lp_logon_drive()), - PDB_DEFAULT ); + pdb_set_dir_drive( sampass, lp_logon_drive(), PDB_DEFAULT ); } else { pdb_set_dir_drive(sampass, dir_drive, PDB_SET); } @@ -649,7 +648,9 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, talloc_sub_basic(sampass->mem_ctx, username, lp_logon_home()), PDB_DEFAULT ); } else { - pdb_set_homedir(sampass, homedir, PDB_SET); + pstrcpy( tmpstring, homedir ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_homedir(sampass, tmpstring, PDB_SET); } if (!smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, @@ -659,7 +660,9 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, talloc_sub_basic(sampass->mem_ctx, username, lp_logon_script()), PDB_DEFAULT ); } else { - pdb_set_logon_script(sampass, logon_script, PDB_SET); + pstrcpy( tmpstring, logon_script ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_logon_script(sampass, tmpstring, PDB_SET); } if (!smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, @@ -669,7 +672,9 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state, talloc_sub_basic( sampass->mem_ctx, username, lp_logon_path()), PDB_DEFAULT ); } else { - pdb_set_profile_path(sampass, profile_path, PDB_SET); + pstrcpy( tmpstring, profile_path ); + standard_sub_basic( username, tmpstring, sizeof(tmpstring) ); + pdb_set_profile_path(sampass, tmpstring, PDB_SET); } if (!smbldap_get_single_pstring(ldap_state->smbldap_state->ldap_struct, entry, |