summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-04-27 14:39:02 +0200
committerGünther Deschner <gd@samba.org>2009-04-28 12:16:38 +0200
commit09ec85715b0e99740156ebb7213eddd1edfea631 (patch)
tree7aea66402c3f652e442421c3ab1a6f43a0d24b92 /source3
parent251c220f91681a9e39452eba860d38e73ec719a4 (diff)
downloadsamba-09ec85715b0e99740156ebb7213eddd1edfea631.tar.gz
samba-09ec85715b0e99740156ebb7213eddd1edfea631.tar.bz2
samba-09ec85715b0e99740156ebb7213eddd1edfea631.zip
s3-net: make sure to call libnetapi init functions at the top of "net rpc" command.
Without the initialization "net rpc password" will prompt twice for passwords and will not allow to define the name of the connection admin user. In the long run we should probably only have one place where to initialize libnetapi. Kai, please check. Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_rpc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 29e2f4f05d..c48eb3dfb5 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -7004,6 +7004,8 @@ int net_rpc_printer(struct net_context *c, int argc, const char **argv)
int net_rpc(struct net_context *c, int argc, const char **argv)
{
+ NET_API_STATUS status;
+
struct functable func[] = {
{
"audit",
@@ -7184,5 +7186,16 @@ int net_rpc(struct net_context *c, int argc, const char **argv)
},
{NULL, NULL, 0, NULL, NULL}
};
+
+ status = libnetapi_init(&c->netapi_ctx);
+ if (status != 0) {
+ return -1;
+ }
+ libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
+ libnetapi_set_password(c->netapi_ctx, c->opt_password);
+ if (c->opt_kerberos) {
+ libnetapi_set_use_kerberos(c->netapi_ctx);
+ }
+
return net_run_function(c, argc, argv, "net rpc", func);
}