From ac08646c374cd70e47301bce3e031b35cb220347 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 15 Jun 2002 12:38:13 +0000 Subject: Rework much of the service.c code: The aim of this execise is to give the 'security>=user' code a straight paper path. Security=share will sill call authorise_login(), but otherwise we avoid that mess. This allow *much* more accurate error code reporting, beocuse we don't start pretending that we can use the (nonexistant) password etc. Also in this patch is code to create the 'homes' share at session setup time (as we have done in the past - been broken recently) and to record this on the user's vuser struct for later reference. The changes here should also allow for much better use of %H (some more changes to come here). The service.c changes move a lot of code around, but are not as drastric as they look... (Also included is a fix to srv_srvsvc_nt.c where 'total_entries' not '*total_entries' was compared). This code is needs testing, but passes my basic tests. I expect we have lost some functionality, but the stuff I had expected to loose was already broken before I started. In particular, we don't 'fall back' to guest if the user cannot access a share (for security=user). If you want this kind of stuff then you really want security=share anyway. Andrew Bartlett (This used to be commit 4c0cbcaed95231f8cf11edb43f6adbec9a0d0b5c) --- source3/param/loadparm.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'source3/param') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index e9ded3fb4a..3c0820491d 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1879,9 +1879,12 @@ static int add_a_service(const service * pservice, const char *name) add a new home service, with the specified home directory, defaults coming from service ifrom. ***************************************************************************/ -BOOL lp_add_home(const char *pszHomename, int iDefaultService, const char *pszHomedir) +BOOL lp_add_home(const char *pszHomename, int iDefaultService, + const char *user, const char *pszHomedir) { int i; + pstring newHomedir; + SMB_STRUCT_STAT buf; /* if the user's home directory doesn't exist, then don't @@ -1895,8 +1898,16 @@ BOOL lp_add_home(const char *pszHomename, int iDefaultService, const char *pszHo return (False); if (!(*(ServicePtrs[i]->szPath)) - || strequal(ServicePtrs[i]->szPath, lp_pathname(-1))) - string_set(&ServicePtrs[i]->szPath, pszHomedir); + || strequal(ServicePtrs[i]->szPath, lp_pathname(-1))) { + pstrcpy(newHomedir, pszHomedir); + } else { + pstrcpy(newHomedir, lp_pathname(iDefaultService)); + standard_sub_home(iDefaultService, pszHomename, user, + pszHomedir, newHomedir); + } + + string_set(&ServicePtrs[i]->szPath, newHomedir); + if (!(*(ServicePtrs[i]->comment))) { pstring comment; @@ -1908,7 +1919,8 @@ BOOL lp_add_home(const char *pszHomename, int iDefaultService, const char *pszHo ServicePtrs[i]->bBrowseable = sDefault.bBrowseable; DEBUG(3, - ("adding home directory %s at %s\n", pszHomename, pszHomedir)); + ("adding home's share [%s] for user %s at %s\n", pszHomename, + user, newHomedir)); return (True); } @@ -3329,13 +3341,13 @@ 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_user_service_home_dir(p); + char *home = get_user_home_dir(p); if (lp_servicenumber(p) >= 0) continue; if (home && homes >= 0) - lp_add_home(p, homes, home); + lp_add_home(p, homes, p, home); } SAFE_FREE(s); } -- cgit