diff options
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net.c | 76 | ||||
-rw-r--r-- | source3/utils/net_ads.c | 50 | ||||
-rw-r--r-- | source3/utils/net_help.c | 5 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 105 | ||||
-rw-r--r-- | source3/utils/net_rpc_join.c | 3 | ||||
-rw-r--r-- | source3/utils/pdbedit.c | 13 | ||||
-rw-r--r-- | source3/utils/smbcontrol.c | 5 | ||||
-rw-r--r-- | source3/utils/smbpasswd.c | 36 | ||||
-rw-r--r-- | source3/utils/status.c | 6 | ||||
-rw-r--r-- | source3/utils/testparm.c | 12 |
10 files changed, 57 insertions, 254 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index 800aeded0a..fc7094bcf7 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -329,74 +329,6 @@ 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}, @@ -420,10 +352,6 @@ 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} @@ -463,7 +391,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}, - {"debuglevel", 'D', POPT_ARG_STRING, &debuglevel}, + { NULL, 0, POPT_ARG_INCLUDE_TABLE, popt_common_debug }, { 0, 0, 0, 0} }; @@ -541,7 +469,7 @@ static struct functable net_func[] = { if (!*global_myname) { char *p2; - pstrcpy(global_myname, myhostname()); + fstrcpy(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 af290ce83c..ad405fe68c 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -56,31 +56,6 @@ 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; @@ -88,7 +63,7 @@ static int net_ads_info(int argc, const char **argv) ads = ads_init(NULL, NULL, opt_host); if (ads) { - ads->auth.flags |= ADS_AUTH_NO_BIND; + ads->auth.no_bind = 1; } ads_connect(ads); @@ -103,7 +78,6 @@ 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; } @@ -200,7 +174,7 @@ static int net_ads_workgroup(int argc, const char **argv) -static BOOL usergrp_display(char *field, void **values, void *data_area) +static void usergrp_display(char *field, void **values, void *data_area) { char **disp_fields = (char **) data_area; @@ -214,16 +188,15 @@ static BOOL usergrp_display(char *field, void **values, void *data_area) } SAFE_FREE(disp_fields[0]); SAFE_FREE(disp_fields[1]); - return True; + return; } if (!values) /* must be new field, indicate string field */ - return True; + return; 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) @@ -272,7 +245,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], ads->auth.time_offset); + status = krb5_set_password(ads->auth.kdc_server, upn, argv[1]); safe_free(upn); if (ADS_ERR_OK(status)) { d_printf("User %s added\n", argv[0]); @@ -637,7 +610,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.err.rc == LDAP_NO_SUCH_OBJECT) { + if (rc.error_type == ADS_ERROR_LDAP && rc.rc == LDAP_NO_SUCH_OBJECT) { d_printf("ads_join_realm: organizational unit %s does not exist (dn:%s)\n", org_unit, dn); return -1; @@ -655,15 +628,15 @@ int net_ads_join(int argc, const char **argv) 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; } - 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; } @@ -883,7 +856,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, ads->auth.time_offset); + auth_password, argv[0], new_password); if (!ADS_ERR_OK(ret)) { d_printf("Password change failed :-( ...\n"); ads_destroy(&ads); @@ -1036,7 +1009,6 @@ 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 262670cb2a..ab3eac4b43 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 GETLOCALSID SETLOCALSID\n"); +" GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP\n"); return -1; } @@ -135,9 +135,6 @@ 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 8b8278b053..55e8a497cc 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 parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, 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 parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid aquired from the remote server @@ -243,7 +243,6 @@ 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); @@ -257,12 +256,7 @@ static NTSTATUS rpc_join_oldstyle_internals(const DOM_SID *domain_sid, struct cl E_md4hash(trust_passwd, 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; + return trust_pw_change_and_store_it(cli, mem_ctx, orig_trust_passwd_hash); } /** @@ -325,7 +319,7 @@ int net_rpc_join(int argc, const char **argv) /** * display info about a rpc domain * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -345,9 +339,6 @@ 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, @@ -370,7 +361,6 @@ 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); @@ -397,53 +387,6 @@ 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); -} /****************************************************************************/ @@ -463,7 +406,7 @@ static int rpc_user_usage(int argc, const char **argv) /** * Add a new user to a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid acquired from the remote server @@ -551,7 +494,7 @@ static int rpc_user_add(int argc, const char **argv) /** * Delete a user from a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid acquired from the remote server @@ -652,7 +595,7 @@ static int rpc_user_delete(int argc, const char **argv) /** * List user's groups on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid acquired from the remote server @@ -754,7 +697,7 @@ static int rpc_user_info(int argc, const char **argv) /** * List users on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -868,7 +811,7 @@ static int rpc_group_usage(int argc, const char **argv) /** * List groups on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid acquired from the remote server @@ -1011,7 +954,7 @@ static int rpc_share_usage(int argc, const char **argv) /** * Add a share on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -1059,7 +1002,7 @@ static int rpc_share_add(int argc, const char **argv) /** * Delete a share on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -1127,7 +1070,7 @@ static void display_share_info_1(SRV_SHARE_INFO_1 *info1) /** * List shares on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -1204,7 +1147,7 @@ static int rpc_file_usage(int argc, const char **argv) /** * Close a file on a remote RPC server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -1267,7 +1210,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 parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid acquired from the remote server @@ -1371,7 +1314,7 @@ int net_rpc_file(int argc, const char **argv) /** * ABORT the shutdown of a remote RPC Server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters 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 @@ -1419,7 +1362,7 @@ static int rpc_shutdown_abort(int argc, const char **argv) /** * Shut down a remote RPC Server * - * All parameters are provided by the run_rpc_command function, except for + * All paramaters are provided by the run_rpc_command funcion, except for * argc, argv which are passes through. * * @param domain_sid The domain sid aquired from the remote server @@ -1971,12 +1914,6 @@ 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)); @@ -2081,8 +2018,6 @@ 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 */ @@ -2148,7 +2083,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)) - return False; + goto done; ZERO_STRUCT(cli); if (cli_initialise(&cli) == False) @@ -2185,13 +2120,12 @@ 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\ttests that a join is valid\n"); + d_printf(" net rpc testjoin \t\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"); @@ -2258,9 +2192,6 @@ 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 b08095f1cc..c8be93c39c 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -49,7 +49,6 @@ 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))) { @@ -76,7 +75,7 @@ int net_rpc_join_ok(const char *domain) CHECK_RPC_ERR(cli_nt_setup_creds(cli, channel, - stored_md4_trust_password, &neg_flags, 2), + stored_md4_trust_password), "error in domain join verification"); retval = 0; /* Success! */ diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 7c61e6d8be..51dbbb98c0 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -508,17 +508,6 @@ 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) + @@ -555,7 +544,7 @@ int main (int argc, char **argv) /* the lowest bit options are always accepted */ checkparms = setparms & ~MASK_ALWAYS_GOOD; - /* account policy operations */ + /* accoun tpolicy 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 5401755376..2d78b21dcc 100644 --- a/source3/utils/smbcontrol.c +++ b/source3/utils/smbcontrol.c @@ -42,7 +42,6 @@ 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} }; @@ -554,10 +553,6 @@ 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 75a4319cb9..98993676c9 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_pw; + static fstring new_passwd; size_t len; - ZERO_ARRAY(new_pw); + ZERO_ARRAY(new_passwd); /* * 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_pw, sizeof(new_pw), stdin) != NULL) { - if ((len = strlen(new_pw)) > 0) { - if(new_pw[len-1] == '\n') - new_pw[len - 1] = 0; + 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; } } - return(new_pw); + return(new_passwd); } @@ -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_pw; + fstring new_passwd; - ZERO_ARRAY(new_pw); + ZERO_ARRAY(new_passwd); p = get_pass("New SMB password:", stdin_get); - fstrcpy(new_pw, p); + fstrcpy(new_passwd, p); SAFE_FREE(p); p = get_pass("Retype new SMB password:", stdin_get); - if (strcmp(p, new_pw)) { + if (strcmp(p, new_passwd)) { fprintf(stderr, "Mismatch - password unchanged.\n"); - ZERO_ARRAY(new_pw); + ZERO_ARRAY(new_passwd); 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_mach, char *username, - char *old_passwd, char *new_pw, int local_flags) +static BOOL password_change(const char *remote_machine, char *user_name, + char *old_passwd, char *new_passwd, int local_flags) { BOOL ret; pstring err_str; pstring msg_str; - if (remote_mach != NULL) { + if (remote_machine != 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_mach, username, - old_passwd, new_pw, err_str, sizeof(err_str)); + ret = remote_password_change(remote_machine, user_name, + old_passwd, new_passwd, err_str, sizeof(err_str)); if(*err_str) fprintf(stderr, err_str); return ret; } - ret = local_password_change(username, local_flags, new_pw, + ret = local_password_change(user_name, local_flags, new_passwd, 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 d87497f2fa..0b0c591cb1 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -146,7 +146,6 @@ 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; @@ -483,9 +482,6 @@ 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; } @@ -553,9 +549,7 @@ 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 d48cecba47..3086019467 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 always be set to 'true'.\n"); + printf("ERROR: in 'security=domain' mode the 'encrypt passwords' parameter must also 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, const char *argv[]) +int main(int argc, char *argv[]) { extern char *optarg; extern int optind; @@ -185,19 +185,17 @@ int main(int argc, const 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, argv, long_options, - POPT_CONTEXT_KEEP_FIRST); + pc = poptGetContext(NULL, argc, (const char **) argv, long_options, + POPT_CONTEXT_KEEP_FIRST); while((opt = poptGetNextOpt(pc)) != -1); @@ -278,7 +276,7 @@ int main(int argc, const char *argv[]) fflush(stdout); getc(stdin); } - lp_dump(stdout, show_defaults, lp_numservices()); + lp_dump(stdout,True, lp_numservices()); } if(cname && caddr){ |