1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

Merge of Andrew's changes in 2.2.

Jeremy.
This commit is contained in:
Jeremy Allison 0001-01-01 00:00:00 +00:00
parent 4f06373bc4
commit fc76681812
26 changed files with 1202 additions and 846 deletions

View File

@ -14,6 +14,9 @@ CPPFLAGS=@CPPFLAGS@
LDFLAGS=@LDFLAGS@
AWK=@AWK@
TERMLDFLAGS=@TERMLDFLAGS@
TERMLIBS=@TERMLIBS@
LIBTOOL=@LIBTOOL@ --quiet
LIBTOOL_DEPS=@LIBTOOL_DEPS@
LINK=$(LIBTOOL) --mode=link $(CC) $(FLAGS) $(LDFLAGS)
@ -108,8 +111,9 @@ LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \
lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \
lib/talloc.o lib/hash.o lib/substitute.o lib/fsusage.o \
lib/ms_fnmatch.o lib/select.o lib/error.o lib/messages.o \
nsswitch/wb_client.o nsswitch/wb_common.o lib/readline.o \
$(TDB_OBJ)
nsswitch/wb_client.o nsswitch/wb_common.o $(TDB_OBJ)
READLINE_OBJ = lib/readline.o
UBIQX_OBJ = ubiqx/ubi_BinTree.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
ubiqx/ubi_dLinkList.o ubiqx/ubi_sLinkList.o ubiqx/debugparse.o
@ -268,7 +272,8 @@ RPCCLIENT_OBJ1 = rpcclient/rpcclient.o rpcclient/cmd_lsarpc.o \
RPCCLIENT_OBJ = $(RPCCLIENT_OBJ1) \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ)
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(LIBMSRPC_OBJ) \
$(READLINE_OBJ)
PAM_WINBIND_OBJ = nsswitch/pam_winbind.po nsswitch/wb_common.po
@ -284,7 +289,8 @@ SMBWRAPPER_OBJ = $(SMBW_OBJ) smbwrapper/wrapped.o
LIBSMBCLIENT_OBJ = libsmb/libsmbclient.o $(LIB_OBJ) $(LIBSMB_OBJ) $(PARAM_OBJ) $(UBIQX_OBJ)
CLIENT_OBJ = client/client.o client/clitar.o \
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
$(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ) \
$(READLINE_OBJ)
CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(UBIQX_OBJ) $(LIB_OBJ)
@ -473,11 +479,11 @@ bin/smbrun: $(SMBRUN_OBJ) bin/.dummy
bin/rpcclient: $(RPCCLIENT_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(LIBS)
@$(CC) $(FLAGS) -o $@ $(RPCCLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
bin/smbclient: $(CLIENT_OBJ) bin/.dummy
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(LIBS)
@$(CC) $(FLAGS) -o $@ $(CLIENT_OBJ) $(LDFLAGS) $(TERMLDFLAGS) $(TERMLIBS) $(LIBS)
bin/smbspool: $(CUPS_OBJ) bin/.dummy
@echo Linking $@

1755
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -250,8 +250,8 @@ case "$host_os" in
esac
AC_CHECK_HEADERS(shadow.h netinet/ip.h netinet/tcp.h netinet/in_systm.h netinet/in_ip.h)
AC_CHECK_HEADERS(nss.h sys/security.h security/pam_appl.h)
AC_CHECK_HEADERS(stropts.h poll.h readline.h history.h readline/readline.h)
AC_CHECK_HEADERS(readline/history.h sys/capability.h syscall.h sys/syscall.h)
AC_CHECK_HEADERS(stropts.h poll.h)
AC_CHECK_HEADERS(sys/capability.h syscall.h sys/syscall.h)
AC_CHECK_HEADERS(sys/acl.h sys/cdefs.h glob.h acl/acl.h)
# For experimental utmp support (lastlog on some BSD-like systems)
@ -359,14 +359,67 @@ fi
###############################################
# test for where we get readline() from
if test "$ac_cv_header_readline_h" = "yes" ||
test "$ac_cv_header_readline_readline_h" = "yes"; then
# we need to also pull in termcap for some systems to use readline
AC_CHECK_LIB(termcap,tgetent)
AC_CHECK_LIB(readline,rl_callback_handler_install)
fi
# Readline included by default unless explicitly asked not to
test "${with_readline+set}" != "set" && with_readline=yes
# test for where we get readline() from
AC_MSG_CHECKING(whether to use readline)
AC_ARG_WITH(readline,
[ --with-readline[=DIR] Look for readline include/libs in DIR
--without-readline Don't include readline support],
[ case "$with_readline" in
yes)
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
AC_CHECK_HEADERS(readline/history.h)
AC_CHECK_HEADERS(readline.h readline/readline.h,[
for termlib in ncurses curses termcap terminfo termlib; do
AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
done
AC_CHECK_LIB(readline, rl_callback_handler_install,
[TERMLIBS="-lreadline $TERMLIBS"
AC_DEFINE(HAVE_LIBREADLINE)
break], [TERMLIBS=], $TERMLIBS)])
;;
no)
AC_MSG_RESULT(no)
;;
*)
AC_MSG_RESULT(yes)
# Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
# alternate readline path
_ldflags=${LDFLAGS}
_cppflags=${CPPFLAGS}
# Add additional search path
LDFLAGS="-L$with_readline/lib $LDFLAGS"
CPPFLAGS="-I$with_readline/include $CPPFLAGS"
AC_CHECK_HEADERS(readline.h history.h readline/readline.h)
AC_CHECK_HEADERS(readline/history.h)
AC_CHECK_HEADERS(readline.h readline/readline.h,[
for termlib in ncurses curses termcap terminfo termlib; do
AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
done
AC_CHECK_LIB(readline, rl_callback_handler_install,
[TERMLDFLAGS="-L$with_readline/lib"
TERMCPPFLAGS="-I$with_readline/include"
CPPFLAGS="-I$with_readline/include $CPPFLAGS"
TERMLIBS="-lreadline $TERMLIBS"
AC_DEFINE(HAVE_LIBREADLINE)
break], [TERMLIBS= CPPFLAGS=$_cppflags], $TERMLIBS)])
LDFLAGS=$_ldflags
;;
esac],
AC_MSG_RESULT(no)
)
AC_SUBST(TERMLIBS)
AC_SUBST(TERMLDFLAGS)
# The following test taken from the cvs sources
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
@ -1968,7 +2021,10 @@ __COMPILE_ERROR_
[int i],
samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=yes,samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT=no)
if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EXPLICIT_LARGEFILE_SUPPORT)
else
AC_MSG_RESULT(no)
fi
AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])

