diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-03-23 01:30:43 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:12 -0500 |
commit | 79f6bcd5ae1711075ce0e75392ce83a72766698e (patch) | |
tree | eb7928570c6843880253d0ce053957b1a17d0fcb /source4/lib/cmdline | |
parent | 9b48673ad9ed5cf2019df7111fe6ef89ad57573d (diff) | |
download | samba-79f6bcd5ae1711075ce0e75392ce83a72766698e.tar.gz samba-79f6bcd5ae1711075ce0e75392ce83a72766698e.tar.bz2 samba-79f6bcd5ae1711075ce0e75392ce83a72766698e.zip |
r5988: Fix the -P option (use machine account credentials) to use the Samba4
secrets system, and not the old system from Samba3.
This allowed the code from auth_domain to be shared - we now only
lookup the secrets.ldb in lib/credentials.c.
In order to link the resultant binary, samdb_search() has been moved
from deep inside rpc_server into lib/gendb.c, along with the existing
gendb_search_v(). The vast majority of this patch is the simple
rename that followed,
(Depending on the whole SAMDB for just this function seemed pointless,
and brought in futher dependencies, such as smbencrypt.c).
Andrew Bartlett
(This used to be commit e13c671619bd290a8b3cae8555cb281a9a185ee0)
Diffstat (limited to 'source4/lib/cmdline')
-rw-r--r-- | source4/lib/cmdline/config.mk | 2 | ||||
-rw-r--r-- | source4/lib/cmdline/popt_common.c | 21 |
2 files changed, 2 insertions, 21 deletions
diff --git a/source4/lib/cmdline/config.mk b/source4/lib/cmdline/config.mk index 803c81f273..831461b7f3 100644 --- a/source4/lib/cmdline/config.mk +++ b/source4/lib/cmdline/config.mk @@ -2,6 +2,6 @@ # Start SUBSYSTEM LIBCMDLINE_CREDENTIALS [SUBSYSTEM::LIBCMDLINE_CREDENTIALS] ADD_OBJ_FILES = lib/cmdline/getsmbpass.o \ - lib/cmdline/credentials.o + lib/cmdline/credentials.o # End SUBSYSTEM LIBCMDLINE_CREDENTIALS ############################## diff --git a/source4/lib/cmdline/popt_common.c b/source4/lib/cmdline/popt_common.c index 7049ce65df..50e07d95e9 100644 --- a/source4/lib/cmdline/popt_common.c +++ b/source4/lib/cmdline/popt_common.c @@ -213,26 +213,7 @@ static void popt_common_credentials_callback(poptContext con, case 'P': { - char *opt_password = NULL; - /* it is very useful to be able to make ads queries as the - machine account for testing purposes and for domain leave */ - - if (!secrets_init()) { - d_printf("ERROR: Unable to open secrets database\n"); - exit(1); - } - - opt_password = secrets_fetch_machine_password(lp_workgroup()); - - if (!opt_password) { - d_printf("ERROR: Unable to fetch machine password\n"); - exit(1); - } - cmdline_credentials->username = talloc_asprintf(cmdline_credentials, "%s$", lp_netbios_name()); - cmdline_credentials->username_obtained = CRED_SPECIFIED; - cli_credentials_set_password(cmdline_credentials, opt_password, CRED_SPECIFIED); - free(opt_password); - + cli_credentials_set_machine_account(cmdline_credentials); } /* machine accounts only work with kerberos */ |