mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
* 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 commit is contained in:
parent
11093ecfb7
commit
87343fc15a
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user