From f6276724bafdb6145c0c7b565172d80cb04516ea Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Dec 1999 21:00:35 +0000 Subject: changed function name of get_home_dir() to get_unixhome_dir(), to stop clash with gnu readline library. fixed issue with [homes] service not being there - call lp_add_home() just before starting the msrpc processing. (This used to be commit 054195df9b6187c663ede5cf4489499abbdc29fc) --- source3/include/proto.h | 10 +++++++++- source3/lib/username.c | 4 ++-- source3/lib/util.c | 6 +++--- source3/msrpc/msrpcd.c | 2 +- source3/msrpc/msrpcd_process.c | 14 ++++++++++++++ source3/param/loadparm.c | 2 +- source3/smbd/password.c | 2 +- source3/smbd/reply.c | 2 +- source3/smbd/service.c | 4 ++-- 9 files changed, 34 insertions(+), 12 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 4ac79a02fd..3c37085160 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -437,7 +437,7 @@ char *ufc_crypt(char *key,char *salt); struct passwd *hashed_getpwnam(const char *name); char *uidtoname(uid_t uid); -char *get_home_dir(char *user); +char *get_unixhome_dir(char *user); BOOL map_username(char *user); const struct passwd *Get_Pwnam(char *user,BOOL allow_change); BOOL user_ok(char *user,int snum); @@ -2022,6 +2022,10 @@ BOOL cli_net_sam_sync( const char* srv_name, const char* myhostname, SAM_DELTA_HDR *hdr_deltas, SAM_DELTA_CTR *deltas); +/*The following definitions come from rpc_client/cli_netlogon_sync.c */ + +BOOL synchronise_passdb(void); + /*The following definitions come from rpc_client/cli_pipe.c */ BOOL create_rpc_bind_resp(struct pwd_info *pwd, @@ -4566,6 +4570,10 @@ BOOL reload_services(BOOL test); void msrpc_service_init(void); BOOL reload_services(BOOL test); +/*The following definitions come from utils/smbpasswd.c */ + +int main(int argc, char **argv); + /*The following definitions come from web/cgi.c */ void cgi_load_variables(FILE *f1); diff --git a/source3/lib/username.c b/source3/lib/username.c index 9f51d06642..23bdb54faf 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -302,7 +302,7 @@ char *uidtoname(uid_t uid) /**************************************************************************** get a users home directory. ****************************************************************************/ -char *get_home_dir(char *user) +char *get_unixhome_dir(char *user) { const struct passwd *pass; static pstring home_dir; @@ -312,7 +312,7 @@ char *get_home_dir(char *user) if (pass == NULL || pass->pw_dir == NULL) return(NULL); pstrcpy(home_dir, pass->pw_dir); - DEBUG(10,("get_home_dir: returning %s for user %s\n", home_dir, user)); + DEBUG(10,("get_smbhome_dir: returning %s for user %s\n", home_dir, user)); return home_dir; } diff --git a/source3/lib/util.c b/source3/lib/util.c index 7d099282f8..25769298be 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -2091,8 +2091,8 @@ static char *automount_path(char *user_name) /* use the passwd entry as the default */ /* this will be the default if WITH_AUTOMOUNT is not used or fails */ - /* pstrcpy() copes with get_home_dir() returning NULL */ - pstrcpy(server_path, get_home_dir(user_name)); + /* pstrcpy() copes with get_unixhome_dir() returning NULL */ + pstrcpy(server_path, get_unixhome_dir(user_name)); #if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT)) @@ -2221,7 +2221,7 @@ void standard_sub(connection_struct *conn,char *str) switch (*(p+1)) { case 'H': - if ((home = get_home_dir(conn->user)) != NULL) { + if ((home = get_unixhome_dir(conn->user)) != NULL) { string_sub(p,"%H",home); } else { p += 2; diff --git a/source3/msrpc/msrpcd.c b/source3/msrpc/msrpcd.c index 942d6f1258..d6ae3ca642 100644 --- a/source3/msrpc/msrpcd.c +++ b/source3/msrpc/msrpcd.c @@ -558,7 +558,7 @@ int msrpc_main(int argc,char *argv[]) fstrcpy(static_pipe.name, pipe_name); if (msrpcd_init(ClientMSRPC, &static_pipe)) { - reload_services(False); + reload_services(True); msrpcd_process(ClientMSRPC, &static_pipe); } if (ClientMSRPC != -1) diff --git a/source3/msrpc/msrpcd_process.c b/source3/msrpc/msrpcd_process.c index 240087be14..35a28d105a 100644 --- a/source3/msrpc/msrpcd_process.c +++ b/source3/msrpc/msrpcd_process.c @@ -355,6 +355,7 @@ BOOL msrpcd_init(int c, pipes_struct *p) { struct user_creds usr; gid_t *groups = NULL; + char *user; if (!get_user_creds(c, &usr)) { @@ -405,6 +406,19 @@ BOOL msrpcd_init(int c, pipes_struct *p) ZERO_STRUCTP(p->l); + user = usr.uxc.user_name; + if (!strequal(user,lp_guestaccount(-1)) && + lp_servicenumber(user) < 0) + { + int homes = lp_servicenumber(HOMES_NAME); + char *home = get_unixhome_dir(user); + if (homes >= 0 && home) + { + pstring home_dir; + fstrcpy(home_dir, home); + lp_add_home(user,homes,home_dir); + } + } return True; } diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index b7aef21013..82755d05a3 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2559,7 +2559,7 @@ static void lp_add_auto_services(char *str) homes = lp_servicenumber(HOMES_NAME); for (p=strtok(s,LIST_SEP);p;p=strtok(NULL,LIST_SEP)) { - char *home = get_home_dir(p); + char *home = get_unixhome_dir(p); if (lp_servicenumber(p) >= 0) continue; diff --git a/source3/smbd/password.c b/source3/smbd/password.c index fa46a74c14..e15e08a1af 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -470,7 +470,7 @@ BOOL check_hosts_equiv(char *user) if (lp_use_rhosts()) { - char *home = get_home_dir(user); + char *home = get_unixhome_dir(user); if (home) { extern int Client; slprintf(rhostsfile, sizeof(rhostsfile)-1, "%s/.rhosts", home); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 10146c1287..fed82b5e54 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -765,7 +765,7 @@ user %s attempted down-level SMB connection\n", user)); lp_servicenumber(user) < 0) { int homes = lp_servicenumber(HOMES_NAME); - char *home = get_home_dir(user); + char *home = get_unixhome_dir(user); if (homes >= 0 && home) { pstring home_dir; diff --git a/source3/smbd/service.c b/source3/smbd/service.c index f0af82fb4e..64abf3de1d 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -91,7 +91,7 @@ int find_service(char *service) /* now handle the special case of a home directory */ if (iService < 0) { - char *phome_dir = get_home_dir(service); + char *phome_dir = get_unixhome_dir(service); pstring home_dir; if(phome_dir == NULL) @@ -101,7 +101,7 @@ int find_service(char *service) * be a Windows to unix mapped user name. */ if(map_username(service)) - phome_dir = get_home_dir(service); + phome_dir = get_unixhome_dir(service); } DEBUG(3,("checking for home directory %s gave %s\n",service, -- cgit