From 292a0265a9de7f5fa06140768ecf27056d59f6c1 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 5 Nov 2001 05:28:03 +0000 Subject: old merge from 2.2 --- source/param/loadparm.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/source/param/loadparm.c b/source/param/loadparm.c index f9355ed14f0..cf5f31953d0 100644 --- a/source/param/loadparm.c +++ b/source/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); } -- cgit