From 758bbfb5f133c3c85e3092ad88294ae4abbbbc6f Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Sat, 31 Jan 2004 18:27:35 +0000 Subject: [PATCH] * 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. --- source/param/loadparm.c | 110 +++--------------------------------------------- source/smbd/reply.c | 15 ++----- 2 files changed, 10 insertions(+), 115 deletions(-) diff --git a/source/param/loadparm.c b/source/param/loadparm.c index 1fa3efabf8e..e0c6f821a10 100644 --- a/source/param/loadparm.c +++ b/source/param/loadparm.c @@ -2399,8 +2399,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); } @@ -2753,99 +2751,6 @@ static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr) } /*************************************************************************** - 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. ***************************************************************************/ @@ -3725,15 +3630,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? ***************************************************************************/ @@ -4102,6 +3998,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; diff --git a/source/smbd/reply.c b/source/smbd/reply.c index 37525074930..c4ff77bd866 100644 --- a/source/smbd/reply.c +++ b/source/smbd/reply.c @@ -3013,19 +3013,12 @@ NTSTATUS mkdir_internal(connection_struct *conn, pstring directory) ret = vfs_MkDir(conn,directory,unix_mode(conn,aDIR,directory)); if (ret == -1) { - NTSTATUS nterr = NT_STATUS_OK; if(errno == ENOENT) { - unix_ERR_class = ERRDOS; - if (bad_path) { - unix_ERR_code = ERRbadpath; - nterr = NT_STATUS_OBJECT_PATH_NOT_FOUND; - } else { - unix_ERR_code = ERRbadfile; - nterr = NT_STATUS_OBJECT_NAME_NOT_FOUND; - } + if (bad_path) + return NT_STATUS_OBJECT_PATH_NOT_FOUND; + else + return NT_STATUS_OBJECT_NAME_NOT_FOUND; } - if (!NT_STATUS_IS_OK(nterr)) - return nterr; return map_nt_error_from_unix(errno); } -- 2.11.4.GIT