summaryrefslogtreecommitdiff
path: root/source4/libnet/libnet_user.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-10-02 05:53:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:20:29 -0500
commit89e4387a08fd90176161d0139ed3b4c3c2c1289c (patch)
tree9973d30909c924d1659386de08d5393f3beb83f2 /source4/libnet/libnet_user.c
parentc4f106c4148965a6cb302d2d1dff730058fe5fc4 (diff)
downloadsamba-89e4387a08fd90176161d0139ed3b4c3c2c1289c.tar.gz
samba-89e4387a08fd90176161d0139ed3b4c3c2c1289c.tar.bz2
samba-89e4387a08fd90176161d0139ed3b4c3c2c1289c.zip
r19024: remove read-only and policy dependent fields and flags
from user modify routines. rafal (This used to be commit 7ca0d3dbcb9193c0f023e7c43764c7557925bb0e)
Diffstat (limited to 'source4/libnet/libnet_user.c')
-rw-r--r--source4/libnet/libnet_user.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/source4/libnet/libnet_user.c b/source4/libnet/libnet_user.c
index c06000481f..1bb767a34a 100644
--- a/source4/libnet/libnet_user.c
+++ b/source4/libnet/libnet_user.c
@@ -569,21 +569,6 @@ static NTSTATUS set_user_changes(TALLOC_CTX *mem_ctx, struct usermod_change *mod
/* profile path change */
SET_FIELD_LSA_STRING(r->in, user, mod, profile_path, USERMOD_FIELD_PROFILE_PATH);
- /* allow password change time */
- SET_FIELD_NTTIME(r->in, user, mod, allow_password_change, USERMOD_FIELD_ALLOW_PASS_CHG);
-
- /* force password change time */
- SET_FIELD_NTTIME(r->in, user, mod, force_password_change, USERMOD_FIELD_FORCE_PASS_CHG);
-
- /* last logon change time */
- SET_FIELD_NTTIME(r->in, user, mod, last_logon, USERMOD_FIELD_LAST_LOGON);
-
- /* last logoff change time */
- SET_FIELD_NTTIME(r->in, user, mod, last_logoff, USERMOD_FIELD_LAST_LOGOFF);
-
- /* last password change time */
- SET_FIELD_NTTIME(r->in, user, mod, last_password_change, USERMOD_FIELD_LAST_PASS_CHG);
-
/* account expiry change */
SET_FIELD_NTTIME(r->in, user, mod, acct_expiry, USERMOD_FIELD_ACCT_EXPIRY);
@@ -629,6 +614,7 @@ NTSTATUS libnet_ModifyUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
struct user_info_state {
struct libnet_context *ctx;
const char *domain_name;
+ const char *user_name;
struct libnet_LookupName lookup;
struct libnet_DomainOpen domopen;
struct libnet_rpc_userinfo userinfo;
@@ -639,7 +625,7 @@ struct user_info_state {
static void continue_name_found(struct composite_context *ctx);
-static void continue_domain_opened(struct composite_context *ctx);
+static void continue_domain_open_info(struct composite_context *ctx);
static void continue_info_received(struct composite_context *ctx);
@@ -650,6 +636,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
{
struct composite_context *c;
struct user_info_state *s;
+ struct composite_context *prereq_ctx;
struct composite_context *lookup_req;
c = composite_create(mem_ctx, ctx->event_ctx);
@@ -663,9 +650,14 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
s->monitor_fn = monitor;
s->ctx = ctx;
s->domain_name = talloc_strdup(c, r->in.domain_name);
+ s->user_name = talloc_strdup(c, r->in.user_name);
+
+ prereq_ctx = domain_opened(ctx, s->domain_name, c, &s->domopen,
+ continue_domain_open_info, monitor);
+ if (prereq_ctx) return prereq_ctx;
s->lookup.in.domain_name = s->domain_name;
- s->lookup.in.name = talloc_strdup(c, r->in.user_name);
+ s->lookup.in.name = s->user_name;
lookup_req = libnet_LookupName_send(ctx, c, &s->lookup, s->monitor_fn);
if (composite_nomem(lookup_req, c)) return c;
@@ -675,35 +667,32 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
}
-static void continue_name_found(struct composite_context *ctx)
+static void continue_domain_open_info(struct composite_context *ctx)
{
struct composite_context *c;
struct user_info_state *s;
- struct composite_context *domopen_req;
+ struct composite_context *lookup_req;
+ struct monitor_msg msg;
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct user_info_state);
- c->status = libnet_LookupName_recv(ctx, c, &s->lookup);
+ c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domopen);
if (!composite_is_ok(c)) return;
+
+ if (s->monitor_fn) s->monitor_fn(&msg);
- if (s->lookup.out.sid_type != SID_NAME_USER) {
- composite_error(c, NT_STATUS_NO_SUCH_USER);
- return;
- }
-
- s->domopen.in.type = DOMAIN_SAMR;
- s->domopen.in.domain_name = s->domain_name;
- s->domopen.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
+ s->lookup.in.domain_name = s->domain_name;
+ s->lookup.in.name = s->user_name;
- domopen_req = libnet_DomainOpen_send(s->ctx, &s->domopen, s->monitor_fn);
- if (composite_nomem(domopen_req, c)) return;
+ lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn);
+ if (composite_nomem(lookup_req, c)) return;
- composite_continue(c, domopen_req, continue_domain_opened, c);
+ composite_continue(c, lookup_req, continue_rpc_userinfo, c);
}
-static void continue_domain_opened(struct composite_context *ctx)
+static void continue_name_found(struct composite_context *ctx)
{
struct composite_context *c;
struct user_info_state *s;
@@ -712,9 +701,14 @@ static void continue_domain_opened(struct composite_context *ctx)
c = talloc_get_type(ctx->async.private_data, struct composite_context);
s = talloc_get_type(c->private_data, struct user_info_state);
- c->status = libnet_DomainOpen_recv(ctx, s->ctx, c, &s->domopen);
+ c->status = libnet_LookupName_recv(ctx, c, &s->lookup);
if (!composite_is_ok(c)) return;
+ if (s->lookup.out.sid_type != SID_NAME_USER) {
+ composite_error(c, NT_STATUS_NO_SUCH_USER);
+ return;
+ }
+
s->userinfo.in.domain_handle = s->ctx->samr.handle;
s->userinfo.in.sid = s->lookup.out.sidstr;
s->userinfo.in.level = 21;