svn commit: samba r15971 - in branches/SAMBA_3_0/source: . utils
idra at samba.org
idra at samba.org
Tue May 30 22:10:14 GMT 2006
Author: idra
Date: 2006-05-30 22:10:09 +0000 (Tue, 30 May 2006)
New Revision: 15971
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15971
Log:
Obey the manpage description and make changesecretpw accept a password via stdin
Modified:
branches/SAMBA_3_0/source/Makefile.in
branches/SAMBA_3_0/source/utils/net.c
Changeset:
Modified: branches/SAMBA_3_0/source/Makefile.in
===================================================================
--- branches/SAMBA_3_0/source/Makefile.in 2006-05-30 20:23:55 UTC (rev 15970)
+++ branches/SAMBA_3_0/source/Makefile.in 2006-05-30 22:10:09 UTC (rev 15971)
@@ -577,7 +577,8 @@
utils/net_status.o utils/net_rpc_printer.o utils/net_rpc_rights.o \
utils/net_rpc_service.o utils/net_rpc_registry.o utils/net_usershare.o \
utils/netlookup.o utils/net_sam.o utils/net_rpc_shell.o \
- utils/net_util.o utils/net_rpc_sh_acct.o utils/net_rpc_audit.o
+ utils/net_util.o utils/net_rpc_sh_acct.o utils/net_rpc_audit.o \
+ utils/passwd_util.o
NET_OBJ = $(NET_OBJ1) $(PARAM_OBJ) $(SECRETS_OBJ) $(LIBSMB_OBJ) \
$(RPC_PARSE_OBJ) $(PASSDB_OBJ) $(GROUPDB_OBJ) \
Modified: branches/SAMBA_3_0/source/utils/net.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net.c 2006-05-30 20:23:55 UTC (rev 15970)
+++ branches/SAMBA_3_0/source/utils/net.c 2006-05-30 22:10:09 UTC (rev 15971)
@@ -65,6 +65,7 @@
int opt_long_list_entries = 0;
int opt_reboot = 0;
int opt_force = 0;
+int opt_stdin = 0;
int opt_port = 0;
int opt_verbose = 0;
int opt_maxusers = -1;
@@ -496,13 +497,24 @@
return net_rpc_changetrustpw(argc, argv);
}
+static void set_line_buffering(FILE *f)
+{
+ setvbuf(f, NULL, _IOLBF, 0);
+}
+
static int net_changesecretpw(int argc, const char **argv)
{
char *trust_pw;
uint32 sec_channel_type = SEC_CHAN_WKSTA;
if(opt_force) {
- trust_pw = getpass("Enter machine password: ");
+ if (opt_stdin) {
+ set_line_buffering(stdin);
+ set_line_buffering(stdout);
+ set_line_buffering(stderr);
+ }
+
+ trust_pw = get_pass("Enter machine password: ", opt_stdin);
if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) {
d_fprintf(stderr, "Unable to write the machine account password in the secrets database");
@@ -856,6 +868,7 @@
{"long", 'l', POPT_ARG_NONE, &opt_long_list_entries},
{"reboot", 'r', POPT_ARG_NONE, &opt_reboot},
{"force", 'f', POPT_ARG_NONE, &opt_force},
+ {"stdin", 'i', POPT_ARG_NONE, &opt_stdin},
{"timeout", 't', POPT_ARG_INT, &opt_timeout},
{"machine-pass",'P', POPT_ARG_NONE, &opt_machine_pass},
{"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup},
More information about the samba-cvs
mailing list