int net_dom(struct net_context *c, int argc, const char **argv)
{
NET_API_STATUS status;
+ struct cli_credentials *creds = NULL;
struct functable func[] = {
{
{NULL, NULL, 0, NULL, NULL}
};
+ creds = net_context_creds(c, c);
+ if (creds == NULL) {
+ return -1;
+ }
+
status = libnetapi_net_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);
+ status = libnetapi_set_creds(c->netapi_ctx, creds);
+ if (status != 0) {
+ return -1;
}
return net_run_function(c, argc, argv, "net dom", func);