summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-05-18 05:52:52 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-05-18 05:52:52 +0000
commit58e1fe62cc955c6b8449332447a6879c6fab64e7 (patch)
treed132d46aad501e052c6431a0506fbd7c0d56722b /source3/smbd
parent27ecfceae15ae80224f4dedd07381598b945359e (diff)
downloadsamba-58e1fe62cc955c6b8449332447a6879c6fab64e7.tar.gz
samba-58e1fe62cc955c6b8449332447a6879c6fab64e7.tar.bz2
samba-58e1fe62cc955c6b8449332447a6879c6fab64e7.zip
A few things in this commit:
cleanup some of the code in net_rpc_join re const warnings and fstrings. Passdb: Make the %u and %U substituions in passdb work. This is done by declaring these paramters to be 'const' and doing the substitution manually. I'm told this is us going full circle, but I can't really see a better way. Finally these things actually seem to work properly... Make the lanman code use the pdb's recorded values for homedir etc rather than the values from lp_*() Add code to set the plaintext password in the passdb, where it can decide how to store/set it. For use with a future 'ldap password change' option, or somthing like that... Add pdb_unix, so as to remove the 'not in passdb' special cases from the local_lookup_*() code. Quite small, as it uses the new 'struct passwd -> SAM_ACCOUNT' code that is now in just one place. (also used by pdb_smbpasswd) Other: Fix up the adding of [homes] at session setup time to actually pass the right string, that is the unix homedir, not the UNC path. Fix up [homes] so that for winbind users is picks the correct name. (bad interactions with the default domain code previously) Change the rpc_server/srv_lsa_nt.c code to match NT when for the SATUS_NONE_MAPPED reply: This was only being triggered on no queries, now it is on the 'no mappings' (ie all mappings failed). Checked against Win2k. Policy Question: Should SID -> unix_user.234/unix_group.364 be considered a mapping or not? Currently it isn't. Andrew Bartlett (This used to be commit c28668068b5a3b3cf3c4317e5fb32ec9957f3e34)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c29
-rw-r--r--source3/smbd/password.c14
-rw-r--r--source3/smbd/service.c19
3 files changed, 36 insertions, 26 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index f8875c5c0f..5585097c91 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1933,7 +1933,7 @@ static BOOL api_RNetUserEnum(connection_struct *conn,uint16 vuid, char *param,ch
while ( pdb_getsampwent(pwd) ) {
const char *name=pdb_get_username(pwd);
- if( *(name+strlen(name)-1)!='$' ) {
+ if ((name) && (*(name+strlen(name)-1)!='$')) {
count_total++;
if(count_total>=resume_context) {
if( ((PTR_DIFF(p,*rdata)+21)<=*rdata_len)&&(strlen(name)<=21) ) {
@@ -2793,8 +2793,7 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
SIVAL(p,usri11_auth_flags,AF_OP_PRINT); /* auth flags */
SIVALS(p,usri11_password_age,-1); /* password age */
SIVAL(p,usri11_homedir,PTR_DIFF(p2,p)); /* home dir */
- pstrcpy(p2, lp_logon_home());
- standard_sub_conn(conn, p2);
+ pstrcpy(p2, vuser && vuser->homedir ? vuser->homedir : "");
p2 = skip_string(p2,1);
SIVAL(p,usri11_parms,PTR_DIFF(p2,p)); /* parms */
pstrcpy(p2,"");
@@ -2830,15 +2829,13 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
SSVAL(p,42,
conn->admin_user?USER_PRIV_ADMIN:USER_PRIV_USER);
SIVAL(p,44,PTR_DIFF(p2,*rdata)); /* home dir */
- pstrcpy(p2,lp_logon_home());
- standard_sub_conn(conn, p2);
+ pstrcpy(p2, vuser && vuser->homedir ? vuser->homedir : "");
p2 = skip_string(p2,1);
SIVAL(p,48,PTR_DIFF(p2,*rdata)); /* comment */
*p2++ = 0;
SSVAL(p,52,0); /* flags */
SIVAL(p,54,PTR_DIFF(p2,*rdata)); /* script_path */
- pstrcpy(p2,lp_logon_script());
- standard_sub_conn( conn, p2 );
+ pstrcpy(p2,vuser && vuser->logon_script ? vuser->logon_script : "");
p2 = skip_string(p2,1);
if (uLevel == 2)
{
@@ -2888,6 +2885,12 @@ static BOOL api_WWkstaUserLogon(connection_struct *conn,uint16 vuid, char *param
int uLevel;
struct pack_desc desc;
char* name;
+ /* With share level security vuid will always be zero.
+ Don't depend on vuser being non-null !!. JRA */
+ user_struct *vuser = get_valid_user_struct(vuid);
+ if(vuser != NULL)
+ DEBUG(3,(" Username of UID %d is %s\n", (int)vuser->uid,
+ vuser->user.unix_name));
uLevel = SVAL(p,0);
name = p + 2;
@@ -2931,15 +2934,7 @@ static BOOL api_WWkstaUserLogon(connection_struct *conn,uint16 vuid, char *param
}
PACKS(&desc,"z",global_myworkgroup);/* domain */
-/* JHT - By calling lp_logon_script() and standard_sub() we have */
-/* made sure all macros are fully substituted and available */
- {
- pstring logon_script;
- pstrcpy(logon_script,lp_logon_script());
- standard_sub_conn( conn, logon_script );
- PACKS(&desc,"z", logon_script); /* script path */
- }
-/* End of JHT mods */
+ PACKS(&desc,"z", vuser && vuser->logon_script ? vuser->logon_script :""); /* script path */
PACKI(&desc,"D",0x00000000); /* reserved */
}
@@ -3458,7 +3453,7 @@ static int gather_sessioninfo(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
{
struct sessions_info *sinfo = state;
struct session_info *curinfo = NULL;
- struct sessionid *sessid = (struct sessionid *) dbuf.dptr;
+ const struct sessionid *sessid = (const struct sessionid *) dbuf.dptr;
sinfo->count += 1;
sinfo->session_list = REALLOC(sinfo->session_list, sinfo->count * sizeof(struct session_info));
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 629157f22d..a8fd2b47f1 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -259,9 +259,19 @@ int register_vuid(auth_serversupplied_info *server_info, char *smb_name)
{
/* Keep the homedir handy */
const char *homedir = pdb_get_homedir(server_info->sam_account);
+ const char *unix_homedir = pdb_get_unix_homedir(server_info->sam_account);
+ const char *logon_script = pdb_get_logon_script(server_info->sam_account);
if (homedir) {
vuser->homedir = smb_xstrdup(homedir);
}
+
+ if (unix_homedir) {
+ vuser->unix_homedir = smb_xstrdup(unix_homedir);
+ }
+
+ if (logon_script) {
+ vuser->logon_script = smb_xstrdup(logon_script);
+ }
}
memcpy(vuser->session_key, server_info->session_key, sizeof(vuser->session_key));
@@ -301,9 +311,9 @@ int register_vuid(auth_serversupplied_info *server_info, char *smb_name)
}
/* Register a home dir service for this user */
- if ((!vuser->guest) && vuser->homedir && *(vuser->homedir)
+ if ((!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir)
&& (lp_servicenumber(vuser->user.unix_name) < 0)) {
- add_home_service(vuser->user.unix_name, vuser->homedir);
+ add_home_service(vuser->user.unix_name, vuser->unix_homedir);
}
return vuser->vuid;
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 467bab4a0a..32ceb63154 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -81,9 +81,6 @@ BOOL set_current_service(connection_struct *conn,BOOL do_chdir)
int add_home_service(const char *service, const char *homedir)
{
int iHomeService;
- int iService;
- fstring new_service;
- fstring domain;
if (!service || !homedir)
return -1;
@@ -98,11 +95,19 @@ int add_home_service(const char *service, const char *homedir)
* include any macros.
*/
- split_domain_and_name(service, domain, new_service);
- lp_add_home(new_service, iHomeService, homedir);
- iService = lp_servicenumber(new_service);
+ {
+ const char *p = strchr(service,*lp_winbind_separator());
+
+ /* We only want the 'user' part of the string */
+ if (p) {
+ service = p + 1;
+ }
+ }
+
+ lp_add_home(service, iHomeService, homedir);
+
+ return lp_servicenumber(service);
- return iService;
}