int opt_have_ip = False;
struct sockaddr_storage opt_dest_ip;
bool smb_encrypt;
+struct libnetapi_ctx *netapi_ctx = NULL;
extern bool AllowDebugChange;
DEBUG(2,("return code = %d\n", rc));
- {
- struct libnetapi_ctx *ctx = NULL;
- libnetapi_getctx(&ctx);
- libnetapi_free(ctx);
- }
+ libnetapi_free(netapi_ctx);
TALLOC_FREE(frame);
return rc;
if (status != 0) {
d_fprintf(stderr, "Failed to add user '%s' with: %s.\n",
- argv[0], libnetapi_get_error_string(NULL, status));
+ argv[0], libnetapi_get_error_string(netapi_ctx, status));
return -1;
} else {
d_printf("Added user '%s'.\n", argv[0]);
if (status != 0) {
d_fprintf(stderr, "Failed to delete user '%s' with: %s.\n",
argv[0],
- libnetapi_get_error_string(NULL, status));
+ libnetapi_get_error_string(netapi_ctx, status));
return -1;
} else {
d_printf("Deleted user '%s'.\n", argv[0]);
int net_rpc_user(int argc, const char **argv)
{
- struct libnetapi_ctx *ctx = NULL;
NET_API_STATUS status;
struct functable func[] = {
{NULL, NULL}
};
- status = libnetapi_init(&ctx);
+ status = libnetapi_init(&netapi_ctx);
if (status != 0) {
return -1;
}
- libnetapi_set_username(ctx, opt_user_name);
- libnetapi_set_password(ctx, opt_password);
+ libnetapi_set_username(netapi_ctx, opt_user_name);
+ libnetapi_set_password(netapi_ctx, opt_password);
if (argc == 0) {
return run_rpc_command(NULL,PI_SAMR, 0,