diff options
author | Jeremy Allison <jra@samba.org> | 2001-01-24 19:34:53 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-01-24 19:34:53 +0000 |
commit | a72d12e992e2755e925032aef1aa99be74bf6652 (patch) | |
tree | c1afaa2d3324f62c984cf89deec733b573aa908c | |
parent | a958f7822e095367efb8749b6f1f2e110ffb8866 (diff) | |
download | samba-a72d12e992e2755e925032aef1aa99be74bf6652.tar.gz samba-a72d12e992e2755e925032aef1aa99be74bf6652.tar.xz samba-a72d12e992e2755e925032aef1aa99be74bf6652.zip |
smbd/process.c: & type with 0xff for paranioa sake...
smbd/reply.c smbd/service.c: cause all "add home service" calls to go through a
winbindd aware function.
Jeremy.
-rw-r--r-- | source/include/proto.h | 1 | ||||
-rw-r--r-- | source/smbd/process.c | 2 | ||||
-rw-r--r-- | source/smbd/reply.c | 5 | ||||
-rw-r--r-- | source/smbd/service.c | 72 |
4 files changed, 46 insertions, 34 deletions
diff --git a/source/include/proto.h b/source/include/proto.h index 7eb7d8554aa..d6da8923ec1 100644 --- a/source/include/proto.h +++ b/source/include/proto.h @@ -3942,6 +3942,7 @@ void exit_server(char *reason); #if OLD_NTDOMAIN BOOL become_service(connection_struct *conn,BOOL do_chdir); +int add_home_service(char *service, char *homedir); int find_service(char *service); connection_struct *make_connection(char *service,char *user,char *password, int pwlen, char *dev,uint16 vuid, int *ecode); void close_cnum(connection_struct *conn, uint16 vuid); diff --git a/source/smbd/process.c b/source/smbd/process.c index 9d857440b8a..eb182199926 100644 --- a/source/smbd/process.c +++ b/source/smbd/process.c @@ -615,6 +615,8 @@ static int switch_message(int type,char *inbuf,char *outbuf,int size,int bufsize int outsize = 0; extern int global_smbpid; + type &= 0xff; + if (pid == (pid_t)-1) pid = sys_getpid(); diff --git a/source/smbd/reply.c b/source/smbd/reply.c index dc604cf49b1..b24ec7a9440 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -1005,10 +1005,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int if (!strequal(user,lp_guestaccount(-1)) && lp_servicenumber(user) < 0) { - int homes = lp_servicenumber(HOMES_NAME); - char *home = get_user_home_dir(user); - if (homes >= 0 && home) - lp_add_home(user,homes,home); + add_home_service(user,get_user_home_dir(user)); } diff --git a/source/smbd/service.c b/source/smbd/service.c index 96f00eef129..f0ab2ba7712 100644 --- a/source/smbd/service.c +++ b/source/smbd/service.c @@ -78,10 +78,50 @@ BOOL become_service(connection_struct *conn,BOOL do_chdir) return(True); } +/**************************************************************************** + Add a home service. Returns the new service number or -1 if fail. +****************************************************************************/ + +int add_home_service(char *service, char *homedir) +{ + int iHomeService; + int iService; + fstring new_service; + char *usr_p = NULL; + + if (!service || !homedir) + return -1; + + if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) + return -1; + + /* + * If this is a winbindd provided username, remove + * the domain component before adding the service. + * Log a warning if the "path=" parameter does not + * include any macros. + */ + + fstrcpy(new_service, service); + + if ((usr_p = strchr(service,*lp_winbind_separator())) != NULL) + fstrcpy(new_service, usr_p+1); + + lp_add_home(new_service,iHomeService,homedir); + iService = lp_servicenumber(new_service); + + if ((iService != -1) && usr_p && (strstr(lp_pathname(iService),"%D") == NULL)) + DEBUG(0,("find_service: Service %s added for user %s - contains non-local (Domain) user \ +with non-domain parameterised path (%s). This may be cause the wrong directory to be seen.\n", + new_service, service, lp_pathname(iService) )); + + return iService; +} /**************************************************************************** - find a service entry. service is always in dos codepage + Find a service entry. service is always in dos codepage. ****************************************************************************/ + int find_service(char *service) { int iService; @@ -108,35 +148,7 @@ int find_service(char *service) DEBUG(3,("checking for home directory %s gave %s\n",service, phome_dir?phome_dir:"(NULL)")); - if (phome_dir) - { - int iHomeService; - if ((iHomeService = lp_servicenumber(HOMES_NAME)) >= 0) - { - /* - * If this is a winbindd provided username, remove - * the domain component before adding the service. - * Log a warning if the "path=" parameter does not - * include any macros. - */ - - fstring new_service; - char *usr_p = NULL; - - fstrcpy(new_service, service); - - if ((usr_p = strchr(service,*lp_winbind_separator())) != NULL) - fstrcpy(new_service, usr_p+1); - - lp_add_home(new_service,iHomeService,phome_dir); - iService = lp_servicenumber(new_service); - - if (usr_p && (strchr(lp_pathname(iService),'%') == NULL)) - DEBUG(0,("find_service: Service %s added for user %s - contains non-local (Domain) user \ -with non parameterised path (%s). This may be cause the wrong directory to be seen.\n", - new_service, service, lp_pathname(iService) )); - } - } + iService = add_home_service(service,phome_dir); } /* If we still don't have a service, attempt to add it as a printer. */ |