View File

@ -692,7 +692,7 @@ int smb_create_group(char *unix_group)
pstrcpy(add_script, lp_addgroup_script());
if (! *add_script) return -1;
pstring_sub(add_script, "%g", unix_group);
ret = smbrun(add_script,NULL,False);
ret = smbrun(add_script,NULL);
DEBUG(3,("smb_create_group: Running the command `%s' gave %d\n",add_script,ret));
return ret;
}
@ -709,7 +709,7 @@ int smb_delete_group(char *unix_group)
pstrcpy(del_script, lp_delgroup_script());
if (! *del_script) return -1;
pstring_sub(del_script, "%g", unix_group);
ret = smbrun(del_script,NULL,False);
ret = smbrun(del_script,NULL);
DEBUG(3,("smb_delete_group: Running the command `%s' gave %d\n",del_script,ret));
return ret;
}
@ -727,7 +727,7 @@ int smb_add_user_group(char *unix_group, char *unix_user)
if (! *add_script) return -1;
pstring_sub(add_script, "%g", unix_group);
pstring_sub(add_script, "%u", unix_user);
ret = smbrun(add_script,NULL,False);
ret = smbrun(add_script,NULL);
DEBUG(3,("smb_add_user_group: Running the command `%s' gave %d\n",add_script,ret));
return ret;
}
@ -745,7 +745,7 @@ int smb_delete_user_group(char *unix_group, char *unix_user)
if (! *del_script) return -1;
pstring_sub(del_script, "%g", unix_group);
pstring_sub(del_script, "%u", unix_user);
ret = smbrun(del_script,NULL,False);
ret = smbrun(del_script,NULL);
DEBUG(3,("smb_delete_user_group: Running the command `%s' gave %d\n",del_script,ret));
return ret;
}

