summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-12-07 12:26:32 -0800
committerJeremy Allison <jra@samba.org>2007-12-07 12:26:32 -0800
commitacf15ae730c95443681404c76b67ccfca0253d8b (patch)
treea5db2ab6e2848548b4dd218daab1bc32f93b9cac
parent590da03ba342ea51561822512322d846bc4faade (diff)
downloadsamba-acf15ae730c95443681404c76b67ccfca0253d8b.tar.gz
samba-acf15ae730c95443681404c76b67ccfca0253d8b.tar.bz2
samba-acf15ae730c95443681404c76b67ccfca0253d8b.zip
Don't build rpctorture anymore - not maintained. Just remove.
Remove all vestiges of pstring (except for smbctool as noted in previous commit). Jeremy (This used to be commit 4c32a22ac50ada3275d2ffba3c1aa08bee7d1549)
-rw-r--r--source3/Makefile.in16
-rw-r--r--source3/lib/afs.c24
-rw-r--r--source3/lib/system.c1
-rw-r--r--source3/lib/util_str.c27
-rw-r--r--source3/libsmb/cliconnect.c10
-rw-r--r--source3/libsmb/libsmbclient.c19
-rw-r--r--source3/nmbd/nmbd.c2
-rw-r--r--source3/param/loadparm.c20
-rw-r--r--source3/smbd/msdfs.c2
-rw-r--r--source3/smbd/server.c6
-rw-r--r--source3/torture/rpctorture.c564
-rw-r--r--source3/winbindd/winbindd.c2
12 files changed, 59 insertions, 634 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 12c795e8ef..891ffc6c74 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -819,16 +819,6 @@ NDRDUMP_OBJ = librpc/tools/ndrdump.o \
$(LIBSAMBA_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) \
$(RPC_PARSE_OBJ1) $(DOSERR_OBJ) $(SECRETS_OBJ)
-RPCTORTURE_OBJ = torture/rpctorture.o \
- rpcclient/display.o \
- rpcclient/cmd_lsarpc.o \
- rpcclient/cmd_wkssvc.o \
- rpcclient/cmd_samr.o \
- rpcclient/cmd_srvsvc.o \
- rpcclient/cmd_netlogon.o \
- $(PARAM_OBJ) $(LIBSMB_OBJ) $(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) \
- $(RPC_CLIENT_OBJ) $(RPC_PARSE_OBJ) $(PASSDB_GET_SET_OBJ) $(SECRETS_OBJ)
-
DEBUG2HTML_OBJ = utils/debug2html.o utils/debugparse.o
SMBFILTER_OBJ = utils/smbfilter.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(SECRETS_OBJ) \
@@ -1003,8 +993,6 @@ smbctool: SHOWFLAGS bin/smbctool@EXEEXT@
locktest2 : SHOWFLAGS bin/locktest2@EXEEXT@
-rpctorture : SHOWFLAGS bin/rpctorture@EXEEXT@
-
debug2html : SHOWFLAGS bin/debug2html@EXEEXT@
smbfilter : SHOWFLAGS bin/smbfilter@EXEEXT@
@@ -1317,10 +1305,6 @@ bin/locktest2@EXEEXT@: $(BINARY_PREREQS) $(LOCKTEST2_OBJ) @BUILD_POPT@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(LOCKTEST2_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
-bin/rpctorture@EXEEXT@: $(BINARY_PREREQS) $(RPCTORTURE_OBJ) @BUILD_POPT@
- @echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(RPCTORTURE_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@
-
bin/ndrdump@EXEEXT@: $(BINARY_PREREQS) $(NDRDUMP_OBJ) @BUILD_POPT@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(NDRDUMP_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS) \
diff --git a/source3/lib/afs.c b/source3/lib/afs.c
index dadd83d513..a815c21907 100644
--- a/source3/lib/afs.c
+++ b/source3/lib/afs.c
@@ -218,19 +218,29 @@ bool afs_login(connection_struct *conn)
bool result;
char *ticket_str = NULL;
const DOM_SID *user_sid;
+ TALLOC_CTX *ctx = talloc_tos();
struct ClearToken ct;
- pstrcpy(afs_username, lp_afs_username_map());
- standard_sub_advanced(SNUM(conn), conn->user,
- conn->connectpath, conn->gid,
- get_current_username(),
- current_user_info.domain,
- afs_username, sizeof(afs_username));
+ afs_username = talloc_strdup(ctx,
+ lp_afs_username_map());
+ if (!afs_username) {
+ return false;
+ }
+
+ afs_username = talloc_sub_advanced(ctx,
+ SNUM(conn), conn->user,
+ conn->connectpath, conn->gid,
+ get_current_username(),
+ current_user_info.domain,
+ afs_username);
+ if (!afs_username) {
+ return false;
+ }
user_sid = &current_user.nt_user_token->user_sids[0];
afs_username = talloc_string_sub(talloc_tos(),
- lp_afs_username_map(),
+ afs_username,
"%s",
sid_string_static(user_sid));
if (!afs_username) {
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 00d1e98b39..86f3a8c4b8 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -2175,7 +2175,6 @@ static ssize_t solaris_list_xattr(int attrdirfd, char *list, size_t size)
break;
} else {
safe_strcpy(list + len, de->d_name, listlen);
- pstrcpy(list + len, de->d_name);
len += listlen;
list[len] = '\0';
++len;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 0bf4ac83b2..2c0d86ec9a 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1515,33 +1515,6 @@ char *talloc_all_string_sub(TALLOC_CTX *ctx,
false, false, false);
}
-#if 0
-/**
- Splits out the front and back at a separator.
-**/
-
-static void split_at_last_component(char *path, char *front, char sep,
- char *back)
-{
- char *p = strrchr_m(path, sep);
-
- if (p != NULL)
- *p = 0;
-
- if (front != NULL)
- pstrcpy(front, path);
-
- if (p != NULL) {
- if (back != NULL)
- pstrcpy(back, p+1);
- *p = '\\';
- } else {
- if (back != NULL)
- back[0] = 0;
- }
-}
-#endif
-
/**
Write an octal as a string.
**/
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 14140811d2..fdf7491d80 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1776,13 +1776,15 @@ NTSTATUS cli_raw_tcon(struct cli_state *cli,
struct cli_state *get_ipc_connect(char *server,
struct sockaddr_storage *server_ss,
- struct user_auth_info *user_info)
+ const struct user_auth_info *user_info)
{
struct cli_state *cli;
NTSTATUS nt_status;
nt_status = cli_full_connection(&cli, NULL, server, server_ss, 0, "IPC$", "IPC",
- user_info->username, lp_workgroup(), user_info->password,
+ user_info->username ? user_info->username : "",
+ lp_workgroup(),
+ user_info->password ? user_info->password : "",
CLI_FULL_CONNECTION_ANONYMOUS_FALLBACK, Undefined, NULL);
if (NT_STATUS_IS_OK(nt_status)) {
@@ -1814,7 +1816,7 @@ struct cli_state *get_ipc_connect(char *server,
struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
struct ip_service *mb_ip,
- struct user_auth_info *user_info,
+ const struct user_auth_info *user_info,
char **pp_workgroup_out)
{
char addr[INET6_ADDRSTRLEN];
@@ -1868,7 +1870,7 @@ struct cli_state *get_ipc_connect_master_ip(TALLOC_CTX *ctx,
*/
struct cli_state *get_ipc_connect_master_ip_bcast(TALLOC_CTX *ctx,
- struct user_auth_info *user_info,
+ const struct user_auth_info *user_info,
char **pp_workgroup_out)
{
struct ip_service *ip_list;
diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c
index b654ea07f0..de2eaa7cfa 100644
--- a/source3/libsmb/libsmbclient.c
+++ b/source3/libsmb/libsmbclient.c
@@ -2794,8 +2794,17 @@ smbc_opendir_ctx(SMBCCTX *context,
? INT_MAX
: context->options.browse_max_lmb_count);
- pstrcpy(u_info.username, user);
- pstrcpy(u_info.password, password);
+ memset(&u_info, '\0', sizeof(u_info));
+ u_info.username = talloc_strdup(frame,user);
+ u_info.password = talloc_strdup(frame,password);
+ if (!u_info.username || !u_info.password) {
+ if (dir) {
+ SAFE_FREE(dir->fname);
+ SAFE_FREE(dir);
+ }
+ TALLOC_FREE(frame);
+ return NULL;
+ }
/*
* We have server and share and path empty but options
@@ -2912,7 +2921,7 @@ smbc_opendir_ctx(SMBCCTX *context,
}
TALLOC_FREE(frame);
return NULL;
-
+
}
/*
@@ -3181,19 +3190,15 @@ smbc_closedir_ctx(SMBCCTX *context,
if (!context || !context->internal ||
!context->internal->_initialized) {
-
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
-
}
if (!dir || !DLIST_CONTAINS(context->internal->_files, dir)) {
-
errno = EBADF;
TALLOC_FREE(frame);
return -1;
-
}
smbc_remove_dir(dir); /* Clean it up */
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 17e56b0756..52f1cd15f5 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -289,7 +289,7 @@ static bool reload_nmbd_services(bool test)
if ( lp_loaded() ) {
const char *fname = lp_configfile();
if (file_exist(fname,NULL) && !strcsequal(fname,dyn_CONFIGFILE)) {
- pstrcpy(dyn_CONFIGFILE,fname);
+ strlcpy(dyn_CONFIGFILE,fname,sizeof(dyn_CONFIGFILE));
test = False;
}
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index dcb9b243f4..89b1299a5d 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -2999,9 +2999,15 @@ static void show_parameter(int parmIndex)
bool hadFlag;
bool hadSyn;
bool inverse;
+#if 0
const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
"P_OCTAL", "P_LIST", "P_STRING", "P_USTRING", "P_GSTRING",
"P_UGSTRING", "P_ENUM", "P_SEP"};
+#else
+ const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
+ "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
+ "P_ENUM", "P_SEP"};
+#endif
unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
FLAG_HIDE, FLAG_DOS_STRING};
@@ -4171,6 +4177,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
strupper_m(*(char **)parm_ptr);
break;
+#if 0
case P_GSTRING:
pstrcpy((char *)parm_ptr, pszParmValue);
break;
@@ -4179,6 +4186,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
pstrcpy((char *)parm_ptr, pszParmValue);
strupper_m((char *)parm_ptr);
break;
+#endif
case P_ENUM:
lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
@@ -4250,7 +4258,6 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
case P_LIST:
if ((char ***)ptr && *(char ***)ptr) {
char **list = *(char ***)ptr;
-
for (; *list; list++) {
/* surround strings with whitespace in double quotes */
if ( strchr_m( *list, ' ' ) )
@@ -4261,12 +4268,14 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
}
break;
+#if 0
case P_GSTRING:
case P_UGSTRING:
if ((char *)ptr) {
fprintf(f, "%s", (char *)ptr);
}
break;
+#endif
case P_STRING:
case P_USTRING:
@@ -4297,10 +4306,11 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
case P_CHAR:
return (*((char *)ptr1) == *((char *)ptr2));
-
+
case P_LIST:
return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
+#if 0
case P_GSTRING:
case P_UGSTRING:
{
@@ -4311,6 +4321,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
p2 = NULL;
return (p1 == p2 || strequal(p1, p2));
}
+#endif
case P_STRING:
case P_USTRING:
{
@@ -4404,10 +4415,12 @@ static bool is_default(int i)
case P_USTRING:
return strequal(parm_table[i].def.svalue,
*(char **)parm_table[i].ptr);
+#if 0
case P_GSTRING:
case P_UGSTRING:
return strequal(parm_table[i].def.svalue,
(char *)parm_table[i].ptr);
+#endif
case P_BOOL:
case P_BOOLREV:
return parm_table[i].def.bvalue ==
@@ -4814,6 +4827,7 @@ static void lp_save_defaults(void)
parm_table[i].def.svalue = NULL;
}
break;
+#if 0
case P_GSTRING:
case P_UGSTRING:
if (parm_table[i].ptr) {
@@ -4822,6 +4836,8 @@ static void lp_save_defaults(void)
parm_table[i].def.svalue = NULL;
}
break;
+#endif
+
case P_BOOL:
case P_BOOLREV:
parm_table[i].def.bvalue =
diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c
index 98a41e4ec3..4ae735633b 100644
--- a/source3/smbd/msdfs.c
+++ b/source3/smbd/msdfs.c
@@ -481,7 +481,7 @@ static NTSTATUS dfs_path_lookup(TALLOC_CTX *ctx,
* unix_convert later in the codepath.
* If we needed to remember what we'd resolved in
* dp->reqpath (as the original code did) we'd
- * pstrcpy(localhost, dp->reqpath) on any code
+ * copy (localhost, dp->reqpath) on any code
* path below that returns True - but I don't
* think this is needed. JRA.
*/
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index aa85aca77e..328993f6b0 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -726,12 +726,12 @@ void reload_printers(void)
bool reload_services(bool test)
{
bool ret;
-
+
if (lp_loaded()) {
char *fname = lp_configfile();
if (file_exist(fname, NULL) &&
!strcsequal(fname, dyn_CONFIGFILE)) {
- pstrcpy(dyn_CONFIGFILE, fname);
+ strlcpy(dyn_CONFIGFILE, fname,sizeof(dyn_CONFIGFILE));
test = False;
}
}
@@ -755,7 +755,7 @@ bool reload_services(bool test)
load_interfaces();
- if (smbd_server_fd() != -1) {
+ if (smbd_server_fd() != -1) {
set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");
set_socket_options(smbd_server_fd(), lp_socket_options());
}
diff --git a/source3/torture/rpctorture.c b/source3/torture/rpctorture.c
deleted file mode 100644
index f0990e6dee..0000000000
--- a/source3/torture/rpctorture.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB client
- Copyright (C) Andrew Tridgell 1994-1998
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-
-#ifndef REGISTER
-#define REGISTER 0
-#endif
-
-#define CNV_LANG(s) dos2unix_format(s,False)
-#define CNV_INPUT(s) unix2dos_format(s,True)
-
-static struct cli_state smbcli;
-struct cli_state *smb_cli = &smbcli;
-
-FILE *out_hnd;
-
-static char *password; /* local copy only, if one is entered */
-
-/****************************************************************************
-initialise smb client structure
-****************************************************************************/
-void rpcclient_init(void)
-{
- memset((char *)smb_cli, '\0', sizeof(smb_cli));
- cli_initialise(smb_cli);
- smb_cli->capabilities |= CAP_NT_SMBS;
-}
-
-/*******************************************************************
- Convert, possibly using a stupid microsoft-ism which has destroyed
- the transport independence of netbios (for CIFS vendors that usually
- use the Win95-type methods, not for NT to NT communication, which uses
- DCE/RPC and therefore full-length unicode strings...) a dns name into
- a netbios name.
-
- The netbios name (NOT necessarily null-terminated) is truncated to 15
- characters.
-
- ******************************************************************/
-
-static char *dns_to_netbios_name(const char *dns_name)
-{
- static nstring netbios_name;
- int i;
- StrnCpy(netbios_name, dns_name, MAX_NETBIOSNAME_LEN-1);
- netbios_name[15] = 0;
-
- /* ok. this is because of a stupid microsoft-ism. if the called host
- name contains a '.', microsoft clients expect you to truncate the
- netbios name up to and including the '.' this even applies, by
- mistake, to workgroup (domain) names, which is _really_ daft.
- */
- for (i = 0; i < 15; i++) {
- if (netbios_name[i] == '.') {
- netbios_name[i] = 0;
- break;
- }
- }
-
- return netbios_name;
-}
-
-/****************************************************************************
-make smb client connection
-****************************************************************************/
-static bool rpcclient_connect(struct client_info *info)
-{
- struct nmb_name calling;
- struct nmb_name called;
-
- make_nmb_name(&called , dns_to_netbios_name(info->dest_host ), info->name_type);
- make_nmb_name(&calling, dns_to_netbios_name(info->myhostname), 0x0);
-
- if (!cli_establish_connection(smb_cli,
- info->dest_host, &info->dest_ip,
- &calling, &called,
- info->share, info->svc_type,
- False, True))
- {
- DEBUG(0,("rpcclient_connect: connection failed\n"));
- cli_shutdown(smb_cli);
- return False;
- }
-
- return True;
-}
-
-/****************************************************************************
-stop the smb connection(s?)
-****************************************************************************/
-static void rpcclient_stop(void)
-{
- cli_shutdown(smb_cli);
-}
-
-/****************************************************************************
- log in as an nt user, log out again.
-****************************************************************************/
-void run_enums_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
-{
- int i;
-
- /* establish connections. nothing to stop these being re-established. */
- rpcclient_connect(cli_info);
-
- DEBUG(5,("rpcclient_connect: cli->fd:%d\n", cli->fd));
- if (cli->fd <= 0)
- {
- fprintf(out_hnd, "warning: connection could not be established to %s<%02x>\n",
- cli_info->dest_host, cli_info->name_type);
- return;
- }
-
- for (i = 0; i < num_ops; i++)
- {
- set_first_token("");
- cmd_srv_enum_sess(cli_info);
- set_first_token("");
- cmd_srv_enum_shares(cli_info);
- set_first_token("");
- cmd_srv_enum_files(cli_info);
-
- if (password[0] != 0)
- {
- set_first_token("1");
- }
- else
- {
- set_first_token("");
- }
- cmd_srv_enum_conn(cli_info);
- }
-
- rpcclient_stop();
-
-}
-
-/****************************************************************************
- log in as an nt user, log out again.
-****************************************************************************/
-void run_ntlogin_test(int num_ops, struct client_info *cli_info, struct cli_state *cli)
-{
- int i;
-
- /* establish connections. nothing to stop these being re-established. */
- rpcclient_connect(cli_info);
-
- DEBUG(5,("rpcclient_connect: cli->fd:%d\n", cli->fd));
- if (cli->fd <= 0)
- {
- fprintf(out_hnd, "warning: connection could not be established to %s<%02x>\n",
- cli_info->dest_host, cli_info->name_type);
- return;
- }
-
- for (i = 0; i < num_ops; i++)
- {
- char *cmd;
- if (asprintf(&cmd, "%s %s", cli->user_name, password) > 0) {
- set_first_token(cmd);
- cmd_netlogon_login_test(cli_info);
- SAFE_FREE(cmd);
- }
- }
-
- rpcclient_stop();
-
-}
-
-/****************************************************************************
- runs n simultaneous functions.
-****************************************************************************/
-static void create_procs(int nprocs, int numops,
- struct client_info *cli_info, struct cli_state *cli,
- void (*fn)(int, struct client_info *, struct cli_state *))
-{
- int i, status;
-
- for (i=0;i<nprocs;i++)
- {
- if (fork() == 0)
- {
- pid_t mypid = getpid();
- sys_srandom(mypid ^ time(NULL));
- fn(numops, cli_info, cli);
- fflush(out_hnd);
- _exit(0);
- }
- }
-
- for (i=0;i<nprocs;i++)
- {
- waitpid(0, &status, 0);
- }
-}
-/****************************************************************************
-usage on the program - OUT OF DATE!
-****************************************************************************/
-static void usage(char *pname)
-{
- fprintf(out_hnd, "Usage: %s service <password> [-d debuglevel] [-l log] ",
- pname);
-
- fprintf(out_hnd, "\nVersion %s\n",SAMBA_VERSION_STRING);
- fprintf(out_hnd, "\t-d debuglevel set the debuglevel\n");
- fprintf(out_hnd, "\t-l log basename. Basename for log/debug files\n");
- fprintf(out_hnd, "\t-n netbios name. Use this name as my netbios name\n");
- fprintf(out_hnd, "\t-m max protocol set the max protocol level\n");
- fprintf(out_hnd, "\t-I dest IP use this IP to connect to\n");
- fprintf(out_hnd, "\t-E write messages to stderr instead of stdout\n");
- fprintf(out_hnd, "\t-U username set the network username\n");
- fprintf(out_hnd, "\t-W workgroup set the workgroup name\n");
- fprintf(out_hnd, "\t-t terminal code terminal i/o code {sjis|euc|jis7|jis8|junet|hex}\n");
- fprintf(out_hnd, "\n");
-}
-
-enum client_action
-{
- CLIENT_NONE,
- CLIENT_IPC,
- CLIENT_SVC
-};
-
-/****************************************************************************
- main program
-****************************************************************************/
- int main(int argc,char *argv[])
-{
- char *pname = argv[0];
- int opt;
- extern char *optarg;
- extern int optind;
- bool got_pass = False;
- char *cmd_str="";
- enum client_action cli_action = CLIENT_NONE;
- int nprocs = 1;
- int numops = 100;
- char *logfile;
- TALLOC_CTX *frame = talloc_stackframe();
-
- struct client_info cli_info;
-
- out_hnd = stdout;
-
- rpcclient_init();
-
- if (!lp_load(dyn_CONFIGFILE,True, False, False, True))
- {
- fprintf(stderr, "Can't load %s - run testparm to debug it\n", dyn_CONFIGFILE);
- }
-
- DEBUGLEVEL = 0;
-
- cli_info.put_total_size = 0;
- cli_info.put_total_time_ms = 0;
- cli_info.get_total_size = 0;
- cli_info.get_total_time_ms = 0;
-
- cli_info.dir_total = 0;
- cli_info.newer_than = 0;
- cli_info.archive_level = 0;
- cli_info.print_mode = 1;
-
- cli_info.translation = False;
- cli_info.recurse_dir = False;
- cli_info.lowercase = False;
- cli_info.prompt = True;
- cli_info.abort_mget = True;
-
- cli_info.dest_ip.s_addr = 0;
- cli_info.name_type = 0x20;
-
- pstrcpy(cli_info.cur_dir , "\\");
- pstrcpy(cli_info.file_sel, "");
- pstrcpy(cli_info.base_dir, "");
- pstrcpy(smb_cli->domain, "");
- pstrcpy(smb_cli->user_name, "");
- pstrcpy(cli_info.myhostname, "");
- pstrcpy(cli_info.dest_host, "");
-
- pstrcpy(cli_info.svc_type, "A:");
- pstrcpy(cli_info.share, "");
- pstrcpy(cli_info.service, "");
-
- ZERO_STRUCT(cli_info.dom.level3_sid);
- pstrcpy(cli_info.dom.level3_dom, "");
- ZERO_STRUCT(cli_info.dom.level5_sid);
- pstrcpy(cli_info.dom.level5_dom, "");
-
- {
- int i;
- for (i=0; i<PI_MAX_PIPES; i++)
- smb_cli->pipes[i].fnum = 0xffff;
- }
-
- setup_logging(pname, True);
-
- password = talloc_strdup(frame, "");
- if (!password) {
- exit(1);
- }
-
- if (argc < 2)
- {
- usage(pname);
- exit(1);
- }
-
- if (*argv[1] != '-')
- {
- pstrcpy(cli_info.service, argv[1]);
- /* Convert any '/' characters in the service name to '\' characters */
- string_replace( cli_info.service, '/','\\');
- argc--;
- argv++;
-
- DEBUG(1,("service: %s\n", cli_info.service));
-
- if (count_chars(cli_info.service,'\\') < 3)
- {
- usage(pname);
- printf("\n%s: Not enough '\\' characters in service\n", cli_info.service);
- exit(1);
- }
-
- /*
- if (count_chars(cli_info.service,'\\') > 3)
- {
- usage(pname);
- printf("\n%s: Too many '\\' characters in service\n", cli_info.service);
- exit(1);
- }
- */
-
- if (argc > 1 && (*argv[1] != '-'))
- {
- got_pass = True;
- password = talloc_strdup(frame, argv[1]);
- if (!password) {
- exit(1);
- }
- argc--;
- argv++;
- }
-
- cli_action = CLIENT_SVC;
- }
-
- while ((opt = getopt(argc, argv,"s:O:M:S:i:N:o:n:d:l:hI:EB:U:L:t:m:W:T:D:c:")) != EOF)
- {
- switch (opt)
- {
- case 'm':
- {
- /* FIXME ... max_protocol seems to be funny here */
-
- int max_protocol = 0;
- max_protocol = interpret_protocol(optarg,max_protocol);
- fprintf(stderr, "max protocol not currently supported\n");
- break;
- }
-
- case 'O':
- {
- lp_do_parameter(-1, "socket options", optarg);
- break;
- }
-
- case 'S':
- {
- pstrcpy(cli_info.dest_host,optarg);
- strupper_m(cli_info.dest_host);
- cli_action = CLIENT_IPC;
- break;
- }
-
- case 'i':
- {
- pstrcpy(scope, optarg);
- break;
- }
-
- case 'U':
- {
- char *lp;
- pstrcpy(smb_cli->user_name,optarg);
- if ((lp=strchr_m(smb_cli->user_name,'%')))
- {
- *lp = 0;
- password = talloc_strdup(frame, lp+1);
- if (!password) {
- exit(1);
- }
- got_pass = True;
- }
- break;
- }
-
- case 'W':
- {
- pstrcpy(smb_cli->domain,optarg);
- break;
- }
-
- case 'E':
- {
- dbf = x_stderr;
- break;
- }
-
- case 'I':
- {
- (void)interpret_addr2(&cli_info.dest_ip, optarg);
- if (is_zero_ip(cli_info.dest_ip))
- {
- exit(1);
- }
- break;
- }
-
- case 'N':
- {
- nprocs = atoi(optarg);
- break;
- }
-
- case 'o':
- {
- numops = atoi(optarg);
- break;
- }
-
- case 'n':
- {
- set_global_myname(optarg);
- break;
- }
-
- case 'd':
- {
- if (*optarg == 'A')
- DEBUGLEVEL = 10000;
- else
- DEBUGLEVEL = atoi(optarg);
- break;
- }
-
- case 'l':
- {
- if (asprintf(&logfile, "%s.client",optarg) > 0) {
- lp_set_logfile(logfile);
- SAFE_FREE(logfile);
- }
- break;
- }
-
- case 'c':
- {
- cmd_str = optarg;
- got_pass = True;
- break;
- }
-
- case 'h':
- {
- usage(pname);
- exit(0);
- break;
- }
-
- case 's':
- {
- pstrcpy(dyn_CONFIGFILE, optarg);
- break;
- }
-
- default:
- {
- usage(pname);
- exit(1);
- break;
- }
- }
- }
-
- if (cli_action == CLIENT_NONE)
- {
- usage(pname);
- exit(1);
- }
-
- fstrcpy(cli_info.myhostname, global_myname());
- strupper_m(cli_info.myhostname);
-
- DEBUG(3,("%s client started (version %s)\n",current_timestring(False),SAMBA_VERSION_STRING));
-
- if (*smb_cli->domain == 0)
- {
- pstrcpy(smb_cli->domain,lp_workgroup());
- }
- strupper_m(smb_cli->domain);
-
- load_interfaces();
-
- if (cli_action == CLIENT_IPC)
- {
- pstrcpy(cli_info.share, "IPC$");
- pstrcpy(cli_info.svc_type, "IPC");
- }
-
- fstrcpy(cli_info.mach_acct, cli_info.myhostname);
- strupper_m(cli_info.mach_acct);
- fstrcat(cli_info.mach_acct, "$");
-
- /* set the password cache info */
- if (got_pass)
- {
- if (password[0] == 0)
- {
- pwd_set_nullpwd(&(smb_cli->pwd));
- }
- else
- {
- pwd_make_lm_nt_16(&(smb_cli->pwd), password); /* generate 16 byte hashes */
- }
- }
- else
- {
- char *pwd = getpass("Enter Password:");
- password = talloc_strdup(frame, pwd);
- if (!password) {
- exit(1);
- }
- pwd_make_lm_nt_16(&(smb_cli->pwd), password); /* generate 16 byte hashes */
- }
-
- create_procs(nprocs, numops, &cli_info, smb_cli, run_enums_test);
-
- if (password[0] != 0)
- {
- create_procs(nprocs, numops, &cli_info, smb_cli, run_ntlogin_test);
- }
-
- fflush(out_hnd);
-
- return(0);
-}
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 4194b55894..53571d6002 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -64,7 +64,7 @@ static bool reload_services_file(void)
const char *fname = lp_configfile();
if (file_exist(fname,NULL) && !strcsequal(fname,dyn_CONFIGFILE)) {
- pstrcpy(dyn_CONFIGFILE,fname);
+ strlcpy(dyn_CONFIGFILE,fname,sizeof(dyn_CONFIGFILE));
}
}