From 575bc995c0d6d1381c02deebc1c45c0fd644f1c2 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 31 Jan 2004 18:25:57 +0000 Subject: * BUG 101: patch from j.lu@tiesse.com to set the SV_TYPE_PRINTQ_SERVER; * don't set the unix_ERR_XX code in mkdir_internal, let the error mapping handle it. (This used to be commit 87343fc15a385153c2205bd8bfe876504d38d9a1) --- source3/param/loadparm.c | 110 +++-------------------------------------------- 1 file changed, 6 insertions(+), 104 deletions(-) (limited to 'source3/param') diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 344002e653..29845a51e0 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -2386,8 +2386,6 @@ BOOL lp_add_printer(const char *pszPrintername, int iDefaultService) DEBUG(3, ("adding printer service %s\n", pszPrintername)); - update_server_announce_as_printserver(); - return (True); } @@ -2739,99 +2737,6 @@ static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr) return set_netbios_aliases((const char **)Globals.szNetbiosAliases); } -/*************************************************************************** - Do the work of sourcing in environment variable/value pairs. -***************************************************************************/ - -static BOOL source_env(char **lines) -{ - char *varval; - size_t len; - int i; - char *p; - - for (i = 0; lines[i]; i++) { - char *line = lines[i]; - - if ((len = strlen(line)) == 0) - continue; - - if (line[len - 1] == '\n') - line[--len] = '\0'; - - if ((varval = malloc(len + 1)) == NULL) { - DEBUG(0, ("source_env: Not enough memory!\n")); - return (False); - } - - DEBUG(4, ("source_env: Adding to environment: %s\n", line)); - strncpy(varval, line, len); - varval[len] = '\0'; - - p = strchr_m(line, (int)'='); - if (p == NULL) { - DEBUG(4, ("source_env: missing '=': %s\n", line)); - continue; - } - - if (putenv(varval)) { - DEBUG(0, ("source_env: Failed to put environment variable %s\n", - varval)); - continue; - } - - *p = '\0'; - p++; - DEBUG(4, ("source_env: getting var %s = %s\n", line, getenv(line))); - } - - DEBUG(4, ("source_env: returning successfully\n")); - return (True); -} - -#if 0 -/* Doesn't seem to be used anymore. JRA */ -/*************************************************************************** - Handle the source environment operation. -***************************************************************************/ - -static BOOL handle_source_env(const char *pszParmValue, char **ptr) -{ - pstring fname; - char *p = fname; - BOOL result; - char **lines; - - pstrcpy(fname, pszParmValue); - - standard_sub_basic(current_user_info.smb_name, fname,sizeof(fname)); - - string_set(ptr, pszParmValue); - - DEBUG(4, ("handle_source_env: checking env type\n")); - - /* - * Filename starting with '|' means popen and read from stdin. - */ - - if (*p == '|') - lines = file_lines_pload(p + 1, NULL); - else - lines = file_lines_load(fname, NULL); - - if (!lines) { - DEBUG(0, ("handle_source_env: Failed to open file %s, Error was %s\n", - fname, strerror(errno))); - return (False); - } - - result = source_env(lines); - file_lines_free(lines); - - return (result); -} -#endif - /*************************************************************************** Handle the include operation. ***************************************************************************/ @@ -3711,15 +3616,6 @@ void lp_add_one_printer(char *name, char *comment) } } -/*************************************************************************** - Announce ourselves as a print server. -***************************************************************************/ - -void update_server_announce_as_printserver(void) -{ - default_server_announce |= SV_TYPE_PRINTQ_SERVER; -} - /*************************************************************************** Have we loaded a services file yet? ***************************************************************************/ @@ -4084,6 +3980,12 @@ static void set_default_server_announce_type(void) default_server_announce |= SV_TYPE_SERVER; default_server_announce |= SV_TYPE_SERVER_UNIX; + /* note that the flag should be set only if we have a + printer service but nmbd doesn't actually load the + services so we can't tell --jerry */ + + default_server_announce |= SV_TYPE_PRINTQ_SERVER; + switch (lp_announce_as()) { case ANNOUNCE_AS_NT_SERVER: default_server_announce |= SV_TYPE_SERVER_NT; -- cgit