summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net.c76
-rw-r--r--source3/utils/net_ads.c50
-rw-r--r--source3/utils/net_help.c5
-rw-r--r--source3/utils/net_rpc.c105
-rw-r--r--source3/utils/net_rpc_join.c3
-rw-r--r--source3/utils/pdbedit.c13
-rw-r--r--source3/utils/smbcontrol.c5
-rw-r--r--source3/utils/smbpasswd.c36
-rw-r--r--source3/utils/status.c6
-rw-r--r--source3/utils/testparm.c12
10 files changed, 254 insertions, 57 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c
index fc7094bcf7..800aeded0a 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -329,6 +329,74 @@ static int net_file(int argc, const char **argv)
return net_rap_file(argc, argv);
}
+/*
+ Retrieve our local SID or the SID for the specified name
+ */
+static int net_getlocalsid(int argc, const char **argv)
+{
+ DOM_SID sid;
+ const char *name;
+ fstring sid_str;
+
+ if (argc >= 1) {
+ name = argv[0];
+ }
+ else {
+ name = global_myname;
+ }
+
+ if (!secrets_fetch_domain_sid(name, &sid)) {
+ DEBUG(0, ("Can't fetch domain SID for name: %s\n", name));
+ return 1;
+ }
+ sid_to_string(sid_str, &sid);
+ d_printf("SID for domain %s is: %s\n", name, sid_str);
+ return 0;
+}
+
+static int net_setlocalsid(int argc, const char **argv)
+{
+ DOM_SID sid;
+
+ if ( (argc != 1)
+ || (strncmp(argv[0], "S-1-5-21-", strlen("S-1-5-21-")) != 0)
+ || (!string_to_sid(&sid, argv[0]))
+ || (sid.num_auths != 4)) {
+ d_printf("usage: net setlocalsid S-1-5-21-x-y-z\n");
+ return 1;
+ }
+
+ if (!secrets_store_domain_sid(global_myname, &sid)) {
+ DEBUG(0,("Can't store domain SID as a pdc/bdc.\n"));
+ return 1;
+ }
+
+ return 0;
+}
+
+static int net_getdomainsid(int argc, const char **argv)
+{
+ DOM_SID domain_sid;
+ fstring sid_str;
+
+ if (!secrets_fetch_domain_sid(global_myname, &domain_sid)) {
+ d_printf("Could not fetch local SID\n");
+ return 1;
+ }
+ sid_to_string(sid_str, &domain_sid);
+ d_printf("SID for domain %s is: %s\n", global_myname, sid_str);
+
+ if (!secrets_fetch_domain_sid(lp_workgroup(), &domain_sid)) {
+ d_printf("Could not fetch domain SID\n");
+ return 1;
+ }
+
+ sid_to_string(sid_str, &domain_sid);
+ d_printf("SID for domain %s is: %s\n", lp_workgroup(), sid_str);
+
+ return 0;
+}
+
/* main function table */
static struct functable net_func[] = {
{"RPC", net_rpc},
@@ -352,6 +420,10 @@ static struct functable net_func[] = {
{"TIME", net_time},
{"LOOKUP", net_lookup},
{"JOIN", net_join},
+ {"CACHE", net_cache},
+ {"GETLOCALSID", net_getlocalsid},
+ {"SETLOCALSID", net_setlocalsid},
+ {"GETDOMAINSID", net_getdomainsid},
{"HELP", net_help},
{NULL, NULL}
@@ -391,7 +463,7 @@ static struct functable net_func[] = {
{"force", 'f', POPT_ARG_NONE, &opt_force},
{"timeout", 't', POPT_ARG_INT, &opt_timeout},
{"machine-pass",'P', POPT_ARG_NONE, &opt_machine_pass},
- { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
+ {"debuglevel", 'D', POPT_ARG_STRING, &debuglevel},
{ 0, 0, 0, 0}
};
@@ -469,7 +541,7 @@ static struct functable net_func[] = {
if (!*global_myname) {
char *p2;
- fstrcpy(global_myname, myhostname());
+ pstrcpy(global_myname, myhostname());
p2 = strchr_m(global_myname, '.');
if (p2)
*p2 = 0;
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index ad405fe68c..af290ce83c 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -56,6 +56,31 @@ int net_ads_usage(int argc, const char **argv)
}
+/*
+ this implements the CLDAP based netlogon lookup requests
+ for finding the domain controller of a ADS domain
+*/
+static int net_ads_lookup(int argc, const char **argv)
+{
+ ADS_STRUCT *ads;
+
+ ads = ads_init(NULL, NULL, opt_host);
+ if (ads) {
+ ads->auth.flags |= ADS_AUTH_NO_BIND;
+ }
+
+ ads_connect(ads);
+
+ if (!ads || !ads->config.realm) {
+ d_printf("Didn't find the cldap server!\n");
+ return -1;
+ }
+
+ return ads_cldap_netlogon(ads);
+}
+
+
+
static int net_ads_info(int argc, const char **argv)
{
ADS_STRUCT *ads;
@@ -63,7 +88,7 @@ static int net_ads_info(int argc, const char **argv)
ads = ads_init(NULL, NULL, opt_host);
if (ads) {
- ads->auth.no_bind = 1;
+ ads->auth.flags |= ADS_AUTH_NO_BIND;
}
ads_connect(ads);
@@ -78,6 +103,7 @@ static int net_ads_info(int argc, const char **argv)
d_printf("Realm: %s\n", ads->config.realm);
d_printf("Bind Path: %s\n", ads->config.bind_path);
d_printf("LDAP port: %d\n", ads->ldap_port);
+ d_printf("Server time: %s\n", http_timestring(ads->config.current_time));
return 0;
}
@@ -174,7 +200,7 @@ static int net_ads_workgroup(int argc, const char **argv)
-static void usergrp_display(char *field, void **values, void *data_area)
+static BOOL usergrp_display(char *field, void **values, void *data_area)
{
char **disp_fields = (char **) data_area;
@@ -188,15 +214,16 @@ static void usergrp_display(char *field, void **values, void *data_area)
}
SAFE_FREE(disp_fields[0]);
SAFE_FREE(disp_fields[1]);
- return;
+ return True;
}
if (!values) /* must be new field, indicate string field */
- return;
+ return True;
if (StrCaseCmp(field, "sAMAccountName") == 0) {
disp_fields[0] = strdup((char *) values[0]);
}
if (StrCaseCmp(field, "description") == 0)
disp_fields[1] = strdup((char *) values[0]);
+ return True;
}
static int net_ads_user_usage(int argc, const char **argv)
@@ -245,7 +272,7 @@ static int ads_user_add(int argc, const char **argv)
/* try setting the password */
asprintf(&upn, "%s@%s", argv[0], ads->config.realm);
- status = krb5_set_password(ads->auth.kdc_server, upn, argv[1]);
+ status = krb5_set_password(ads->auth.kdc_server, upn, argv[1], ads->auth.time_offset);
safe_free(upn);
if (ADS_ERR_OK(status)) {
d_printf("User %s added\n", argv[0]);
@@ -610,7 +637,7 @@ int net_ads_join(int argc, const char **argv)
rc = ads_search_dn(ads, &res, dn, NULL);
ads_msgfree(ads, res);
- if (rc.error_type == ADS_ERROR_LDAP && rc.rc == LDAP_NO_SUCH_OBJECT) {
+ if (rc.error_type == ADS_ERROR_LDAP && rc.err.rc == LDAP_NO_SUCH_OBJECT) {
d_printf("ads_join_realm: organizational unit %s does not exist (dn:%s)\n",
org_unit, dn);
return -1;
@@ -628,15 +655,15 @@ int net_ads_join(int argc, const char **argv)
return -1;
}
- rc = ads_set_machine_password(ads, global_myname, password);
+ rc = ads_domain_sid(ads, &dom_sid);
if (!ADS_ERR_OK(rc)) {
- d_printf("ads_set_machine_password: %s\n", ads_errstr(rc));
+ d_printf("ads_domain_sid: %s\n", ads_errstr(rc));
return -1;
}
- rc = ads_domain_sid(ads, &dom_sid);
+ rc = ads_set_machine_password(ads, global_myname, password);
if (!ADS_ERR_OK(rc)) {
- d_printf("ads_domain_sid: %s\n", ads_errstr(rc));
+ d_printf("ads_set_machine_password: %s\n", ads_errstr(rc));
return -1;
}
@@ -856,7 +883,7 @@ static int net_ads_password(int argc, const char **argv)
new_password = getpass(prompt);
ret = kerberos_set_password(ads->auth.kdc_server, auth_principal,
- auth_password, argv[0], new_password);
+ auth_password, argv[0], new_password, ads->auth.time_offset);
if (!ADS_ERR_OK(ret)) {
d_printf("Password change failed :-( ...\n");
ads_destroy(&ads);
@@ -1009,6 +1036,7 @@ int net_ads(int argc, const char **argv)
{"PRINTER", net_ads_printer},
{"SEARCH", net_ads_search},
{"WORKGROUP", net_ads_workgroup},
+ {"LOOKUP", net_ads_lookup},
{"HELP", net_ads_help},
{NULL, NULL}
};
diff --git a/source3/utils/net_help.c b/source3/utils/net_help.c
index ab3eac4b43..262670cb2a 100644
--- a/source3/utils/net_help.c
+++ b/source3/utils/net_help.c
@@ -58,7 +58,7 @@ static int help_usage(int argc, const char **argv)
"\n"\
"Valid functions are:\n"\
" RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\
-" GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP\n");
+" GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n");
return -1;
}
@@ -135,6 +135,9 @@ static int net_usage(int argc, const char **argv)
" net user\t\tto manage users\n"\
" net group\t\tto manage groups\n"\
" net join\t\tto join a domain\n"\
+ " net cache\t\tto operate on cache tdb file\n"\
+ " net getlocalsid [NAME]\tto get the SID for local name\n"\
+ " net setlocalsid SID\tto set the local domain SID\n"\
"\n"\
" net ads <command>\tto run ADS commands\n"\
" net rap <command>\tto run RAP (pre-RPC) commands\n"\
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 55e8a497cc..8b8278b053 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -178,7 +178,7 @@ static int run_rpc_command(struct cli_state *cli_arg, const char *pipe_name, int
/**
* Force a change of the trust acccount password.
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid aquired from the remote server
@@ -224,7 +224,7 @@ static int rpc_changetrustpw(int argc, const char **argv)
*
* The password should be created with 'server manager' or eqiv first.
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid aquired from the remote server
@@ -243,6 +243,7 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl
extern pstring global_myname;
fstring trust_passwd;
unsigned char orig_trust_passwd_hash[16];
+ NTSTATUS result;
fstrcpy(trust_passwd, global_myname);
strlower(trust_passwd);
@@ -256,7 +257,12 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl
E_md4hash(trust_passwd, orig_trust_passwd_hash);
- return trust_pw_change_and_store_it(cli, mem_ctx, orig_trust_passwd_hash);
+ result = trust_pw_change_and_store_it(cli, mem_ctx, orig_trust_passwd_hash);
+
+ if (NT_STATUS_IS_OK(result))
+ printf("Joined domain %s.\n",lp_workgroup());
+
+ return result;
}
/**
@@ -319,7 +325,7 @@ int net_rpc_join(int argc, const char **argv)
/**
* display info about a rpc domain
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -339,6 +345,9 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
POLICY_HND connect_pol, domain_pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
SAM_UNK_CTR ctr;
+ fstring sid_str;
+
+ sid_to_string(sid_str, domain_sid);
/* Get sam policy handle */
result = cli_samr_connect(cli, mem_ctx, MAXIMUM_ALLOWED_ACCESS,
@@ -361,6 +370,7 @@ rpc_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
if (NT_STATUS_IS_OK(result)) {
TALLOC_CTX *ctx = talloc_init();
d_printf("Domain Name: %s\n", unistr2_tdup(ctx, &ctr.info.inf2.uni_domain));
+ d_printf("Domain SID: %s\n", sid_str);
d_printf("Sequence number: %u\n", ctr.info.inf2.seq_num);
d_printf("Num users: %u\n", ctr.info.inf2.num_domain_usrs);
d_printf("Num domain groups: %u\n", ctr.info.inf2.num_domain_grps);
@@ -387,6 +397,53 @@ int net_rpc_info(int argc, const char **argv)
}
+/**
+ * Fetch domain SID into the local secrets.tdb
+ *
+ * All parameters are provided by the run_rpc_command function, except for
+ * argc, argv which are passes through.
+ *
+ * @param domain_sid The domain sid acquired from the remote server
+ * @param cli A cli_state connected to the server.
+ * @param mem_ctx Talloc context, destoyed on completion of the function.
+ * @param argc Standard main() style argc
+ * @param argv Standard main() style argv. Initial components are already
+ * stripped
+ *
+ * @return Normal NTSTATUS return.
+ **/
+
+static NTSTATUS
+rpc_getsid_internals(const DOM_SID *domain_sid, struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, int argc, const char **argv)
+{
+ fstring sid_str;
+
+ sid_to_string(sid_str, domain_sid);
+ d_printf("Storing SID %s for Domain %s in secrets.tdb\n",
+ sid_str, lp_workgroup());
+
+ if (!secrets_store_domain_sid(global_myname, domain_sid)) {
+ DEBUG(0,("Can't store domain SID\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return NT_STATUS_OK;
+}
+
+
+/**
+ * 'net rpc getsid' entrypoint.
+ * @param argc Standard main() style argc
+ * @param argc Standard main() style argv. Initial components are already
+ * stripped
+ **/
+int net_rpc_getsid(int argc, const char **argv)
+{
+ return run_rpc_command(NULL, PIPE_SAMR, NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC,
+ rpc_getsid_internals,
+ argc, argv);
+}
/****************************************************************************/
@@ -406,7 +463,7 @@ static int rpc_user_usage(int argc, const char **argv)
/**
* Add a new user to a remote RPC server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -494,7 +551,7 @@ static int rpc_user_add(int argc, const char **argv)
/**
* Delete a user from a remote RPC server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -595,7 +652,7 @@ static int rpc_user_delete(int argc, const char **argv)
/**
* List user's groups on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -697,7 +754,7 @@ static int rpc_user_info(int argc, const char **argv)
/**
* List users on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -811,7 +868,7 @@ static int rpc_group_usage(int argc, const char **argv)
/**
* List groups on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -954,7 +1011,7 @@ static int rpc_share_usage(int argc, const char **argv)
/**
* Add a share on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -1002,7 +1059,7 @@ static int rpc_share_add(int argc, const char **argv)
/**
* Delete a share on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -1070,7 +1127,7 @@ static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
/**
* List shares on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -1147,7 +1204,7 @@ static int rpc_file_usage(int argc, const char **argv)
/**
* Close a file on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -1210,7 +1267,7 @@ static void display_file_info_3(FILE_INFO_3 *info3, FILE_INFO_3_STR *str3)
/**
* List open files on a remote RPC server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid acquired from the remote server
@@ -1314,7 +1371,7 @@ int net_rpc_file(int argc, const char **argv)
/**
* ABORT the shutdown of a remote RPC Server
*
- * All paramaters are provided by the run_rpc_command function, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passed through.
*
* @param domain_sid The domain sid aquired from the remote server
@@ -1362,7 +1419,7 @@ static int rpc_shutdown_abort(int argc, const char **argv)
/**
* Shut down a remote RPC Server
*
- * All paramaters are provided by the run_rpc_command funcion, except for
+ * All parameters are provided by the run_rpc_command function, except for
* argc, argv which are passes through.
*
* @param domain_sid The domain sid aquired from the remote server
@@ -1914,6 +1971,12 @@ static int rpc_trustdom_list(int argc, const char **argv)
d_printf("%s%s%s\n", trusted_dom_names[i], padding, ascii_sid);
};
+
+ /*
+ * in case of no trusted domains say something rather
+ * than just display blank line
+ */
+ if (!num_domains) d_printf("none\n");
} while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
@@ -2018,6 +2081,8 @@ static int rpc_trustdom_list(int argc, const char **argv)
};
};
+ if (!num_domains) d_printf("none\n");
+
} while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES));
/* close opened samr and domain policy handles */
@@ -2083,7 +2148,7 @@ BOOL net_rpc_check(unsigned flags)
/* flags (i.e. server type) may depend on command */
if (!net_find_server(flags, &server_ip, &server_name))
- goto done;
+ return False;
ZERO_STRUCT(cli);
if (cli_initialise(&cli) == False)
@@ -2120,12 +2185,13 @@ int net_rpc_usage(int argc, const char **argv)
{
d_printf(" net rpc info \t\t\tshow basic info about a domain \n");
d_printf(" net rpc join \t\t\tto join a domain \n");
- d_printf(" net rpc testjoin \t\t\ttests that a join is valid\n");
+ d_printf(" net rpc testjoin \t\ttests that a join is valid\n");
d_printf(" net rpc user \t\t\tto add, delete and list users\n");
d_printf(" net rpc group \t\tto list groups\n");
d_printf(" net rpc share \t\tto add, delete, and list shares\n");
d_printf(" net rpc file \t\t\tto list open files\n");
d_printf(" net rpc changetrustpw \tto change the trust account password\n");
+ d_printf(" net rpc getsid \t\tfetch the domain sid into the local secrets.tdb\n");
d_printf(" net rpc trustdom \t\tto create trusting domain's account\n"
"\t\t\t\t\tor establish trust\n");
d_printf(" net rpc abortshutdown \tto abort the shutdown of a remote server\n");
@@ -2192,6 +2258,9 @@ int net_rpc(int argc, const char **argv)
{"trustdom", rpc_trustdom},
{"abortshutdown", rpc_shutdown_abort},
{"shutdown", rpc_shutdown},
+ {"samdump", rpc_samdump},
+ {"vampire", rpc_vampire},
+ {"getsid", net_rpc_getsid},
{"help", net_rpc_help},
{NULL, NULL}
};
diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c
index c8be93c39c..b08095f1cc 100644
--- a/source3/utils/net_rpc_join.c
+++ b/source3/utils/net_rpc_join.c
@@ -49,6 +49,7 @@ int net_rpc_join_ok(const char *domain)
int retval = 1;
uint32 channel;
NTSTATUS result;
+ uint32 neg_flags = 0x000001ff;
/* Connect to remote machine */
if (!(cli = net_make_ipc_connection(NET_FLAGS_ANONYMOUS | NET_FLAGS_PDC))) {
@@ -75,7 +76,7 @@ int net_rpc_join_ok(const char *domain)
CHECK_RPC_ERR(cli_nt_setup_creds(cli,
channel,
- stored_md4_trust_password),
+ stored_md4_trust_password, &neg_flags, 2),
"error in domain join verification");
retval = 0; /* Success! */
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 51dbbb98c0..7c61e6d8be 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -508,6 +508,17 @@ int main (int argc, char **argv)
exit(1);
}
+ if (!*global_myname) {
+ char *p2;
+
+ pstrcpy(global_myname, myhostname());
+ p2 = strchr_m(global_myname, '.');
+ if (p2)
+ *p2 = 0;
+ }
+
+ strupper(global_myname);
+
setparms = (config_file ? BIT_CONFIGFILE : 0) +
(new_debuglevel ? BIT_DEBUGLEVEL : 0) +
(backend ? BIT_BACKEND : 0) +
@@ -544,7 +555,7 @@ int main (int argc, char **argv)
/* the lowest bit options are always accepted */
checkparms = setparms & ~MASK_ALWAYS_GOOD;
- /* accoun tpolicy operations */
+ /* account policy operations */
if ((checkparms & BIT_ACCPOLICY) && !(checkparms & ~(BIT_ACCPOLICY + BIT_ACCPOLVAL))) {
uint32 value;
int field = account_policy_name_to_fieldnum(account_policy);
diff --git a/source3/utils/smbcontrol.c b/source3/utils/smbcontrol.c
index 2d78b21dcc..5401755376 100644
--- a/source3/utils/smbcontrol.c
+++ b/source3/utils/smbcontrol.c
@@ -42,6 +42,7 @@ static struct {
{"dmalloc-mark", MSG_REQ_DMALLOC_MARK },
{"dmalloc-log-changed", MSG_REQ_DMALLOC_LOG_CHANGED },
{"shutdown", MSG_SHUTDOWN },
+ {"change_id", MSG_PRINTER_DRVUPGRADE},
{NULL, -1}
};
@@ -553,6 +554,10 @@ static BOOL do_command(char *dest, char *msg_name, int iparams, char **params)
if (!send_message(dest, MSG_SHUTDOWN, NULL, 0, False))
return False;
break;
+ case MSG_PRINTER_DRVUPGRADE:
+ if (!send_message(dest, MSG_PRINTER_DRVUPGRADE, params[0], 0, False))
+ return False;
+ break;
}
return (True);
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index 98993676c9..75a4319cb9 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -217,23 +217,23 @@ static int process_options(int argc, char **argv, int local_flags)
*************************************************************/
static char *stdin_new_passwd(void)
{
- static fstring new_passwd;
+ static fstring new_pw;
size_t len;
- ZERO_ARRAY(new_passwd);
+ ZERO_ARRAY(new_pw);
/*
* if no error is reported from fgets() and string at least contains
* the newline that ends the password, then replace the newline with
* a null terminator.
*/
- if ( fgets(new_passwd, sizeof(new_passwd), stdin) != NULL) {
- if ((len = strlen(new_passwd)) > 0) {
- if(new_passwd[len-1] == '\n')
- new_passwd[len - 1] = 0;
+ if ( fgets(new_pw, sizeof(new_pw), stdin) != NULL) {
+ if ((len = strlen(new_pw)) > 0) {
+ if(new_pw[len-1] == '\n')
+ new_pw[len - 1] = 0;
}
}
- return(new_passwd);
+ return(new_pw);
}
@@ -259,20 +259,20 @@ static char *get_pass( char *prompt, BOOL stdin_get)
static char *prompt_for_new_password(BOOL stdin_get)
{
char *p;
- fstring new_passwd;
+ fstring new_pw;
- ZERO_ARRAY(new_passwd);
+ ZERO_ARRAY(new_pw);
p = get_pass("New SMB password:", stdin_get);
- fstrcpy(new_passwd, p);
+ fstrcpy(new_pw, p);
SAFE_FREE(p);
p = get_pass("Retype new SMB password:", stdin_get);
- if (strcmp(p, new_passwd)) {
+ if (strcmp(p, new_pw)) {
fprintf(stderr, "Mismatch - password unchanged.\n");
- ZERO_ARRAY(new_passwd);
+ ZERO_ARRAY(new_pw);
SAFE_FREE(p);
return NULL;
}
@@ -285,27 +285,27 @@ static char *prompt_for_new_password(BOOL stdin_get)
Change a password either locally or remotely.
*************************************************************/
-static BOOL password_change(const char *remote_machine, char *user_name,
- char *old_passwd, char *new_passwd, int local_flags)
+static BOOL password_change(const char *remote_mach, char *username,
+ char *old_passwd, char *new_pw, int local_flags)
{
BOOL ret;
pstring err_str;
pstring msg_str;
- if (remote_machine != NULL) {
+ if (remote_mach != NULL) {
if (local_flags & (LOCAL_ADD_USER|LOCAL_DELETE_USER|LOCAL_DISABLE_USER|LOCAL_ENABLE_USER|
LOCAL_TRUST_ACCOUNT|LOCAL_SET_NO_PASSWORD)) {
/* these things can't be done remotely yet */
return False;
}
- ret = remote_password_change(remote_machine, user_name,
- old_passwd, new_passwd, err_str, sizeof(err_str));
+ ret = remote_password_change(remote_mach, username,
+ old_passwd, new_pw, err_str, sizeof(err_str));
if(*err_str)
fprintf(stderr, err_str);
return ret;
}
- ret = local_password_change(user_name, local_flags, new_passwd,
+ ret = local_password_change(username, local_flags, new_pw,
err_str, sizeof(err_str), msg_str, sizeof(msg_str));
if(*msg_str)
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 0b0c591cb1..d87497f2fa 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -146,6 +146,7 @@ static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid,
******************************************************************/
static int profile_dump(void)
{
+#ifdef WITH_PROFILE
if (!profile_setup(True)) {
fprintf(stderr,"Failed to initialise profile memory\n");
return -1;
@@ -482,6 +483,9 @@ static int profile_dump(void)
d_printf("run_elections_time: %u\n", profile_p->run_elections_time);
d_printf("election_count: %u\n", profile_p->election_count);
d_printf("election_time: %u\n", profile_p->election_time);
+#else /* WITH_PROFILE */
+ fprintf(stderr, "Profile data unavailable\n");
+#endif /* WITH_PROFILE */
return 0;
}
@@ -549,7 +553,9 @@ static int traverse_sessionid(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, vo
{"conf", 's', POPT_ARG_STRING, 0, 's'},
{"user", 'u', POPT_ARG_STRING, 0, 'u'},
{"brief", 'b', POPT_ARG_NONE, &brief},
+#ifdef WITH_PROFILE
{"profile", 'P', POPT_ARG_NONE, &profile_only},
+#endif /* WITH_PROFILE */
{"byterange", 'B', POPT_ARG_NONE, &show_brl},
{ NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug },
{ 0, 0, 0, 0}
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 3086019467..d48cecba47 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -48,7 +48,7 @@ static int do_global_checks(void)
SMB_STRUCT_STAT st;
if (lp_security() >= SEC_DOMAIN && !lp_encrypted_passwords()) {
- printf("ERROR: in 'security=domain' mode the 'encrypt passwords' parameter must also be set to 'true'.\n");
+ printf("ERROR: in 'security=domain' mode the 'encrypt passwords' parameter must always be set to 'true'.\n");
ret = 1;
}
@@ -171,7 +171,7 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
return ret;
}
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
{
extern char *optarg;
extern int optind;
@@ -185,17 +185,19 @@ int main(int argc, char *argv[])
static char *new_local_machine = NULL;
const char *cname;
const char *caddr;
+ static int show_defaults;
struct poptOption long_options[] = {
POPT_AUTOHELP
{"suppress-prompt", 's', POPT_ARG_VAL, &silent_mode, 1, "Suppress prompt for enter"},
+ {"verbose", 'v', POPT_ARG_NONE, &show_defaults, 1, "Show default options too"},
{"server", 'L',POPT_ARG_STRING, &new_local_machine, 0, "Set %%L macro to servername\n"},
{"encoding", 't', POPT_ARG_STRING, &term_code, 0, "Print parameters with encoding"},
{0,0,0,0}
};
- pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
+ pc = poptGetContext(NULL, argc, argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
while((opt = poptGetNextOpt(pc)) != -1);
@@ -276,7 +278,7 @@ int main(int argc, char *argv[])
fflush(stdout);
getc(stdin);
}
- lp_dump(stdout,True, lp_numservices());
+ lp_dump(stdout, show_defaults, lp_numservices());
}
if(cname && caddr){