Copyright (C) 2001 Remus Koos (remuskoos@yahoo.com)
Copyright (C) 2002 Jim McDonough (jmcd@us.ibm.com)
Copyright (C) 2006 Gerald (Jerry) Carter (jerry@samba.org)
+ Copyright (C) 2008 Guenther Deschner (gd@samba.org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
goto done; \
}
-static void init_lsa_String(struct lsa_String *name, const char *s)
-{
- name->string = s;
-}
-
/*******************************************************************
Leave an AD domain. Windows XP disables the machine account.
We'll try the same. The old code would do an LDAP delete.
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
char *acct_name;
uint32 user_rid;
- SAM_USERINFO_CTR ctr;
- SAM_USER_INFO_16 p16;
struct lsa_String lsa_acct_name;
struct samr_Ids user_rids;
struct samr_Ids name_types;
}
/* now disable and setuser info */
-
- ZERO_STRUCT(ctr);
- ctr.switch_value = 16;
- ctr.info.id16 = &p16;
- p16.acb_info = info->info16.acct_flags | ACB_DISABLED;
+ info->info16.acct_flags |= ACB_DISABLED;
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
- &cli->user_session_key, &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 16,
+ info);
rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);
uint32 user_rid;
uint32 acb_info = ACB_WSTRUST;
uint32 acct_flags;
- uint32 fields_present;
uchar pwbuf[532];
- SAM_USERINFO_CTR ctr;
- SAM_USER_INFO_25 p25;
- const int infolevel = 25;
struct MD5Context md5ctx;
uchar md5buffer[16];
DATA_BLOB digested_session_key;
uint32_t access_granted = 0;
struct samr_Ids user_rids;
struct samr_Ids name_types;
+ union samr_UserInfo info;
/* Open the domain */
}
/* Set password and account flags on machine account */
+ ZERO_STRUCT(info.info25);
+ info.info25.info.fields_present = ACCT_NT_PWD_SET |
+ ACCT_LM_PWD_SET |
+ SAMR_FIELD_ACCT_FLAGS;
+ info.info25.info.acct_flags = acb_info;
+ memcpy(&info.info25.password.data, pwbuf, sizeof(pwbuf));
- ZERO_STRUCT(ctr);
- ZERO_STRUCT(p25);
-
- fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET |
- SAMR_FIELD_ACCT_FLAGS;
- init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf);
- ctr.switch_value = infolevel;
- ctr.info.id25 = &p25;
-
- status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
- infolevel, &cli->user_session_key, &ctr);
+ status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,
+ &user_pol,
+ 25,
+ &info);
if ( !NT_STATUS_IS_OK(status) ) {
d_fprintf( stderr, "Failed to set password for machine account (%s)\n",