View File

@ -955,9 +955,6 @@
/* Define if you have the nsl_s library (-lnsl_s). */
#undef HAVE_LIBNSL_S
/* Define if you have the readline library (-lreadline). */
#undef HAVE_LIBREADLINE
/* Define if you have the resolv library (-lresolv). */
#undef HAVE_LIBRESOLV
@ -969,6 +966,3 @@
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the termcap library (-ltermcap). */
#undef HAVE_LIBTERMCAP

View File

@ -219,7 +219,7 @@ int vslprintf(char *str, int n, char *format, va_list ap);
/*The following definitions come from lib/smbrun.c */
int smbrun(char *cmd, int *outfd, char *template);
int smbrun(char *cmd, int *outfd);
/*The following definitions come from lib/snprintf.c */
@ -1191,6 +1191,7 @@ int share_mode_forall(SHAREMODE_FN(fn));
/*The following definitions come from locking/posix.c */
int fd_close_posix(struct connection_struct *conn, files_struct *fsp);
uint32 map_lock_offset(uint32 high, uint32 low);
BOOL is_posix_locked(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count, enum brl_type lock_type);
BOOL set_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count, enum brl_type lock_type);
BOOL release_posix_lock(files_struct *fsp, SMB_BIG_UINT u_offset, SMB_BIG_UINT u_count);
@ -1587,7 +1588,6 @@ enum nss_status winbindd_request(int req_type,
void lp_talloc_free(void);
char *lp_logfile(void);
char *lp_smbrun(void);
char *lp_configfile(void);
char *lp_smb_passwd_file(void);
char *lp_private_dir(void);
@ -1886,6 +1886,7 @@ BOOL pdb_generate_sam_sid(void);
/*The following definitions come from passdb/pampass.c */
BOOL pam_session(BOOL flag, const connection_struct *conn, char *tty);
BOOL pam_accountcheck(char * user);
BOOL pam_passcheck(char * user, char * password);
/*The following definitions come from passdb/pass_check.c */

View File

@ -249,5 +249,5 @@ char *generate_random_str(size_t len)
retstr[i] = '\0';
return retstr;
return (char *)retstr;
}

View File

