diff options
author | Gerald Carter <jerry@samba.org> | 2001-11-05 05:28:03 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2001-11-05 05:28:03 +0000 |
commit | e9ba1dff09968c4fcbf701e194517356c701d65e (patch) | |
tree | e1cbdec27c63cade1826ff068234782ba5646853 | |
parent | cf1d442f4042eb4e6fe814e9f74c6c2511bed6f7 (diff) | |
download | samba-e9ba1dff09968c4fcbf701e194517356c701d65e.tar.gz samba-e9ba1dff09968c4fcbf701e194517356c701d65e.tar.bz2 samba-e9ba1dff09968c4fcbf701e194517356c701d65e.zip |
old merge from 2.2
(This used to be commit 292a0265a9de7f5fa06140768ecf27056d59f6c1)
-rw-r--r-- | source3/param/loadparm.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index f9355ed14f..cf5f31953d 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1845,7 +1845,15 @@ from service ifrom. ***************************************************************************/ BOOL lp_add_home(const char *pszHomename, int iDefaultService, const char *pszHomedir) { - int i = add_a_service(ServicePtrs[iDefaultService], pszHomename); + int i; + SMB_STRUCT_STAT buf; + + /* if the user's home directory doesn't exist, then don't + add it to the list of available shares */ + if (sys_stat(pszHomedir, &buf)) + return False; + + i = add_a_service(ServicePtrs[iDefaultService], pszHomename); if (i < 0) return (False); @@ -3356,15 +3364,26 @@ does not copy the found service. int lp_servicenumber(const char *pszServiceName) { int iService; - + fstring serviceName; + + for (iService = iNumServices - 1; iService >= 0; iService--) - if (VALID(iService) && ServicePtrs[iService]->szService && - strequal(ServicePtrs[iService]->szService, pszServiceName)) - break; + { + if (VALID(iService) && ServicePtrs[iService]->szService) + { + /* + * The substitution here is used to support %U is + * service names + */ + fstrcpy(serviceName, ServicePtrs[iService]->szService); + standard_sub_basic(serviceName); + if (strequal(serviceName, pszServiceName)) + break; + } + } + if (iService < 0) - DEBUG(7, - ("lp_servicenumber: couldn't find %s\n", - pszServiceName)); + DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName)); return (iService); } |