summaryrefslogtreecommitdiffstats
path: root/source4/librpc/ndr/ndr_samr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-15 10:58:29 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-15 10:58:29 +0000
commite92419e2d35126f98af6c22fe5e0224421998aad (patch)
tree25b71827fbc7bdb25f76d6253d93c2ed378a9d13 /source4/librpc/ndr/ndr_samr.c
parent54ccb9c6a2510c3e76603459f09d911c1dc3354e (diff)
downloadsamba-e92419e2d35126f98af6c22fe5e0224421998aad.tar.gz
samba-e92419e2d35126f98af6c22fe5e0224421998aad.tar.xz
samba-e92419e2d35126f98af6c22fe5e0224421998aad.zip
added samr_UserInfo2 and samr_UserInfo3
(This used to be commit 5e852f694c039ae8bde3490be9e0c4959c1e93f0)
Diffstat (limited to 'source4/librpc/ndr/ndr_samr.c')
-rw-r--r--source4/librpc/ndr/ndr_samr.c141
1 files changed, 141 insertions, 0 deletions
diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c
index 95c38e70c18..e592a65de19 100644
--- a/source4/librpc/ndr/ndr_samr.c
+++ b/source4/librpc/ndr/ndr_samr.c
@@ -1159,6 +1159,80 @@ done:
return NT_STATUS_OK;
}
+static NTSTATUS ndr_pull_samr_UserInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo2 *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->comment));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->foo1));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->foo2));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->country_code));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->code_page));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->comment));
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo3 *r)
+{
+ uint32 _ptr_logon_hours;
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->username));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->full_name));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->Rid));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->primary_group_rid));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_directory));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->home_drive));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->logon_script));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->profile));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->workstations));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_logon));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_logoff));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->last_pwd_change));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->allow_pwd_change));
+ NDR_CHECK(ndr_pull_NTTIME(ndr, &r->max_storage));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->units_per_week));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_logon_hours));
+ if (_ptr_logon_hours) {
+ NDR_ALLOC(ndr, r->logon_hours);
+ } else {
+ r->logon_hours = NULL;
+ }
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->bad_pwd_count));
+ NDR_CHECK(ndr_pull_uint16(ndr, &r->num_logons));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->acct_flags));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->username));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->full_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_directory));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->home_drive));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->logon_script));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->profile));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->workstations));
+ if (r->logon_hours) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (1260 > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, 1260);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->logon_hours, 1260, sizeof(r->logon_hours[0]));
+ uint32 _offset, _length;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_offset));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_length));
+ if (_offset != 0) return ndr_pull_error(ndr, NDR_ERR_OFFSET, "Bad array offset 0x%08x", _offset);
+ if (_length > 1260 || _length != r->units_per_week/8) return ndr_pull_error(ndr, NDR_ERR_LENGTH, "Bad array length 0x%08x > size 0x%08x", _offset, 1260);
+ NDR_CHECK(ndr_pull_array_uint8(ndr, r->logon_hours, _length));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
static NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_UserInfo *r)
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
@@ -1168,6 +1242,14 @@ static NTSTATUS ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, uint
NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1));
break; }
+ case 2: {
+ NDR_CHECK(ndr_pull_samr_UserInfo2(ndr, NDR_SCALARS, &r->info2));
+ break; }
+
+ case 3: {
+ NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3));
+ break; }
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
}
@@ -1178,6 +1260,14 @@ buffers:
NDR_CHECK(ndr_pull_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1));
break;
+ case 2:
+ NDR_CHECK(ndr_pull_samr_UserInfo2(ndr, NDR_BUFFERS, &r->info2));
+ break;
+
+ case 3:
+ NDR_CHECK(ndr_pull_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3));
+ break;
+
default:
return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
}
@@ -1659,6 +1749,49 @@ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, struct sa
ndr->depth--;
}
+void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, struct samr_UserInfo2 *r)
+{
+ ndr_print_struct(ndr, name, "samr_UserInfo2");
+ ndr->depth++;
+ ndr_print_samr_Name(ndr, "comment", &r->comment);
+ ndr_print_uint32(ndr, "foo1", r->foo1);
+ ndr_print_uint32(ndr, "foo2", r->foo2);
+ ndr_print_uint16(ndr, "country_code", r->country_code);
+ ndr_print_uint16(ndr, "code_page", r->code_page);
+ ndr->depth--;
+}
+
+void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, struct samr_UserInfo3 *r)
+{
+ ndr_print_struct(ndr, name, "samr_UserInfo3");
+ ndr->depth++;
+ ndr_print_samr_Name(ndr, "username", &r->username);
+ ndr_print_samr_Name(ndr, "full_name", &r->full_name);
+ ndr_print_uint32(ndr, "Rid", r->Rid);
+ ndr_print_uint32(ndr, "primary_group_rid", r->primary_group_rid);
+ ndr_print_samr_Name(ndr, "home_directory", &r->home_directory);
+ ndr_print_samr_Name(ndr, "home_drive", &r->home_drive);
+ ndr_print_samr_Name(ndr, "logon_script", &r->logon_script);
+ ndr_print_samr_Name(ndr, "profile", &r->profile);
+ ndr_print_samr_Name(ndr, "workstations", &r->workstations);
+ ndr_print_NTTIME(ndr, "last_logon", r->last_logon);
+ ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff);
+ ndr_print_NTTIME(ndr, "last_pwd_change", r->last_pwd_change);
+ ndr_print_NTTIME(ndr, "allow_pwd_change", r->allow_pwd_change);
+ ndr_print_NTTIME(ndr, "max_storage", r->max_storage);
+ ndr_print_uint32(ndr, "units_per_week", r->units_per_week);
+ ndr_print_ptr(ndr, "logon_hours", r->logon_hours);
+ ndr->depth++;
+ if (r->logon_hours) {
+ ndr_print_array_uint8(ndr, "logon_hours", r->logon_hours, r->units_per_week/8);
+ }
+ ndr->depth--;
+ ndr_print_uint16(ndr, "bad_pwd_count", r->bad_pwd_count);
+ ndr_print_uint16(ndr, "num_logons", r->num_logons);
+ ndr_print_uint32(ndr, "acct_flags", r->acct_flags);
+ ndr->depth--;
+}
+
void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, uint16 level, union samr_UserInfo *r)
{
ndr_print_union(ndr, name, level, "samr_UserInfo");
@@ -1667,6 +1800,14 @@ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, uint16 lev
ndr_print_samr_UserInfo1(ndr, "info1", &r->info1);
break;
+ case 2:
+ ndr_print_samr_UserInfo2(ndr, "info2", &r->info2);
+ break;
+
+ case 3:
+ ndr_print_samr_UserInfo3(ndr, "info3", &r->info3);
+ break;
+
default:
ndr_print_bad_level(ndr, name, level);
}