@ -30,14 +30,12 @@ extern int DEBUGLEVEL;
This is a utility function of smbrun().
****************************************************************************/
static BOOL setup_out_fd(char *template)
static int setup_out_fd(void)
{
int fd;
pstring path;
pstrcpy( path, template);
pstrcat( path, generate_random_str(17));
pstrcat( path, ".XXXXXX");
slprintf(path, sizeof(path)-1, "%s/smb.XXXXXX", tmpdir());
/* now create the file */
fd = smb_mkstemp(path);
@ -60,7 +58,7 @@ run a command being careful about uid/gid handling and putting the output in
outfd (or discard it if outfd is NULL).
****************************************************************************/
int smbrun(char *cmd, int *outfd, char *template)
int smbrun(char *cmd, int *outfd)
{
pid_t pid;
uid_t uid = current_user.uid;
@ -73,7 +71,7 @@ int smbrun(char *cmd, int *outfd, char *template)
/* point our stdout at the file we want output to go into */
if (outfd && ((*outfd = setup_out_fd(template)) == -1)) {
if (outfd && ((*outfd = setup_out_fd()) == -1)) {
return -1;
}

View File

@ -749,7 +749,7 @@ struct packet_struct *read_packet(int fd,enum packet_type packet_type)
******************************************************************/
static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
{
BOOL ret;
BOOL ret = False;
int i;
struct sockaddr_in sock_out;

View File

@ -632,12 +632,11 @@ static BOOL posix_lock_in_range(SMB_OFF_T *offset_out, SMB_OFF_T *count_out,
return True;
}
#if defined(LARGE_SMB_OFF_T)
/****************************************************************************
Pathetically try and map a 64 bit lock offset into 31 bits. I hate Windows :-).
****************************************************************************/
static uint32 map_lock_offset(uint32 high, uint32 low)
uint32 map_lock_offset(uint32 high, uint32 low)
{
unsigned int i;
uint32 mask = 0;
@ -664,7 +663,6 @@ static uint32 map_lock_offset(uint32 high, uint32 low)
return (high|low);
}
#endif
/****************************************************************************
Actual function that does POSIX locks. Copes with 64 -> 32 bit cruft and

View File

@ -62,7 +62,7 @@ static void wins_hook(char *operation, struct name_record *namerec, int ttl)
}
DEBUG(3,("calling wins hook for %s\n", nmb_namestr(&namerec->name)));
smbrun(command, NULL, NULL);
smbrun(command, NULL);
}

View File

@ -87,7 +87,7 @@ NSS_STATUS_UNAVAIL
#ifndef _PSTRING
#define _PSTRING
#define PSTRING_LEN 1024
#define FSTRING_LEN 128
#define FSTRING_LEN 256
typedef char pstring[PSTRING_LEN];
typedef char fstring[FSTRING_LEN];
#endif
@ -127,5 +127,13 @@ typedef int BOOL;
/* zero a structure given a pointer to the structure */
#define ZERO_STRUCTP(x) { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); }
/* Some systems (SCO) treat UNIX domain sockets as FIFOs */
#ifndef S_IFSOCK
#define S_IFSOCK S_IFIFO
#endif
#ifndef S_ISSOCK
#define S_ISSOCK(mode) ((mode & S_IFSOCK) == S_IFSOCK)
#endif
#endif

View File

@ -966,7 +966,6 @@ static struct parm_struct parm_table[] = {
{"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, 0},
{"change share command", P_STRING, P_GLOBAL, &Globals.szChangeShareCommand, NULL, NULL, 0},
{"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, 0},
{"smbrun", P_STRING, P_GLOBAL, &Globals.szSmbrun, NULL, NULL, 0},
{"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE},
{"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_DOS_STRING},
@ -1433,7 +1432,6 @@ static char *lp_string(const char *s)
int fn_name(int i) {return(LP_SNUM_OK(i)? pSERVICE(i)->val : sDefault.val);}
FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
FN_GLOBAL_STRING(lp_smbrun, &Globals.szSmbrun)
FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)

View File

@ -54,33 +54,14 @@ run a given print command
a null terminated list of value/substitute pairs is provided
for local substitution strings
****************************************************************************/
#ifdef HAVE_STDARG_H
static int print_run_command(int snum,char *command, int *outfd, char *outfile, ...)
static int print_run_command(int snum,char *command, int *outfd, ...)
{
#else /* HAVE_STDARG_H */
static int print_run_command(va_alist)
va_dcl
{
int snum;
int *outfd;
char *command, *outfile;
#endif /* HAVE_STDARG_H */
pstring syscmd;
char *p, *arg;
int ret;
va_list ap;
#ifdef HAVE_STDARG_H
va_start(ap, outfile);
#else /* HAVE_STDARG_H */
va_start(ap);
snum = va_arg(ap,int);
fd = va_arg(ap, int *);
command = va_arg(ap,char *);
outfile = va_arg(ap,char *);
#endif /* HAVE_STDARG_H */
va_start(ap, outfd);
if (!command || !*command) return -1;
@ -104,7 +85,7 @@ va_dcl
/* Convert script args to unix-codepage */
dos_to_unix(syscmd, True);
ret = smbrun(syscmd,outfd,outfile);
ret = smbrun(syscmd,outfd);
DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
@ -214,7 +195,7 @@ static int generic_queue_get(int snum, print_queue_struct **q, print_status_stru
int fd;
pstring tmp_file;
int numlines, i, qcount;
print_queue_struct *queue;
print_queue_struct *queue = NULL;
fstring printer_name;
/* Convert printer name (i.e. share name) to unix-codepage */

View File

@ -2400,7 +2400,7 @@ BOOL smb_io_job_info_1(char *desc, NEW_BUFFER *buffer, JOB_INFO_1 *info, int dep
BOOL smb_io_job_info_2(char *desc, NEW_BUFFER *buffer, JOB_INFO_2 *info, int depth)
{
uint pipo=0;
uint32 pipo=0;
prs_struct *ps=&buffer->prs;
prs_debug(ps, depth, desc, "smb_io_job_info_2");

View File

@ -117,7 +117,7 @@ uint32 _reg_open_entry(pipes_struct *p, REG_Q_OPEN_ENTRY *q_u, REG_R_OPEN_ENTRY
uint32 _reg_info(pipes_struct *p, REG_Q_INFO *q_u, REG_R_INFO *r_u)
{
uint32 status = NT_STATUS_NOPROBLEMO;
char *key;
char *key = NULL;
uint32 type=0x1; /* key type: REG_SZ */
UNISTR2 *uni_key = NULL;

View File

@ -296,7 +296,7 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
dos_to_unix(command, True); /* Convert printername to unix-codepage */
DEBUG(10,("Running [%s]\n", command));
ret = smbrun(command, NULL, NULL);
ret = smbrun(command, NULL);
if (ret != 0) {
return ERROR_INVALID_HANDLE; /* What to return here? */
}
@ -4123,7 +4123,6 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer)
char *cmd = lp_addprinter_cmd();
char *path;
char **qlines;
pstring tmp_file;
pstring command;
pstring driverlocation;
int numlines;
@ -4141,16 +4140,15 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer)
/* change \ to \\ for the shell */
all_string_sub(driverlocation,"\\","\\\\",sizeof(pstring));
slprintf(tmp_file, sizeof(tmp_file)-1, "%s/smbcmd.%d.", path, sys_getpid());
slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",
cmd, printer->info_2->printername, printer->info_2->sharename,
printer->info_2->portname, printer->info_2->drivername,
printer->info_2->location, driverlocation);
/* Convert script args to unix-codepage */
dos_to_unix(command, True);
DEBUG(10,("Running [%s > %s]\n", command,tmp_file));
ret = smbrun(command, &fd, tmp_file);
/* Convert script args to unix-codepage */
dos_to_unix(command, True);
DEBUG(10,("Running [%s]\n", command));
ret = smbrun(command, &fd);
DEBUGADD(10,("returned [%d]\n", ret));
if ( ret != 0 ) {
@ -4160,7 +4158,7 @@ static BOOL add_printer_hook(NT_PRINTER_INFO_LEVEL *printer)
}
numlines = 0;
/* Get lines and convert them back to dos-codepage */
/* Get lines and convert them back to dos-codepage */
qlines = fd_lines_load(fd, &numlines, True);
DEBUGADD(10,("Lines returned = [%d]\n", numlines));
close(fd);
@ -5307,7 +5305,7 @@ uint32 _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *
FORM_1 form_1;
fstring form_name;
int buffer_size=0;
int numofforms, i;
int numofforms=0, i;
/* that's an [in out] buffer */
spoolss_move_buffer(q_u->buffer, &r_u->buffer);
@ -5406,7 +5404,6 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
char *cmd = lp_enumports_cmd();
char *path;
char **qlines;
pstring tmp_file;
pstring command;
int numlines;
int ret;
@ -5417,11 +5414,10 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
else
path = lp_lockdir();
slprintf(tmp_file, sizeof(tmp_file)-1, "%s/smbcmd.%d.", path, sys_getpid());
slprintf(command, sizeof(command)-1, "%s \"%d\"", cmd, 1);
DEBUG(10,("Running [%s > %s]\n", command,tmp_file));
ret = smbrun(command, &fd, tmp_file);
DEBUG(10,("Running [%s]\n", command));
ret = smbrun(command, &fd);
DEBUG(10,("Returned [%d]\n", ret));
if (ret != 0) {
if (fd != -1)
@ -5519,7 +5515,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
unlink(tmp_file);
DEBUG(10,("Running [%s > %s]\n", command,tmp_file));
ret = smbrun(command, &fd, tmp_file);
ret = smbrun(command, &fd);
DEBUGADD(10,("returned [%d]\n", ret));
if (ret != 0) {
if (fd != -1)
@ -6045,7 +6041,7 @@ uint32 _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
ZERO_STRUCT(old_param);
if (get_specific_param(*printer, 2, param->value, &old_param.data,
&old_param.type, (unsigned int *)&old_param.data_len)) {
&old_param.type, (uint32 *)&old_param.data_len)) {
if (param->type == old_param.type &&
param->data_len == old_param.data_len &&

View File

@ -50,7 +50,7 @@ static void init_srv_share_info_1(SRV_SHARE_INFO_1 *sh1, int snum)
if (lp_print_ok(snum))
type = STYPE_PRINTQ;
if (strequal("IPC", lp_fstype(snum)))
if (strequal("IPC$", net_name) || strequal("ADMIN$", net_name))
type = STYPE_IPC;
if (net_name[len_net_name] == '$')
type |= STYPE_HIDDEN;
@ -85,7 +85,7 @@ static void init_srv_share_info_2(SRV_SHARE_INFO_2 *sh2, int snum)
if (lp_print_ok(snum))
type = STYPE_PRINTQ;
if (strequal("IPC", lp_fstype(snum)))
if (strequal("IPC$", net_name) || strequal("ADMIN$", net_name))
type = STYPE_IPC;
if (net_name[len_net_name] == '$')
type |= STYPE_HIDDEN;
@ -1303,7 +1303,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
dos_to_unix(command, True); /* Convert to unix-codepage */
DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL, NULL)) != 0) {
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command, ret ));
return ERROR_ACCESS_DENIED;
}
@ -1420,7 +1420,7 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
dos_to_unix(command, True); /* Convert to unix-codepage */
DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL, NULL)) != 0) {
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_add: Running [%s] returned (%d)\n", command, ret ));
return ERROR_ACCESS_DENIED;
}
@ -1487,7 +1487,7 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S
dos_to_unix(command, True); /* Convert to unix-codepage */
DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
if ((ret = smbrun(command, NULL, NULL)) != 0) {
if ((ret = smbrun(command, NULL)) != 0) {
DEBUG(0,("_srv_net_share_del: Running [%s] returned (%d)\n", command, ret ));
return ERROR_ACCESS_DENIED;
}

View File

@ -58,7 +58,7 @@ static void check_magic(files_struct *fsp,connection_struct *conn)
slprintf(magic_output,sizeof(fname)-1, "%s.out",fname);
chmod(fname,0755);
ret = smbrun(fname,&tmp_fd,magic_output);
ret = smbrun(fname,&tmp_fd);
DEBUG(3,("Invoking magic command %s gave %d\n",fname,ret));
unlink(fname);
if (ret != 0 || tmp_fd == -1) {

View File

@ -91,7 +91,7 @@ static void msg_deliver(void)
pstring_sub(s,"%t",alpha_strcpy(alpha_msgto,msgto,sizeof(alpha_msgto)));
standard_sub_basic(s);
pstring_sub(s,"%s",name);
smbrun(s,NULL,NULL);
smbrun(s,NULL);
}
msgpos = 0;

View File

@ -493,7 +493,7 @@ int smb_create_user(char *unix_user, char *homedir)
all_string_sub(add_script, "%u", unix_user, sizeof(pstring));
if (homedir)
all_string_sub(add_script, "%H", homedir, sizeof(pstring));
ret = smbrun(add_script,NULL,NULL);
ret = smbrun(add_script,NULL);
DEBUG(3,("smb_create_user: Running the command `%s' gave %d\n",add_script,ret));
return ret;
}
@ -510,7 +510,7 @@ static int smb_delete_user(char *unix_user)
pstrcpy(del_script, lp_deluser_script());
if (! *del_script) return -1;
all_string_sub(del_script, "%u", unix_user, sizeof(pstring));
ret = smbrun(del_script,NULL,NULL);
ret = smbrun(del_script,NULL);
DEBUG(3,("smb_delete_user: Running the command `%s' gave %d\n",del_script,ret));
return ret;
}

View File

@ -559,7 +559,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
pstrcpy(cmd,lp_rootpreexec(SNUM(conn)));
standard_sub_conn(conn,cmd);
DEBUG(5,("cmd=%s\n",cmd));
ret = smbrun(cmd,NULL,NULL);
ret = smbrun(cmd,NULL);
if (ret != 0 && lp_rootpreexec_close(SNUM(conn))) {
DEBUG(1,("preexec gave %d - failing connection\n", ret));
conn_free(conn);
@ -611,7 +611,7 @@ connection_struct *make_connection(char *service,char *user,char *password, int
pstring cmd;
pstrcpy(cmd,lp_preexec(SNUM(conn)));
standard_sub_conn(conn,cmd);
ret = smbrun(cmd,NULL,NULL);
ret = smbrun(cmd,NULL);
if (ret != 0 && lp_preexec_close(SNUM(conn))) {
DEBUG(1,("preexec gave %d - failing connection\n", ret));
conn_free(conn);
@ -688,7 +688,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
pstring cmd;
pstrcpy(cmd,lp_postexec(SNUM(conn)));
standard_sub_conn(conn,cmd);
smbrun(cmd,NULL,NULL);
smbrun(cmd,NULL);
unbecome_user();
}
@ -698,7 +698,7 @@ void close_cnum(connection_struct *conn, uint16 vuid)
pstring cmd;
pstrcpy(cmd,lp_rootpostexec(SNUM(conn)));
standard_sub_conn(conn,cmd);
smbrun(cmd,NULL,NULL);
smbrun(cmd,NULL);
}
conn_free(conn);
}

View File

@ -52,7 +52,7 @@
#define TDB_PAGE_SIZE 0x2000
#define FREELIST_TOP (sizeof(struct tdb_header))
#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1))
#define TDB_BYTEREV(x) (((x<<24)|(x&0xFF00)<<8)|((x>>8)&0xFF00)|(x>>24))
#define TDB_BYTEREV(x) (((((x)&0xff)<<24)|((x)&0xFF00)<<8)|(((x)>>8)&0xFF00)|((x)>>24))
#define TDB_DEAD(r) ((r)->magic == TDB_DEAD_MAGIC)
#define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r))
#define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off))

View File

@ -120,44 +120,21 @@ TDB_DATA tdb_fetch_by_string(TDB_CONTEXT *tdb, char *keystr)
/* useful pair of routines for packing/unpacking data consisting of
integers and strings */
#ifdef HAVE_STDARG_H
size_t tdb_pack(char *buf, int bufsize, char *fmt, ...)
{
#else /* HAVE_STDARG_H */
size_t tdb_pack(va_alist)
va_dcl
{
char *buf, *fmt;
int bufsize;
#endif /* HAVE_STDARG_H */
va_list ap;
uint16 w;
uint32 d;
int i;
void *p;
int len = 0;
int len;
char *s;
char c;
#ifdef HAVE_STDARG_H
char *buf0 = buf;
char *fmt0 = fmt;
int bufsize0 = bufsize;
va_start(ap, fmt);
#else /* HAVE_STDARG_H */
char *buf0;
char *fmt0;
int bufsize0;
va_start(ap);
buf = va_arg(ap,char *);
bufsize = va_arg(ap,int);
fmt = va_arg(ap,char *);
buf0 = buf;
fmt0 = fmt;
bufsize0 = bufsize;
#endif /* HAVE_STDARG_H */
while (*fmt) {
switch ((c = *fmt++)) {
@ -230,44 +207,21 @@ va_dcl
/* useful pair of routines for packing/unpacking data consisting of
integers and strings */
#ifdef HAVE_STDARG_H
int tdb_unpack(char *buf, int bufsize, char *fmt, ...)
{
#else /* HAVE_STDARG_H */
int tdb_unpack(va_alist)
va_dcl
{
char *buf, *fmt;
int bufsize;
#endif /* HAVE_STDARG_H */
va_list ap;
uint16 *w;
uint32 *d;
int len = 0;
int len;
int *i;
void **p;
char *s, **b;
char c;
#ifdef HAVE_STDARG_H
char *buf0 = buf;
char *fmt0 = fmt;
int bufsize0 = bufsize;
va_start(ap, fmt);
#else /* HAVE_STDARG_H */
char *buf0;
char *fmt0;
int bufsize0;
va_start(ap);
buf = va_arg(ap,char *);
bufsize = va_arg(ap,int);
fmt = va_arg(ap,char *);
buf0 = buf;
fmt0 = fmt;
bufsize0 = bufsize;
#endif /* HAVE_STDARG_H */
while (*fmt) {
switch ((c=*fmt++)) {

View File

@ -74,7 +74,7 @@ BOOL got_policy_hnd;
/* Open cli connection and policy handle */
static BOOL open_policy_hnd(void)
static BOOL cacls_open_policy_hnd(void)
{
creds.pwd.null_pwd = 1;
@ -117,7 +117,7 @@ static void SidToString(fstring str, DOM_SID *sid)
/* Ask LSA to convert the sid to a name */
if (!open_policy_hnd() ||
if (!cacls_open_policy_hnd() ||
cli_lsa_lookup_sids(&lsa_cli, &pol, 1, sid, &names, &types,
&num_names) != NT_STATUS_NOPROBLEMO ||
!names || !names[0]) {
@ -145,7 +145,7 @@ static BOOL StringToSid(DOM_SID *sid, char *str)
return string_to_sid(sid, str);
}
if (!open_policy_hnd() ||
if (!cacls_open_policy_hnd() ||
cli_lsa_lookup_names(&lsa_cli, &pol, 1, &str, &sids, &types,
&num_sids) != NT_STATUS_NOPROBLEMO) {
result = False;
@ -815,9 +815,8 @@ You can string acls together with spaces, commas or newlines\n\
extern FILE *dbf;
int opt;
char *p;
int seed;
static pstring servicesf = CONFIGFILE;
struct cli_state *cli;
struct cli_state *cli=NULL;
enum acl_mode mode;
char *the_acl = NULL;
enum chown_mode change_mode = REQUEST_NONE;
@ -863,8 +862,6 @@ You can string acls together with spaces, commas or newlines\n\
}
}
seed = time(NULL);
while ((opt = getopt(argc, argv, "U:nhS:D:A:M:C:G:t")) != EOF) {
switch (opt) {
case 'U':

View File

@ -97,7 +97,7 @@ Prints out the current Profile level returned by MSG_PROFILELEVEL
void profilelevel_function(int msg_type, pid_t src, void *buf, size_t len)
{
int level;
char *s;
char *s=NULL;
memcpy(&level, buf, sizeof(int));
if (level) {
@ -175,7 +175,7 @@ static BOOL do_command(char *dest, char *msg_name, char *params[])
{
int i, n, v;
int mtype;
BOOL retval;
BOOL retval=False;
int debuglevel_class[DBGC_LAST];
mtype = parse_type(msg_name);