From 978eb313448fe9612db5491385a91dd3b67d0e97 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Mon, 14 Jan 2008 21:32:59 +0300 Subject: Fix crash in winbind clients: instead of talloc-based pointer we passed address of a local variable. (This used to be commit 0afd2153c7649e89d595cb7eff0f7b3c0b56ea15) --- source3/lib/winbind_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3cf068a6e0..14356b09cf 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -201,7 +201,7 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i Date: Tue, 15 Jan 2008 17:20:50 -0800 Subject: Port from ctdb: minor fix to transaction_write_existing: tridge. Jeremy. (This used to be commit 874425c8f680fb2f737b46a3177b239e69302af5) --- source3/lib/tdb/common/transaction.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c index 0ecfb9b7ff..ea0e3a93f3 100644 --- a/source3/lib/tdb/common/transaction.c +++ b/source3/lib/tdb/common/transaction.c @@ -316,25 +316,15 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, return 0; } - /* overwrite part of an existing block */ - if (buf == NULL) { - memset(tdb->transaction->blocks[blk] + off, 0, len); - } else { - memcpy(tdb->transaction->blocks[blk] + off, buf, len); - } - if (blk == tdb->transaction->num_blocks-1) { - if (len + off > tdb->transaction->last_block_size) { - tdb->transaction->last_block_size = len + off; - } + if (blk == tdb->transaction->num_blocks-1 && + off + len > tdb->transaction->last_block_size) { + len = tdb->transaction->last_block_size - off; } - return 0; + /* overwrite part of an existing block */ + memcpy(tdb->transaction->blocks[blk] + off, buf, len); -fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", - (blk*tdb->transaction->block_size) + off, len)); - tdb->transaction->transaction_error = 1; - return -1; + return 0; } -- cgit From 68694369fc96354452979b07425f3f48c4f73bbe Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:09:48 +0300 Subject: Merge CTDB-related fixes from samba-ctdb 3.0 branch (http://samba.org/~tridge/3_0-ctdb) Signed-off-by: Alexander Bokovoy (This used to be commit 0c8e23afbbb2d081fc23908bafcad04650bfacea) --- source3/include/ctdbd_conn.h | 6 ++ source3/include/dbwrap.h | 1 + source3/lib/conn_tdb.c | 2 +- source3/lib/ctdbd_conn.c | 36 +++++++++ source3/lib/dbwrap.c | 12 ++- source3/lib/dbwrap_ctdb.c | 178 ++++++++++++++++++++++++++----------------- source3/lib/dbwrap_file.c | 5 +- source3/lib/dbwrap_tdb.c | 21 ++--- source3/lib/dbwrap_util.c | 90 ++++++++++++++++++++++ source3/lib/messages_ctdbd.c | 4 + source3/lib/util.c | 13 ++++ source3/locking/brlock.c | 29 +++---- source3/smbd/connection.c | 9 +++ source3/smbd/oplock_linux.c | 22 ++++-- source3/smbd/server.c | 67 +++++++++++++++- 15 files changed, 387 insertions(+), 108 deletions(-) create mode 100644 source3/lib/dbwrap_util.c diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h index 425cc65a00..6e1b2f737a 100644 --- a/source3/include/ctdbd_conn.h +++ b/source3/include/ctdbd_conn.h @@ -17,6 +17,9 @@ along with this program. If not, see . */ +#ifndef _CTDBD_CONN_H +#define _CTDBD_CONN_H + struct ctdbd_connection; NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx, @@ -62,3 +65,6 @@ NTSTATUS ctdbd_register_ips(struct ctdbd_connection *conn, NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn); +NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data); + +#endif /* _CTDBD_CONN_H */ diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h index 3bb378c841..4eb174fef1 100644 --- a/source3/include/dbwrap.h +++ b/source3/include/dbwrap.h @@ -43,6 +43,7 @@ struct db_context { void *private_data); int (*get_seqnum)(struct db_context *db); void *private_data; + bool persistent; }; struct db_context *db_open(TALLOC_CTX *mem_ctx, diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c index dd0a354a85..22d85c873d 100644 --- a/source3/lib/conn_tdb.c +++ b/source3/lib/conn_tdb.c @@ -34,7 +34,7 @@ static struct db_context *connections_db_ctx(bool rw) } else { db_ctx = db_open(NULL, lock_path("connections.tdb"), 0, - TDB_DEFAULT, O_RDONLY, 0); + TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDONLY, 0); } return db_ctx; diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 899bbcfcce..18e9879601 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -1203,6 +1203,42 @@ NTSTATUS ctdbd_register_reconfigure(struct ctdbd_connection *conn) return register_with_ctdbd(conn, CTDB_SRVID_RECONFIGURE); } +/* + persstent store. Used when we update a record in a persistent database + */ +NTSTATUS ctdbd_persistent_store(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key, TDB_DATA data) +{ + int cstatus=0; + struct ctdb_rec_data *rec; + TDB_DATA recdata; + size_t length; + NTSTATUS status; + + length = offsetof(struct ctdb_rec_data, data) + key.dsize + data.dsize; + + rec = (struct ctdb_rec_data *)talloc_size(conn, length); + NT_STATUS_HAVE_NO_MEMORY(rec); + + rec->length = length; + rec->reqid = db_id; + rec->keylen = key.dsize; + rec->datalen= data.dsize; + memcpy(&rec->data[0], key.dptr, key.dsize); + memcpy(&rec->data[key.dsize], data.dptr, data.dsize); + + recdata.dptr = (uint8_t *)rec; + recdata.dsize = length; + + status = ctdbd_control(conn, CTDB_CURRENT_NODE, + CTDB_CONTROL_PERSISTENT_STORE, + 0, recdata, NULL, NULL, &cstatus); + if (cstatus != 0) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + return status; +} + + #else NTSTATUS ctdbd_init_connection(TALLOC_CTX *mem_ctx, diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 4e16d18682..001424a6c0 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -20,7 +20,9 @@ */ #include "includes.h" - +#ifdef CLUSTER_SUPPORT +#include "ctdb_private.h" +#endif /* * Fall back using fetch_locked if no genuine fetch operation is provided */ @@ -46,10 +48,16 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, int open_flags, mode_t mode) { struct db_context *result = NULL; +#ifdef CLUSTER_SUPPORT + const char *sockname = lp_ctdbd_socket(); +#endif #ifdef CLUSTER_SUPPORT + if(!sockname || !*sockname) { + sockname = CTDB_PATH; + } - if (lp_clustering()) { + if (lp_clustering() && socket_exist(sockname)) { const char *partname; /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index 90d0b260c5..f497f871d2 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -18,16 +18,14 @@ */ #include "includes.h" - #ifdef CLUSTER_SUPPORT - #include "ctdb.h" #include "ctdb_private.h" +#include "ctdbd_conn.h" struct db_ctdb_ctx { struct tdb_wrap *wtdb; uint32 db_id; - struct ctdbd_connection *conn; }; struct db_ctdb_rec { @@ -35,8 +33,6 @@ struct db_ctdb_rec { struct ctdb_ltdb_header header; }; -static struct ctdbd_connection *db_ctdbd_conn(struct db_ctdb_ctx *ctx); - static NTSTATUS db_ctdb_store(struct db_record *rec, TDB_DATA data, int flag) { struct db_ctdb_rec *crec = talloc_get_type_abort( @@ -60,6 +56,42 @@ static NTSTATUS db_ctdb_store(struct db_record *rec, TDB_DATA data, int flag) return (ret == 0) ? NT_STATUS_OK : NT_STATUS_INTERNAL_DB_CORRUPTION; } + +/* for persistent databases the store is a bit different. We have to + ask the ctdb daemon to push the record to all nodes after the + store */ +static NTSTATUS db_ctdb_store_persistent(struct db_record *rec, TDB_DATA data, int flag) +{ + struct db_ctdb_rec *crec = talloc_get_type_abort( + rec->private_data, struct db_ctdb_rec); + TDB_DATA cdata; + int ret; + NTSTATUS status; + + cdata.dsize = sizeof(crec->header) + data.dsize; + + if (!(cdata.dptr = SMB_MALLOC_ARRAY(uint8, cdata.dsize))) { + return NT_STATUS_NO_MEMORY; + } + + crec->header.rsn++; + + memcpy(cdata.dptr, &crec->header, sizeof(crec->header)); + memcpy(cdata.dptr + sizeof(crec->header), data.dptr, data.dsize); + + ret = tdb_store(crec->ctdb_ctx->wtdb->tdb, rec->key, cdata, TDB_REPLACE); + status = (ret == 0) ? NT_STATUS_OK : NT_STATUS_INTERNAL_DB_CORRUPTION; + + /* now tell ctdbd to update this record on all other nodes */ + if (NT_STATUS_IS_OK(status)) { + status = ctdbd_persistent_store(messaging_ctdbd_connection(), crec->ctdb_ctx->db_id, rec->key, cdata); + } + + SAFE_FREE(cdata.dptr); + + return status; +} + static NTSTATUS db_ctdb_delete(struct db_record *rec) { struct db_ctdb_rec *crec = talloc_get_type_abort( @@ -110,6 +142,7 @@ static struct db_record *db_ctdb_fetch_locked(struct db_context *db, struct db_ctdb_rec *crec; NTSTATUS status; TDB_DATA ctdb_data; + int migrate_attempts = 0; if (!(result = talloc(mem_ctx, struct db_record))) { DEBUG(0, ("talloc failed\n")); @@ -153,7 +186,11 @@ again: return NULL; } - result->store = db_ctdb_store; + if (db->persistent) { + result->store = db_ctdb_store_persistent; + } else { + result->store = db_ctdb_store; + } result->delete_rec = db_ctdb_delete; talloc_set_destructor(result, db_ctdb_record_destr); @@ -175,12 +212,14 @@ again: tdb_chainunlock(ctx->wtdb->tdb, key); talloc_set_destructor(result, NULL); + migrate_attempts += 1; + DEBUG(10, ("ctdb_data.dptr = %p, dmaster = %u (%u)\n", ctdb_data.dptr, ctdb_data.dptr ? ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster : -1, get_my_vnn())); - status = ctdbd_migrate(db_ctdbd_conn(ctx), ctx->db_id, key); + status = ctdbd_migrate(messaging_ctdbd_connection(),ctx->db_id, key); if (!NT_STATUS_IS_OK(status)) { DEBUG(5, ("ctdb_migrate failed: %s\n", nt_errstr(status))); @@ -191,6 +230,11 @@ again: goto again; } + if (migrate_attempts > 10) { + DEBUG(0, ("db_ctdb_fetch_locked needed %d attempts\n", + migrate_attempts)); + } + memcpy(&crec->header, ctdb_data.dptr, sizeof(crec->header)); result->value.dsize = ctdb_data.dsize - sizeof(crec->header); @@ -226,10 +270,12 @@ static int db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, /* * See if we have a valid record and we are the dmaster. If so, we can * take the shortcut and just return it. + * we bypass the dmaster check for persistent databases */ if ((ctdb_data.dptr != NULL) && (ctdb_data.dsize >= sizeof(struct ctdb_ltdb_header)) && - ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster == get_my_vnn()) { + (db->persistent || + ((struct ctdb_ltdb_header *)ctdb_data.dptr)->dmaster == get_my_vnn())) { /* we are the dmaster - avoid the ctdb protocol op */ data->dsize = ctdb_data.dsize - sizeof(struct ctdb_ltdb_header); @@ -254,8 +300,7 @@ static int db_ctdb_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, SAFE_FREE(ctdb_data.dptr); /* we weren't able to get it locally - ask ctdb to fetch it for us */ - status = ctdbd_fetch(db_ctdbd_conn(ctx), ctx->db_id, key, mem_ctx, - data); + status = ctdbd_fetch(messaging_ctdbd_connection(),ctx->db_id, key, mem_ctx, data); if (!NT_STATUS_IS_OK(status)) { DEBUG(5, ("ctdbd_fetch failed: %s\n", nt_errstr(status))); return -1; @@ -283,6 +328,22 @@ static void traverse_callback(TDB_DATA key, TDB_DATA data, void *private_data) talloc_free(tmp_ctx); } +static int traverse_persistent_callback(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, + void *private_data) +{ + struct traverse_state *state = (struct traverse_state *)private_data; + struct db_record *rec; + TALLOC_CTX *tmp_ctx = talloc_new(state->db); + int ret = 0; + /* we have to give them a locked record to prevent races */ + rec = db_ctdb_fetch_locked(state->db, tmp_ctx, kbuf); + if (rec && rec->value.dsize > 0) { + ret = state->fn(rec, state->private_data); + } + talloc_free(tmp_ctx); + return ret; +} + static int db_ctdb_traverse(struct db_context *db, int (*fn)(struct db_record *rec, void *private_data), @@ -296,6 +357,13 @@ static int db_ctdb_traverse(struct db_context *db, state.fn = fn; state.private_data = private_data; + if (db->persistent) { + /* for persistent databases we don't need to do a ctdb traverse, + we can do a faster local traverse */ + return tdb_traverse(ctx->wtdb->tdb, traverse_persistent_callback, &state); + } + + ctdbd_traverse(ctx->db_id, traverse_callback, &state); return 0; } @@ -322,6 +390,27 @@ static void traverse_read_callback(TDB_DATA key, TDB_DATA data, void *private_da state->fn(&rec, state->private_data); } +static int traverse_persistent_callback_read(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf, + void *private_data) +{ + struct traverse_state *state = (struct traverse_state *)private_data; + struct db_record rec; + rec.key = kbuf; + rec.value = dbuf; + rec.store = db_ctdb_store_deny; + rec.delete_rec = db_ctdb_delete_deny; + rec.private_data = state->db; + + if (rec.value.dsize <= sizeof(struct ctdb_ltdb_header)) { + /* a deleted record */ + return 0; + } + rec.value.dsize -= sizeof(struct ctdb_ltdb_header); + rec.value.dptr += sizeof(struct ctdb_ltdb_header); + + return state->fn(&rec, state->private_data); +} + static int db_ctdb_traverse_read(struct db_context *db, int (*fn)(struct db_record *rec, void *private_data), @@ -335,6 +424,12 @@ static int db_ctdb_traverse_read(struct db_context *db, state.fn = fn; state.private_data = private_data; + if (db->persistent) { + /* for persistent databases we don't need to do a ctdb traverse, + we can do a faster local traverse */ + return tdb_traverse_read(ctx->wtdb->tdb, traverse_persistent_callback_read, &state); + } + ctdbd_traverse(ctx->db_id, traverse_read_callback, &state); return 0; } @@ -346,41 +441,6 @@ static int db_ctdb_get_seqnum(struct db_context *db) return tdb_get_seqnum(ctx->wtdb->tdb); } -/* - * Get the ctdbd connection for a database. If possible, re-use the messaging - * ctdbd connection - */ -static struct ctdbd_connection *db_ctdbd_conn(struct db_ctdb_ctx *ctx) -{ - struct ctdbd_connection *result; - - result = messaging_ctdbd_connection(); - - if (result != NULL) { - - if (ctx->conn == NULL) { - /* - * Someone has initialized messaging since we - * initialized our own connection, we don't need it - * anymore. - */ - TALLOC_FREE(ctx->conn); - } - - return result; - } - - if (ctx->conn == NULL) { - NTSTATUS status; - status = ctdbd_init_connection(ctx, &ctx->conn); - if (!NT_STATUS_IS_OK(status)) { - return NULL; - } - set_my_vnn(ctdbd_vnn(ctx->conn)); - } - - return ctx->conn; -} struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, const char *name, @@ -390,7 +450,6 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, struct db_context *result; struct db_ctdb_ctx *db_ctdb; char *db_path; - NTSTATUS status; if (!lp_clustering()) { DEBUG(10, ("Clustering disabled -- no ctdb\n")); @@ -409,20 +468,15 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, return NULL; } - db_ctdb->conn = NULL; - - status = ctdbd_db_attach(db_ctdbd_conn(db_ctdb), name, - &db_ctdb->db_id, tdb_flags); - - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0, ("ctdbd_db_attach failed for %s: %s\n", name, - nt_errstr(status))); + if (!NT_STATUS_IS_OK(ctdbd_db_attach(messaging_ctdbd_connection(),name, &db_ctdb->db_id, tdb_flags))) { + DEBUG(0, ("ctdbd_db_attach failed for %s\n", name)); TALLOC_FREE(result); return NULL; } - db_path = ctdbd_dbpath(db_ctdbd_conn(db_ctdb), db_ctdb, - db_ctdb->db_id); + db_path = ctdbd_dbpath(messaging_ctdbd_connection(), db_ctdb, db_ctdb->db_id); + + result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); /* only pass through specific flags */ tdb_flags &= TDB_SEQNUM; @@ -447,16 +501,4 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, return result; } - -#else - -struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, - const char *name, - int hash_size, int tdb_flags, - int open_flags, mode_t mode) -{ - DEBUG(0, ("no clustering compiled in\n")); - return NULL; -} - #endif diff --git a/source3/lib/dbwrap_file.c b/source3/lib/dbwrap_file.c index 5b41f5941b..e3779de1e4 100644 --- a/source3/lib/dbwrap_file.c +++ b/source3/lib/dbwrap_file.c @@ -17,10 +17,6 @@ along with this program. If not, see . */ -/* - * Be aware that this is just sample code that has not seen too much testing - */ - #include "includes.h" struct db_file_ctx { @@ -367,6 +363,7 @@ struct db_context *db_open_file(TALLOC_CTX *mem_ctx, result->fetch_locked = db_file_fetch_locked; result->traverse = db_file_traverse; result->traverse_read = db_file_traverse; + result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); ctx->locked_record = NULL; if (!(ctx->dirname = talloc_strdup(ctx, name))) { diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index 710e45de6b..e87ceb428f 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -31,6 +31,11 @@ static int db_tdb_record_destr(struct db_record* data) struct db_tdb_ctx *ctx = talloc_get_type_abort(data->private_data, struct db_tdb_ctx); + /* This hex_encode() call allocates memory on data context. By way how current + __talloc_free() code works, it is OK to allocate in the destructor as + the children of data will be freed after call to the destructor and this + new 'child' will be caught and freed correctly. + */ DEBUG(10, (DEBUGLEVEL > 10 ? "Unlocking key %s\n" : "Unlocking key %.20s\n", hex_encode(data, (unsigned char *)data->key.dptr, @@ -88,8 +93,9 @@ static struct db_record *db_tdb_fetch_locked(struct db_context *db, struct tdb_fetch_locked_state state; int res; - if (DEBUGLEVEL >= 10) { - char *keystr = hex_encode(NULL, key.dptr, key.dsize); + /* Do not accidently allocate/deallocate w/o need when debug level is lower than needed */ + if(DEBUGLEVEL >= 10) { + char *keystr = hex_encode(NULL, (unsigned char*)key.dptr, key.dsize); DEBUG(10, (DEBUGLEVEL > 10 ? "Locking key %s\n" : "Locking key %.20s\n", keystr)); @@ -191,15 +197,9 @@ static NTSTATUS db_tdb_delete(struct db_record *rec) { struct db_tdb_ctx *ctx = talloc_get_type_abort(rec->private_data, struct db_tdb_ctx); - int res; - - res = tdb_delete(ctx->wtdb->tdb, rec->key); - if (res == 0) { - return NT_STATUS_OK; - } - - return map_nt_error_from_tdb(tdb_error(ctx->wtdb->tdb)); + return (tdb_delete(ctx->wtdb->tdb, rec->key) == 0) ? + NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; } struct db_tdb_traverse_ctx { @@ -318,6 +318,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, result->traverse = db_tdb_traverse; result->traverse_read = db_tdb_traverse_read; result->get_seqnum = db_tdb_get_seqnum; + result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); return result; fail: diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c new file mode 100644 index 0000000000..002d572019 --- /dev/null +++ b/source3/lib/dbwrap_util.c @@ -0,0 +1,90 @@ +/* + Unix SMB/CIFS implementation. + Utility functions for the dbwrap API + Copyright (C) Volker Lendecke 2007 + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" + +int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr) +{ + TDB_DATA dbuf; + int32 ret; + + if (db->fetch(db, NULL, string_term_tdb_data(keystr), &dbuf) != 0) { + return -1; + } + + if ((dbuf.dptr == NULL) || (dbuf.dsize != sizeof(int32_t))) { + TALLOC_FREE(dbuf.dptr); + return -1; + } + + ret = IVAL(dbuf.dptr, 0); + TALLOC_FREE(dbuf.dptr); + return ret; +} + +int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v) +{ + struct db_record *rec; + int32 v_store; + NTSTATUS status; + + rec = db->fetch_locked(db, NULL, string_term_tdb_data(keystr)); + if (rec == NULL) { + return -1; + } + + SIVAL(&v_store, 0, v); + + status = rec->store(rec, make_tdb_data((const uint8 *)&v_store, + sizeof(v_store)), + TDB_REPLACE); + TALLOC_FREE(rec); + return NT_STATUS_IS_OK(status) ? 0 : -1; +} + +uint32_t dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr, + uint32_t *oldval, uint32_t change_val) +{ + struct db_record *rec; + uint32 val = -1; + TDB_DATA data; + + if (!(rec = db->fetch_locked(db, NULL, + string_term_tdb_data(keystr)))) { + return -1; + } + + if ((rec->value.dptr != NULL) + && (rec->value.dsize == sizeof(val))) { + val = IVAL(rec->value.dptr, 0); + } + + val += change_val; + + data.dsize = sizeof(val); + data.dptr = (uint8 *)&val; + + rec->store(rec, data, TDB_REPLACE); + + TALLOC_FREE(rec); + + return 0; +} + diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c index 6e9b934a75..f1a02e6af9 100644 --- a/source3/lib/messages_ctdbd.c +++ b/source3/lib/messages_ctdbd.c @@ -22,6 +22,10 @@ #ifdef CLUSTER_SUPPORT #include "librpc/gen_ndr/messaging.h" +#include "ctdb.h" +#include "ctdb_private.h" +#include "ctdbd_conn.h" + struct messaging_ctdbd_context { struct ctdbd_connection *conn; diff --git a/source3/lib/util.c b/source3/lib/util.c index 0653fc9d3f..bc3eaa8d5e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -505,6 +505,19 @@ bool file_exist(const char *fname,SMB_STRUCT_STAT *sbuf) return((S_ISREG(sbuf->st_mode)) || (S_ISFIFO(sbuf->st_mode))); } +/******************************************************************* + Check if a unix domain socket exists - call vfs_file_exist for samba files. +********************************************************************/ + +bool socket_exist(const char *fname) +{ + SMB_STRUCT_STAT st; + if (sys_stat(fname,&st) != 0) + return(False); + + return S_ISSOCK(st.st_mode); +} + /******************************************************************* Check a files mod time. ********************************************************************/ diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index eb42d081fe..4191871bb1 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -41,11 +41,11 @@ static struct db_context *brlock_db; static void print_lock_struct(unsigned int i, struct lock_struct *pls) { - DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %s, ", + DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %u, ", i, (unsigned int)pls->context.smbpid, (unsigned int)pls->context.tid, - procid_str_static(&pls->context.pid) )); + (unsigned int)procid_to_pid(&pls->context.pid) )); DEBUG(10,("start = %.0f, size = %.0f, fnum = %d, %s %s\n", (double)pls->start, @@ -263,10 +263,9 @@ void brl_init(bool read_only) if (brlock_db) { return; } - brlock_db = db_open(NULL, lock_path("brlock.tdb"), 0, - TDB_DEFAULT - |TDB_VOLATILE - |(read_only?0x0:TDB_CLEAR_IF_FIRST), + brlock_db = db_open(NULL, lock_path("brlock.tdb"), + lp_open_files_db_hash_size(), + TDB_DEFAULT | TDB_CLEAR_IF_FIRST, read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 ); if (!brlock_db) { DEBUG(0,("Failed to open byte range locking database %s\n", @@ -1495,14 +1494,16 @@ static int traverse_fn(struct db_record *rec, void *state) } } - for ( i=0; ifn(*key, - locks[i].context.pid, - locks[i].lock_type, - locks[i].lock_flav, - locks[i].start, - locks[i].size, - cb->private_data); + if (cb->fn) { + for ( i=0; ifn(*key, + locks[i].context.pid, + locks[i].lock_type, + locks[i].lock_flav, + locks[i].start, + locks[i].size, + cb->private_data); + } } SAFE_FREE(locks); diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 016c8adb1b..d7063c9989 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -117,6 +117,15 @@ int count_current_connections( const char *sharename, bool clear ) return cs.curr_connections; } +/**************************************************************************** + Count the number of connections open across all shares. +****************************************************************************/ + +int count_all_current_connections(void) +{ + return count_current_connections(NULL, True /* clear stale entries */); +} + /**************************************************************************** Claim an entry in the connections database. ****************************************************************************/ diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c index 05021b6c74..fa7cb42bc6 100644 --- a/source3/smbd/oplock_linux.c +++ b/source3/smbd/oplock_linux.c @@ -93,17 +93,27 @@ static void set_capability(unsigned capability) return; } - data.effective |= (1< 0) { - remove_child_pid(pid); + while ((pid = sys_waitpid(-1, &status, WNOHANG)) > 0) { + bool unclean_shutdown = False; + + /* If the child terminated normally, assume + it was an unclean shutdown unless the + status is 0 + */ + if (WIFEXITED(status)) { + unclean_shutdown = WEXITSTATUS(status); + } + /* If the child terminated due to a signal + we always assume it was unclean. + */ + if (WIFSIGNALED(status)) { + unclean_shutdown = True; + } + remove_child_pid(pid, unclean_shutdown); } } @@ -603,6 +630,15 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ continue; } + + + /* If the idle timeout fired and we don't have any connected + * users, exit gracefully. We should be running under a process + * controller that will restart us if necessry. + */ + if (num == 0 && count_all_current_connections() == 0) { + exit_server_cleanly("idle timeout"); + } /* process pending nDNS responses */ if (dns_register_smbd_reply(dns_reg, &r_fds, &idle_timeout)) { @@ -906,6 +942,29 @@ void exit_server_fault(void) exit_server("critical server fault"); } + +/**************************************************************************** +received when we should release a specific IP +****************************************************************************/ +static void msg_release_ip(struct messaging_context *msg_ctx, void *private_data, + uint32_t msg_type, struct server_id server_id, DATA_BLOB *data) +{ + const char *ip = (const char *)data->data; + char addr[INET6_ADDRSTRLEN]; + + if (strcmp(client_socket_addr(get_client_fd(),addr,sizeof(addr)), ip) == 0) { + /* we can't afford to do a clean exit - that involves + database writes, which would potentially mean we + are still running after the failover has finished - + we have to get rid of this process ID straight + away */ + DEBUG(0,("Got release IP message for our IP %s - exiting immediately\n", + ip)); + _exit(0); + } +} + + /**************************************************************************** Initialise connect, service and file structs. ****************************************************************************/ @@ -1305,6 +1364,8 @@ extern void build_options(bool screen); /* register our message handlers */ messaging_register(smbd_messaging_context(), NULL, MSG_SMB_FORCE_TDIS, msg_force_tdis); + messaging_register(smbd_messaging_context(), NULL, + MSG_SMB_RELEASE_IP, msg_release_ip); if ((lp_keepalive() != 0) && !(event_add_idle(smbd_event_context(), NULL, -- cgit From d86fc3ec8c99aaa5ffaa14a97525154507c39df7 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:17:03 +0300 Subject: Add support for offline files support, remote storage, and Async I/O force operations to VFS Offline files support and remote storage are for allowing communication with backup and archiving tools that mark files moved to a tape library as offline. We translate this info into corresponding CIFS offline file attribute and mark an exported volume as remote storage. Async I/O force is to allow selective redirection of I/O operations to asynchronous processing in case it is viable at VFS module discretion. It is needed for proper handling of offline files as performing regular I/O on offline file will block smbd. Signed-off-by: Alexander Bokovoy (This used to be commit 875208724e39564fe81385dfe36e6c963e79e101) --- source3/include/vfs.h | 19 ++++++++++++ source3/include/vfs_macros.h | 18 +++++++++++ source3/modules/vfs_default.c | 42 +++++++++++++++++++++++++ source3/smbd/dmapi.c | 71 ++++++++++++++++++++++++------------------- source3/smbd/dosmode.c | 44 +++++++++++++-------------- source3/smbd/reply.c | 19 ++++++++---- source3/smbd/trans2.c | 23 +++++++++----- 7 files changed, 168 insertions(+), 68 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 0be3886227..be3cd91520 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -70,6 +70,7 @@ * timestamp resolition. JRA. */ /* Changed to version21 to add chflags operation -- jpeach */ /* Changed to version22 to add lchown operation -- jra */ +/* Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ /* Leave at 22 - not yet released. But change set_nt_acl to return an NTSTATUS. jra. */ /* Leave at 22 - not yet released. Add file_id_create operation. --metze */ /* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */ @@ -257,6 +258,12 @@ typedef enum _vfs_op_type { SMB_VFS_OP_AIO_ERROR, SMB_VFS_OP_AIO_FSYNC, SMB_VFS_OP_AIO_SUSPEND, + SMB_VFS_OP_AIO_FORCE, + + /* offline operations */ + SMB_VFS_OP_IS_OFFLINE, + SMB_VFS_OP_SET_OFFLINE, + SMB_VFS_OP_IS_REMOTESTORAGE, /* This should always be last enum value */ @@ -405,6 +412,12 @@ struct vfs_ops { int (*aio_error_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb); int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout); + bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); + + /* offline operations */ + int (*is_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); + int (*set_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); + bool (*is_remotestorage)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); } ops; @@ -526,6 +539,12 @@ struct vfs_ops { struct vfs_handle_struct *aio_error; struct vfs_handle_struct *aio_fsync; struct vfs_handle_struct *aio_suspend; + struct vfs_handle_struct *aio_force; + + /* offline operations */ + struct vfs_handle_struct *is_offline; + struct vfs_handle_struct *set_offline; + struct vfs_handle_struct *is_remotestorage; } handles; }; diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 9232e94a42..dbba781377 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -138,6 +138,12 @@ #define SMB_VFS_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs.ops.aio_error_fn((fsp)->conn->vfs.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs.ops.aio_fsync((fsp)->conn->vfs.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs.ops.aio_suspend((fsp)->conn->vfs.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(conn),(path),(sbuf),(offline))) +#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(conn),(path))) +#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(conn),(path))) /******************************************************************* Don't access conn->vfs_opaque.ops directly!!! @@ -257,6 +263,12 @@ #define SMB_VFS_OPAQUE_AIO_ERROR(fsp,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_error_fn((fsp)->conn->vfs_opaque.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_OPAQUE_AIO_FSYNC(fsp,op,aiocb) ((fsp)->conn->vfs_opaque.ops.aio_fsync((fsp)->conn->vfs_opaque.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_OPAQUE_AIO_SUSPEND(fsp,aiocb,n,ts) ((fsp)->conn->vfs_opaque.ops.aio_suspend((fsp)->conn->vfs_opaque.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(conn),(path),(sbuf),(offline))) +#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(conn),(path))) +#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(conn),(path))) /******************************************************************* Don't access handle->vfs_next.ops.* directly!!! @@ -377,5 +389,11 @@ #define SMB_VFS_NEXT_AIO_ERROR(handle,fsp,aiocb) ((handle)->vfs_next.ops.aio_error_fn((handle)->vfs_next.handles.aio_error,(fsp),(aiocb))) #define SMB_VFS_NEXT_AIO_FSYNC(handle,fsp,op,aiocb) ((handle)->vfs_next.ops.aio_fsync((handle)->vfs_next.handles.aio_fsync,(fsp),(op),(aiocb))) #define SMB_VFS_NEXT_AIO_SUSPEND(handle,fsp,aiocb,n,ts) ((handle)->vfs_next.ops.aio_suspend((handle)->vfs_next.handles.aio_suspend,(fsp),(aiocb),(n),(ts))) +#define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp))) + +/* Offline operations */ +#define SMB_VFS_NEXT_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_next.ops.is_offline((conn)->vfs_next.handles.is_offline,(conn),(path),(sbuf),(offline))) +#define SMB_VFS_NEXT_SET_OFFLINE(conn,path) ((conn)->vfs_next.ops.set_offline((conn)->vfs_next.handles.set_offline,(conn),(path))) +#define SMB_VFS_NEXT_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_next.ops.is_remotestorage((conn)->vfs_next.handles.is_remotestorage,(conn),(path))) #endif /* _VFS_MACROS_H */ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index e21136ccee..3e78c69a5e 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1225,6 +1225,38 @@ static int vfswrap_aio_suspend(struct vfs_handle_struct *handle, struct files_st return sys_aio_suspend(aiocb, n, timeout); } +static int vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + return False; +} + +static int vfswrap_is_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +{ + if (ISDOT(path) || ISDOTDOT(path)) { + return 1; + } + + if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) { + return -1; + } + + *offline = (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; + return 0; +} + +static int vfswrap_set_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) +{ + /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */ + return -1; +} + +static bool vfswrap_is_remotestorage(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) +{ + /* We don't know how to detect that volume is remote storage. VFS modules should redefine it. */ + return False; +} + + static vfs_op_tuple vfs_default_ops[] = { /* Disk operations */ @@ -1442,6 +1474,16 @@ static vfs_op_tuple vfs_default_ops[] = { {SMB_VFS_OP(vfswrap_aio_suspend),SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_aio_force), SMB_VFS_OP_AIO_FORCE, + SMB_VFS_LAYER_OPAQUE}, + + {SMB_VFS_OP(vfswrap_is_offline),SMB_VFS_OP_IS_OFFLINE, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE, + SMB_VFS_LAYER_OPAQUE}, + /* Finish VFS operations definition */ {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c index 05e9138ea9..620baf199e 100644 --- a/source3/smbd/dmapi.c +++ b/source3/smbd/dmapi.c @@ -46,7 +46,7 @@ bool dmapi_have_session(void) { return False; } #define DMAPI_SESSION_NAME "samba" #define DMAPI_TRACE 10 -static dm_sessid_t dmapi_session = DM_NO_SESSION; +static dm_sessid_t samba_dmapi_session = DM_NO_SESSION; /* Initialise the DMAPI interface. Make sure that we only end up initialising * once per process to avoid resource leaks across different DMAPI @@ -75,7 +75,7 @@ static int init_dmapi_service(void) bool dmapi_have_session(void) { - return dmapi_session != DM_NO_SESSION; + return samba_dmapi_session != DM_NO_SESSION; } static dm_sessid_t *realloc_session_list(dm_sessid_t * sessions, int count) @@ -110,7 +110,7 @@ int dmapi_init_session(void) */ SMB_WARN(getuid() == 0, "dmapi_init_session must be called as root"); - dmapi_session = DM_NO_SESSION; + samba_dmapi_session = DM_NO_SESSION; if (init_dmapi_service() < 0) { return -1; } @@ -139,7 +139,7 @@ retry: err = dm_query_session(sessions[i], sizeof(buf), buf, &buflen); buf[sizeof(buf) - 1] = '\0'; if (err == 0 && strcmp(DMAPI_SESSION_NAME, buf) == 0) { - dmapi_session = sessions[i]; + samba_dmapi_session = sessions[i]; DEBUGADD(DMAPI_TRACE, ("attached to existing DMAPI session " "named '%s'\n", buf)); @@ -150,16 +150,15 @@ retry: TALLOC_FREE(sessions); /* No session already defined. */ - if (dmapi_session == DM_NO_SESSION) { - err = dm_create_session(DM_NO_SESSION, - CONST_DISCARD(char *, - DMAPI_SESSION_NAME), - &dmapi_session); + if (samba_dmapi_session == DM_NO_SESSION) { + err = dm_create_session(DM_NO_SESSION, + CONST_DISCARD(char *, DMAPI_SESSION_NAME), + &samba_dmapi_session); if (err < 0) { DEBUGADD(DMAPI_TRACE, ("failed to create new DMAPI session: %s\n", strerror(errno))); - dmapi_session = DM_NO_SESSION; + samba_dmapi_session = DM_NO_SESSION; return -1; } @@ -185,22 +184,22 @@ static int reattach_dmapi_session(void) char buf[DM_SESSION_INFO_LEN]; size_t buflen; - if (dmapi_session != DM_NO_SESSION ) { + if (samba_dmapi_session != DM_NO_SESSION ) { become_root(); /* NOTE: On Linux, this call opens /dev/dmapi, costing us a * file descriptor. Ideally, we would close this when we fork. */ if (init_dmapi_service() < 0) { - dmapi_session = DM_NO_SESSION; + samba_dmapi_session = DM_NO_SESSION; unbecome_root(); return -1; } - if (dm_query_session(dmapi_session, sizeof(buf), + if (dm_query_session(samba_dmapi_session, sizeof(buf), buf, &buflen) < 0) { /* Session is stale. Disable DMAPI. */ - dmapi_session = DM_NO_SESSION; + samba_dmapi_session = DM_NO_SESSION; unbecome_root(); return -1; } @@ -214,33 +213,42 @@ static int reattach_dmapi_session(void) return 0; } -uint32 dmapi_file_flags(const char * const path) +/* If a DMAPI session has been initialised, then we need to make sure + * we are attached to it and have the correct privileges. This is + * necessary to be able to do DMAPI operations across a fork(2). If + * it fails, there is no likelihood of that failure being transient. + * + * Note that this use of the static attached flag relies on the fact + * that dmapi_file_flags() is never called prior to forking the + * per-client server process. + */ +const void * dmapi_get_current_session(void) { static int attached = 0; + if (dmapi_have_session() && !attached) { + attached++; + if (reattach_dmapi_session() < 0) { + return DM_NO_SESSION; + } + } + return &samba_dmapi_session; +} +uint32 dmapi_file_flags(const char * const path) +{ + dm_sessid_t dmapi_session; int err; dm_eventset_t events = {0}; uint nevents; - void *dm_handle; - size_t dm_handle_len; + void *dm_handle = NULL; + size_t dm_handle_len = 0; uint32 flags = 0; - /* If a DMAPI session has been initialised, then we need to make sure - * we are attached to it and have the correct privileges. This is - * necessary to be able to do DMAPI operations across a fork(2). If - * it fails, there is no liklihood of that failure being transient. - * - * Note that this use of the static attached flag relies on the fact - * that dmapi_file_flags() is never called prior to forking the - * per-client server process. - */ - if (dmapi_have_session() && !attached) { - attached++; - if (reattach_dmapi_session() < 0) { - return 0; - } + dmapi_session = *(dm_sessid_t*) dmapi_get_current_session(); + if (dmapi_session == DM_NO_SESSION) { + return 0; } /* AIX has DMAPI but no POSIX capablities support. In this case, @@ -313,4 +321,5 @@ done: return flags; } + #endif /* USE_DMAPI */ diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index d3813f9b41..2021621dfa 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -30,23 +30,6 @@ static int set_sparse_flag(const SMB_STRUCT_STAT * const sbuf) return 0; } -/**************************************************************************** - Work out whether this file is offline -****************************************************************************/ - -static uint32 set_offline_flag(connection_struct *conn, const char *const path) -{ - if (ISDOT(path) || ISDOTDOT(path)) { - return 0; - } - - if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) { - return 0; - } - - return dmapi_file_flags(path); -} - /**************************************************************************** Change a dos mode to a unix mode. Base permission for files: @@ -366,6 +349,8 @@ uint32 dos_mode_msdfs(connection_struct *conn, const char *path,SMB_STRUCT_STAT uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf) { uint32 result = 0; + bool offline; + int ret; DEBUG(8,("dos_mode: %s\n", path)); @@ -395,8 +380,10 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf) result |= dos_mode_from_sbuf(conn, path, sbuf); } - if (S_ISREG(sbuf->st_mode)) { - result |= set_offline_flag(conn, path); + + ret = SMB_VFS_IS_OFFLINE(conn, path, sbuf, &offline); + if (S_ISREG(sbuf->st_mode) && (ret == 0) && offline) { + result |= FILE_ATTRIBUTE_OFFLINE; } /* Optimization : Only call is_hidden_path if it's not already @@ -432,7 +419,7 @@ int file_set_dosmode(connection_struct *conn, const char *fname, int mask=0; mode_t tmp; mode_t unixmode; - int ret = -1; + int ret = -1, lret = -1; /* We only allow READONLY|HIDDEN|SYSTEM|DIRECTORY|ARCHIVE here. */ dosmode &= SAMBA_ATTRIBUTES_MASK; @@ -505,10 +492,21 @@ int file_set_dosmode(connection_struct *conn, const char *fname, unixmode |= (st->st_mode & (S_IWUSR|S_IWGRP|S_IWOTH)); } - if ((ret = SMB_VFS_CHMOD(conn,fname,unixmode)) == 0) { - if (!newfile) { + if (dosmode & FILE_ATTRIBUTE_OFFLINE) { + lret = SMB_VFS_SET_OFFLINE(conn, fname); + if (lret == -1) { + DEBUG(0, ("set_dos_mode: client has asked to set " + "FILE_ATTRIBUTE_OFFLINE to %s/%s but there was " + "an error while setting it or it is not supported.\n", + parent_dir, fname)); + } + } + + ret = SMB_VFS_CHMOD(conn, fname, unixmode); + if (ret == 0) { + if(!newfile || (lret != -1)) { notify_fname(conn, NOTIFY_ACTION_MODIFIED, - FILE_NOTIFY_CHANGE_ATTRIBUTES, fname); + FILE_NOTIFY_CHANGE_ATTRIBUTES, fname); } st->st_mode = unixmode; return 0; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index e2316ef120..381ddfe151 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3329,8 +3329,12 @@ void reply_read_and_X(struct smb_request *req) return; } - if (!big_readX - && schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) { + /* It is possible for VFS modules to selectively decide whether Async I/O should be used + for the file or not. + */ + if ((SMB_VFS_AIO_FORCE(fsp)) && + !big_readX && + schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) { END_PROFILE(SMBreadX); return; } @@ -4001,13 +4005,16 @@ void reply_write_and_X(struct smb_request *req) nwritten = 0; } else { - if (req->unread_bytes == 0 && - schedule_aio_write_and_X(conn, req, fsp, data, - startpos, numtowrite)) { + /* It is possible for VFS modules to selectively decide whether Async I/O + should be used for the file or not. + */ + if ((SMB_VFS_AIO_FORCE(fsp)) && (req->unread_bytes == 0) && + schedule_aio_write_and_X(conn, req, fsp, data, startpos, + numtowrite)) { END_PROFILE(SMBwriteX); return; } - + nwritten = write_file(req,fsp,data,startpos,numtowrite); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index bf6802f2a6..5729ab5349 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2373,8 +2373,8 @@ static void call_trans2qfsinfo(connection_struct *conn, const char *vname = volume_label(SNUM(conn)); int snum = SNUM(conn); char *fstype = lp_fstype(SNUM(conn)); - int quota_flag = 0; - + uint32 additional_flags = 0; + if (total_params < 2) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); return; @@ -2487,16 +2487,23 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi case SMB_QUERY_FS_ATTRIBUTE_INFO: case SMB_FS_ATTRIBUTE_INFORMATION: - + additional_flags = 0; #if defined(HAVE_SYS_QUOTAS) - quota_flag = FILE_VOLUME_QUOTAS; + additional_flags |= FILE_VOLUME_QUOTAS; #endif + if(lp_nt_acl_support(SNUM(conn))) { + additional_flags |= FILE_PERSISTENT_ACLS; + } + + if(SMB_VFS_IS_REMOTESTORAGE(conn, lp_pathname(SNUM(conn)))) { + additional_flags |= FILE_SUPPORTS_REMOTE_STORAGE; + additional_flags |= FILE_SUPPORTS_REPARSE_POINTS; + } + SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH| - (lp_nt_acl_support(SNUM(conn)) ? FILE_PERSISTENT_ACLS : 0)| - FILE_SUPPORTS_OBJECT_IDS| - FILE_UNICODE_ON_DISK| - quota_flag); /* FS ATTRIBUTES */ + FILE_SUPPORTS_OBJECT_IDS|FILE_UNICODE_ON_DISK| + additional_flags); /* FS ATTRIBUTES */ SIVAL(pdata,4,255); /* Max filename component length */ /* NOTE! the fstype must *not* be null terminated or win98 won't recognise it -- cgit From 313f7d10b884d083ef9488db739465c54c3f6515 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:18:57 +0300 Subject: Merge latest fixes to vfs_gpfs and NFS4 ACLs from Samba 3.0 CTDB branch (from http://samba.org/~tridge/3_0-ctdb) Signed-off-by: Alexander Bokovoy (This used to be commit 1daad835cbfb4615a8fe7a241f4d578f7e69f214) --- source3/modules/gpfs.c | 20 ++-- source3/modules/nfs4_acls.c | 187 +++++++++++++++++++++++------ source3/modules/vfs_gpfs.c | 281 +++++++++++++++++++++++++++++++++++--------- source3/modules/vfs_gpfs.h | 32 +++++ source3/smbd/posix_acls.c | 31 ++++- 5 files changed, 453 insertions(+), 98 deletions(-) create mode 100644 source3/modules/vfs_gpfs.h diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c index 300e90fa69..590dbac26f 100644 --- a/source3/modules/gpfs.c +++ b/source3/modules/gpfs.c @@ -22,9 +22,11 @@ #ifdef HAVE_GPFS #include "gpfs_gpl.h" +#include "vfs_gpfs.h" static void *libgpfs_handle = NULL; static bool gpfs_share_modes; +static bool gpfs_leases; static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny); static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType); @@ -42,7 +44,7 @@ bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, if (!gpfs_share_modes) { return True; } - + if (gpfs_set_share_fn == NULL) { return False; } @@ -88,7 +90,7 @@ int set_gpfs_lease(int fd, int leasetype) { int gpfs_type = GPFS_LEASE_NONE; - if (!gpfs_share_modes) { + if (!gpfs_leases) { return True; } @@ -103,6 +105,13 @@ int set_gpfs_lease(int fd, int leasetype) if (leasetype == F_WRLCK) { gpfs_type = GPFS_LEASE_WRITE; } + + /* we unconditionally set CAP_LEASE, rather than looking for + -1/EACCES as there is a bug in some versions of + libgpfs_gpl.so which results in a leaked fd on /dev/ss0 + each time we try this with the wrong capabilities set + */ + linux_set_lease_capability(); return gpfs_set_lease_fn(fd, gpfs_type); } @@ -172,11 +181,8 @@ void init_gpfs(void) goto failed; } - if (lp_parm_bool(-1, "gpfs", "sharemodes", True)) { - gpfs_share_modes = True; - } else { - gpfs_share_modes = False; - } + gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True); + gpfs_leases = lp_parm_bool(-1, "gpfs", "leases", True); return; diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index 52d3983fff..0c3d010dcd 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -20,6 +20,9 @@ #include "includes.h" #include "nfs4_acls.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_ACLS + #define SMBACL4_PARAM_TYPE_NAME "nfs4" #define SMB_ACE4_INT_MAGIC 0x76F8A967 @@ -352,6 +355,7 @@ typedef struct _smbacl4_vfs_params { enum smbacl4_mode_enum mode; bool do_chown; enum smbacl4_acedup_enum acedup; + struct db_context *sid_mapping_table; } smbacl4_vfs_params; /* @@ -451,8 +455,65 @@ static SMB_ACE4PROP_T *smbacl4_find_equal_special( return NULL; } -static int smbacl4_fill_ace4( +static bool nfs4_map_sid(smbacl4_vfs_params *params, const DOM_SID *src, + DOM_SID *dst) +{ + static struct db_context *mapping_db = NULL; + TDB_DATA data; + + if (mapping_db == NULL) { + const char *dbname = lp_parm_const_string( + -1, SMBACL4_PARAM_TYPE_NAME, "sidmap", NULL); + + if (dbname == NULL) { + DEBUG(10, ("%s:sidmap not defined\n", + SMBACL4_PARAM_TYPE_NAME)); + return False; + } + + become_root(); + mapping_db = db_open(NULL, dbname, 0, TDB_DEFAULT, + O_RDONLY, 0600); + unbecome_root(); + + if (mapping_db == NULL) { + DEBUG(1, ("could not open sidmap: %s\n", + strerror(errno))); + return False; + } + } + + if (mapping_db->fetch(mapping_db, NULL, + string_term_tdb_data(sid_string_tos(src)), + &data) == -1) { + DEBUG(10, ("could not find mapping for SID %s\n", + sid_string_dbg(src))); + return False; + } + + if ((data.dptr == NULL) || (data.dsize <= 0) + || (data.dptr[data.dsize-1] != '\0')) { + DEBUG(5, ("invalid mapping for SID %s\n", + sid_string_dbg(src))); + TALLOC_FREE(data.dptr); + return False; + } + + if (!string_to_sid(dst, (char *)data.dptr)) { + DEBUG(1, ("invalid mapping %s for SID %s\n", + (char *)data.dptr, sid_string_dbg(src))); + TALLOC_FREE(data.dptr); + return False; + } + + TALLOC_FREE(data.dptr); + + return True; +} + +static bool smbacl4_fill_ace4( TALLOC_CTX *mem_ctx, + const char *filename, smbacl4_vfs_params *params, uid_t ownerUID, gid_t ownerGID, @@ -460,11 +521,6 @@ static int smbacl4_fill_ace4( SMB_ACE4PROP_T *ace_v4 /* output */ ) { - const char *dom, *name; - enum lsa_SidType type; - uid_t uid; - gid_t gid; - DEBUG(10, ("got ace for %s\n", sid_string_dbg(&ace_nt->trustee))); memset(ace_v4, 0, sizeof(SMB_ACE4PROP_T)); @@ -485,18 +541,46 @@ static int smbacl4_fill_ace4( ace_v4->who.special_id = SMB_ACE4_WHO_EVERYONE; ace_v4->flags |= SMB_ACE4_ID_SPECIAL; } else { - if (!lookup_sid(mem_ctx, &ace_nt->trustee, &dom, &name, &type)) { - DEBUG(8, ("Could not find %s' type\n", - sid_string_dbg(&ace_nt->trustee))); - errno = EINVAL; - return -1; + const char *dom, *name; + enum lsa_SidType type; + uid_t uid; + gid_t gid; + DOM_SID sid; + + sid_copy(&sid, &ace_nt->trustee); + + if (!lookup_sid(mem_ctx, &sid, &dom, &name, &type)) { + + DOM_SID mapped; + + if (!nfs4_map_sid(params, &sid, &mapped)) { + DEBUG(1, ("nfs4_acls.c: file [%s]: SID %s " + "unknown\n", filename, sid_string_dbg(&sid))); + errno = EINVAL; + return False; + } + + DEBUG(2, ("nfs4_acls.c: file [%s]: mapped SID %s " + "to %s\n", filename, sid_string_dbg(&sid), sid_string_dbg(&mapped))); + + if (!lookup_sid(mem_ctx, &mapped, &dom, + &name, &type)) { + DEBUG(1, ("nfs4_acls.c: file [%s]: SID %s " + "mapped from %s is unknown\n", + filename, sid_string_dbg(&mapped), sid_string_dbg(&sid))); + errno = EINVAL; + return False; + } + + sid_copy(&sid, &mapped); } - + if (type == SID_NAME_USER) { - if (!sid_to_uid(&ace_nt->trustee, &uid)) { - DEBUG(2, ("Could not convert %s to uid\n", - sid_string_dbg(&ace_nt->trustee))); - return -1; + if (!sid_to_uid(&sid, &uid)) { + DEBUG(1, ("nfs4_acls.c: file [%s]: could not " + "convert %s to uid\n", filename, + sid_string_dbg(&sid))); + return False; } if (params->mode==e_special && uid==ownerUID) { @@ -506,11 +590,13 @@ static int smbacl4_fill_ace4( ace_v4->who.uid = uid; } } else { /* else group? - TODO check it... */ - if (!sid_to_gid(&ace_nt->trustee, &gid)) { - DEBUG(2, ("Could not convert %s to gid\n", - sid_string_dbg(&ace_nt->trustee))); - return -1; + if (!sid_to_gid(&sid, &gid)) { + DEBUG(1, ("nfs4_acls.c: file [%s]: could not " + "convert %s to gid\n", filename, + sid_string_dbg(&sid))); + return False; } + ace_v4->aceFlags |= SMB_ACE4_IDENTIFIER_GROUP; if (params->mode==e_special && gid==ownerGID) { @@ -522,7 +608,7 @@ static int smbacl4_fill_ace4( } } - return 0; /* OK */ + return True; /* OK */ } static int smbacl4_MergeIgnoreReject( @@ -560,6 +646,7 @@ static int smbacl4_MergeIgnoreReject( } static SMB4ACL_T *smbacl4_win2nfs4( + const char *filename, SEC_ACL *dacl, smbacl4_vfs_params *pparams, uid_t ownerUID, @@ -580,9 +667,14 @@ static SMB4ACL_T *smbacl4_win2nfs4( SMB_ACE4PROP_T ace_v4; bool addNewACE = True; - if (smbacl4_fill_ace4(mem_ctx, pparams, ownerUID, ownerGID, - dacl->aces + i, &ace_v4)) - return NULL; + if (!smbacl4_fill_ace4(mem_ctx, filename, pparams, + ownerUID, ownerGID, + dacl->aces + i, &ace_v4)) { + DEBUG(3, ("Could not fill ace for file %s, SID %s\n", + filename, + sid_string_dbg(&((dacl->aces+i)->trustee)))); + continue; + } if (pparams->acedup!=e_dontcare) { if (smbacl4_MergeIgnoreReject(pparams->acedup, acl, @@ -607,6 +699,7 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, bool result; SMB_STRUCT_STAT sbuf; + bool need_chown = False; uid_t newUID = (uid_t)-1; gid_t newGID = (gid_t)-1; @@ -635,25 +728,33 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, return status; } if (((newUID != (uid_t)-1) && (sbuf.st_uid != newUID)) || - ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) { - if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { - DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n", - fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, strerror(errno) )); - if (errno == EPERM) { - return NT_STATUS_INVALID_OWNER; + ((newGID != (gid_t)-1) && (sbuf.st_gid != newGID))) { + need_chown = True; + } + if (need_chown) { + if ((newUID == (uid_t)-1 || newUID == current_user.ut.uid)) { + if(try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { + DEBUG(3,("chown %s, %u, %u failed. Error = %s.\n", + fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, + strerror(errno))); + return map_nt_error_from_unix(errno); } - return map_nt_error_from_unix(errno); + + DEBUG(10,("chown %s, %u, %u succeeded.\n", + fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); + if (smbacl4_GetFileOwner(fsp->conn, fsp->fsp_name, &sbuf)) + return map_nt_error_from_unix(errno); + need_chown = False; + } else { /* chown is needed, but _after_ changing acl */ + sbuf.st_uid = newUID; /* OWNER@ in case of e_special */ + sbuf.st_gid = newGID; /* GROUP@ in case of e_special */ } - DEBUG(10,("chown %s, %u, %u succeeded.\n", - fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); - if (smbacl4_fGetFileOwner(fsp, &sbuf)) - return map_nt_error_from_unix(errno); } } if ((security_info_sent & DACL_SECURITY_INFORMATION)!=0 && psd->dacl!=NULL) { - acl = smbacl4_win2nfs4(psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); + acl = smbacl4_win2nfs4(fsp->fsp_name, psd->dacl, ¶ms, sbuf.st_uid, sbuf.st_gid); if (!acl) return map_nt_error_from_unix(errno); @@ -668,6 +769,20 @@ NTSTATUS smb_set_nt_acl_nfs4(files_struct *fsp, } else DEBUG(10, ("no dacl found; security_info_sent = 0x%x\n", security_info_sent)); + /* Any chown pending? */ + if (need_chown) { + DEBUG(3,("chown#2 %s. uid = %u, gid = %u.\n", + fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); + if (try_chown(fsp->conn, fsp->fsp_name, newUID, newGID)) { + DEBUG(2,("chown#2 %s, %u, %u failed. Error = %s.\n", + fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID, + strerror(errno))); + return map_nt_error_from_unix(errno); + } + DEBUG(10,("chown#2 %s, %u, %u succeeded.\n", + fsp->fsp_name, (unsigned int)newUID, (unsigned int)newGID)); + } + DEBUG(10, ("smb_set_nt_acl_nfs4 succeeded\n")); return NT_STATUS_OK; } diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index bcf61f3bc7..d10906dfb1 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -30,7 +30,7 @@ #include #include "nfs4_acls.h" - +#include "vfs_gpfs.h" static int vfs_gpfs_kernel_flock(vfs_handle_struct *handle, files_struct *fsp, uint32 share_mode) @@ -153,7 +153,7 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl) DEBUG(10, ("gpfs_get_nfs4_acl invoked for %s\n", fname)); /* First get the real acl length */ - gacl = gpfs_getacl_alloc(fname, GPFS_ACL_TYPE_NFS4); + gacl = gpfs_getacl_alloc(fname, 0); if (gacl == NULL) { DEBUG(9, ("gpfs_getacl failed for %s with %s\n", fname, strerror(errno))); @@ -208,10 +208,10 @@ static int gpfs_get_nfs4_acl(const char *fname, SMB4ACL_T **ppacl) if (i > 0 && gace->aceType == SMB_ACE4_ACCESS_DENIED_ACE_TYPE) { struct gpfs_ace_v4 *prev = &gacl->ace_v4[i-1]; if (prev->aceType == SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE && - prev->aceFlags == gace->aceFlags && - prev->aceIFlags == gace->aceIFlags && - (gace->aceMask & prev->aceMask) == 0 && - gace->aceWho == prev->aceWho) { + prev->aceFlags == gace->aceFlags && + prev->aceIFlags == gace->aceIFlags && + (gace->aceMask & prev->aceMask) == 0 && + gace->aceWho == prev->aceWho) { /* its redundent - skip it */ continue; } @@ -256,7 +256,7 @@ static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle, int result; *ppdesc = NULL; - result = gpfs_get_nfs4_acl(fsp->fsp_name, &pacl); + result = gpfs_get_nfs4_acl(name, &pacl); if (result == 0) return smb_get_nt_acl_nfs4(handle->conn, name, security_info, ppdesc, pacl); @@ -301,8 +301,31 @@ static bool gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) gace->aceType = aceprop->aceType; gace->aceFlags = aceprop->aceFlags; gace->aceMask = aceprop->aceMask; + + /* + * GPFS can't distinguish between WRITE and APPEND on + * files, so one being set without the other is an + * error. Sorry for the many ()'s :-) + */ + + if (!fsp->is_directory + && + ((((gace->aceMask & ACE4_MASK_WRITE) == 0) + && ((gace->aceMask & ACE4_MASK_APPEND) != 0)) + || + (((gace->aceMask & ACE4_MASK_WRITE) != 0) + && ((gace->aceMask & ACE4_MASK_APPEND) == 0))) + && + lp_parm_bool(fsp->conn->params->service, "gpfs", + "merge_writeappend", True)) { + DEBUG(2, ("vfs_gpfs.c: file [%s]: ACE contains " + "WRITE^APPEND, setting WRITE|APPEND\n", + fsp->fsp_name)); + gace->aceMask |= ACE4_MASK_WRITE|ACE4_MASK_APPEND; + } + gace->aceIFlags = (aceprop->flags&SMB_ACE4_ID_SPECIAL) ? ACE4_IFLAG_SPECIAL_ID : 0; - + if (aceprop->flags&SMB_ACE4_ID_SPECIAL) { switch(aceprop->who.special_id) @@ -347,7 +370,7 @@ static NTSTATUS gpfsacl_set_nt_acl_internal(files_struct *fsp, uint32 security_i struct gpfs_acl *acl; NTSTATUS result = NT_STATUS_ACCESS_DENIED; - acl = gpfs_getacl_alloc(fsp->fsp_name, GPFS_ACL_TYPE_ACCESS); + acl = gpfs_getacl_alloc(fsp->fsp_name, 0); if (acl == NULL) return result; @@ -628,75 +651,225 @@ int gpfsacl_sys_acl_delete_def_file(vfs_handle_struct *handle, return -1; } +/* + * Assumed: mode bits are shiftable and standard + * Output: the new aceMask field for an smb nfs4 ace + */ +static uint32 gpfsacl_mask_filter(uint32 aceType, uint32 aceMask, uint32 rwx) +{ + const uint32 posix_nfs4map[3] = { + SMB_ACE4_EXECUTE, /* execute */ + SMB_ACE4_WRITE_DATA | SMB_ACE4_APPEND_DATA, /* write; GPFS specific */ + SMB_ACE4_READ_DATA /* read */ + }; + int i; + uint32_t posix_mask = 0x01; + uint32_t posix_bit; + uint32_t nfs4_bits; + + for(i=0; i<3; i++) { + nfs4_bits = posix_nfs4map[i]; + posix_bit = rwx & posix_mask; + + if (aceType==SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE) { + if (posix_bit) + aceMask |= nfs4_bits; + else + aceMask &= ~nfs4_bits; + } else { + /* add deny bits when suitable */ + if (!posix_bit) + aceMask |= nfs4_bits; + else + aceMask &= ~nfs4_bits; + } /* other ace types are unexpected */ + + posix_mask <<= 1; + } + + return aceMask; +} + +static int gpfsacl_emu_chmod(const char *path, mode_t mode) +{ + SMB4ACL_T *pacl = NULL; + int result; + bool haveAllowEntry[SMB_ACE4_WHO_EVERYONE + 1] = {False, False, False, False}; + int i; + files_struct fake_fsp; /* TODO: rationalize parametrization */ + SMB4ACE_T *smbace; + + DEBUG(10, ("gpfsacl_emu_chmod invoked for %s mode %o\n", path, mode)); + + result = gpfs_get_nfs4_acl(path, &pacl); + if (result) + return result; + + if (mode & ~(S_IRWXU | S_IRWXG | S_IRWXO)) { + DEBUG(2, ("WARNING: cutting extra mode bits %o on %s\n", mode, path)); + } + + for (smbace=smb_first_ace4(pacl); smbace!=NULL; smbace = smb_next_ace4(smbace)) { + SMB_ACE4PROP_T *ace = smb_get_ace4(smbace); + uint32_t specid = ace->who.special_id; + + if (ace->flags&SMB_ACE4_ID_SPECIAL && + ace->aceType<=SMB_ACE4_ACCESS_DENIED_ACE_TYPE && + specid <= SMB_ACE4_WHO_EVERYONE) { + + uint32_t newMask; + + if (ace->aceType==SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE) + haveAllowEntry[specid] = True; + + /* mode >> 6 for @owner, mode >> 3 for @group, + * mode >> 0 for @everyone */ + newMask = gpfsacl_mask_filter(ace->aceType, ace->aceMask, + mode >> ((SMB_ACE4_WHO_EVERYONE - specid) * 3)); + if (ace->aceMask!=newMask) { + DEBUG(10, ("ace changed for %s (%o -> %o) id=%d\n", + path, ace->aceMask, newMask, specid)); + } + ace->aceMask = newMask; + } + } + + /* make sure we have at least ALLOW entries + * for all the 3 special ids (@EVERYONE, @OWNER, @GROUP) + * - if necessary + */ + for(i = SMB_ACE4_WHO_OWNER; i<=SMB_ACE4_WHO_EVERYONE; i++) { + SMB_ACE4PROP_T ace; + + if (haveAllowEntry[i]==True) + continue; + + memset(&ace, 0, sizeof(SMB_ACE4PROP_T)); + ace.aceType = SMB_ACE4_ACCESS_ALLOWED_ACE_TYPE; + ace.flags |= SMB_ACE4_ID_SPECIAL; + ace.who.special_id = i; + + if (i==SMB_ACE4_WHO_GROUP) /* not sure it's necessary... */ + ace.aceFlags |= SMB_ACE4_IDENTIFIER_GROUP; + + ace.aceMask = gpfsacl_mask_filter(ace.aceType, ace.aceMask, + mode >> ((SMB_ACE4_WHO_EVERYONE - i) * 3)); + + /* don't add unnecessary aces */ + if (!ace.aceMask) + continue; + + /* we add it to the END - as windows expects allow aces */ + smb_add_ace4(pacl, &ace); + DEBUG(10, ("Added ALLOW ace for %s, mode=%o, id=%d, aceMask=%x\n", + path, mode, i, ace.aceMask)); + } + + /* don't add complementary DENY ACEs here */ + memset(&fake_fsp, 0, sizeof(struct files_struct)); + fake_fsp.fsp_name = (char *)path; /* no file_new is needed here */ + + /* put the acl */ + if (gpfsacl_process_smbacl(&fake_fsp, pacl) == False) + return -1; + return 0; /* ok for [f]chmod */ +} + static int vfs_gpfs_chmod(vfs_handle_struct *handle, const char *path, mode_t mode) { SMB_STRUCT_STAT st; + int rc; + if (SMB_VFS_NEXT_STAT(handle, path, &st) != 0) { - return -1; + return -1; } + /* avoid chmod() if possible, to preserve acls */ if ((st.st_mode & ~S_IFMT) == mode) { - return 0; + return 0; } - return SMB_VFS_NEXT_CHMOD(handle, path, mode); + + rc = gpfsacl_emu_chmod(path, mode); + if (rc == 1) + return SMB_VFS_NEXT_CHMOD(handle, path, mode); + return rc; } static int vfs_gpfs_fchmod(vfs_handle_struct *handle, files_struct *fsp, mode_t mode) { SMB_STRUCT_STAT st; + int rc; + if (SMB_VFS_NEXT_FSTAT(handle, fsp, &st) != 0) { - return -1; + return -1; } + /* avoid chmod() if possible, to preserve acls */ if ((st.st_mode & ~S_IFMT) == mode) { - return 0; + return 0; } - return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); + + rc = gpfsacl_emu_chmod(fsp->fsp_name, mode); + if (rc == 1) + return SMB_VFS_NEXT_FCHMOD(handle, fsp, mode); + return rc; } /* VFS operations structure */ static vfs_op_tuple gpfs_op_tuples[] = { - - { SMB_VFS_OP(vfs_gpfs_kernel_flock), SMB_VFS_OP_KERNEL_FLOCK, - SMB_VFS_LAYER_OPAQUE }, - - { SMB_VFS_OP(vfs_gpfs_setlease), SMB_VFS_OP_LINUX_SETLEASE, - SMB_VFS_LAYER_OPAQUE }, - - { SMB_VFS_OP(gpfsacl_fget_nt_acl), SMB_VFS_OP_FGET_NT_ACL, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_fset_nt_acl), SMB_VFS_OP_FSET_NT_ACL, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_sys_acl_get_file), SMB_VFS_OP_SYS_ACL_GET_FILE, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_sys_acl_get_fd), SMB_VFS_OP_SYS_ACL_GET_FD, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_sys_acl_set_file), SMB_VFS_OP_SYS_ACL_SET_FILE, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(gpfsacl_sys_acl_set_fd), SMB_VFS_OP_SYS_ACL_SET_FD, - SMB_VFS_LAYER_TRANSPARENT }, - + + { SMB_VFS_OP(vfs_gpfs_kernel_flock), + SMB_VFS_OP_KERNEL_FLOCK, + SMB_VFS_LAYER_OPAQUE }, + + { SMB_VFS_OP(vfs_gpfs_setlease), + SMB_VFS_OP_LINUX_SETLEASE, + SMB_VFS_LAYER_OPAQUE }, + + { SMB_VFS_OP(gpfsacl_fget_nt_acl), + SMB_VFS_OP_FGET_NT_ACL, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_get_nt_acl), + SMB_VFS_OP_GET_NT_ACL, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_fset_nt_acl), + SMB_VFS_OP_FSET_NT_ACL, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_set_nt_acl), + SMB_VFS_OP_SET_NT_ACL, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_sys_acl_get_file), + SMB_VFS_OP_SYS_ACL_GET_FILE, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_sys_acl_get_fd), + SMB_VFS_OP_SYS_ACL_GET_FD, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_sys_acl_set_file), + SMB_VFS_OP_SYS_ACL_SET_FILE, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(gpfsacl_sys_acl_set_fd), + SMB_VFS_OP_SYS_ACL_SET_FD, + SMB_VFS_LAYER_TRANSPARENT }, + { SMB_VFS_OP(gpfsacl_sys_acl_delete_def_file), - SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(vfs_gpfs_chmod), SMB_VFS_OP_CHMOD, - SMB_VFS_LAYER_TRANSPARENT }, - - { SMB_VFS_OP(vfs_gpfs_fchmod), SMB_VFS_OP_FCHMOD, - SMB_VFS_LAYER_TRANSPARENT }, + SMB_VFS_OP_SYS_ACL_DELETE_DEF_FILE, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(vfs_gpfs_chmod), + SMB_VFS_OP_CHMOD, + SMB_VFS_LAYER_TRANSPARENT }, + + { SMB_VFS_OP(vfs_gpfs_fchmod), + SMB_VFS_OP_FCHMOD, + SMB_VFS_LAYER_TRANSPARENT }, { SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP } diff --git a/source3/modules/vfs_gpfs.h b/source3/modules/vfs_gpfs.h new file mode 100644 index 0000000000..3c499b0850 --- /dev/null +++ b/source3/modules/vfs_gpfs.h @@ -0,0 +1,32 @@ +/* + Unix SMB/CIFS implementation. + Wrap gpfs calls in vfs functions. + + Copyright (C) Christian Ambach 2006 + + Major code contributions by Chetan Shringarpure + and Gomati Mohanan + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + +*/ + +bool set_gpfs_sharemode(files_struct *fsp, uint32 access_mask, + uint32 share_access); +int set_gpfs_lease(int fd, int leasetype); +int smbd_gpfs_getacl(char *pathname, int flags, void *acl); +int smbd_gpfs_putacl(char *pathname, int flags, void *acl); +void init_gpfs(void); diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index 5f18615f66..6cec39f9c0 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -3413,6 +3413,9 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) bool acl_perms = False; mode_t orig_mode = (mode_t)0; NTSTATUS status; + uid_t orig_uid; + gid_t orig_gid; + bool need_chown = False; DEBUG(10,("set_nt_acl: called for file %s\n", fsp->fsp_name )); @@ -3435,6 +3438,8 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) /* Save the original elements we check against. */ orig_mode = sbuf.st_mode; + orig_uid = sbuf.st_uid; + orig_gid = sbuf.st_gid; /* * Unpack the user/group/world id's. @@ -3449,7 +3454,11 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) * Do we need to chown ? */ - if (((user != (uid_t)-1) && (sbuf.st_uid != user)) || (( grp != (gid_t)-1) && (sbuf.st_gid != grp))) { + if (((user != (uid_t)-1) && (orig_uid != user)) || (( grp != (gid_t)-1) && (orig_gid != grp))) { + need_chown = True; + } + + if (need_chown && (user == (uid_t)-1 || user == current_user.ut.uid)) { DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n", fsp->fsp_name, (unsigned int)user, (unsigned int)grp )); @@ -3487,6 +3496,11 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) /* Save the original elements we check against. */ orig_mode = sbuf.st_mode; + orig_uid = sbuf.st_uid; + orig_gid = sbuf.st_gid; + + /* We did chown already, drop the flag */ + need_chown = False; } create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid); @@ -3630,6 +3644,21 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd) free_canon_ace_list(dir_ace_list); } + /* Any chown pending? */ + if (need_chown) { + DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n", + fsp->fsp_name, (unsigned int)user, (unsigned int)grp )); + + if(try_chown( fsp->conn, fsp->fsp_name, user, grp) == -1) { + DEBUG(3,("set_nt_acl: chown %s, %u, %u failed. Error = %s.\n", + fsp->fsp_name, (unsigned int)user, (unsigned int)grp, strerror(errno) )); + if (errno == EPERM) { + return NT_STATUS_INVALID_OWNER; + } + return map_nt_error_from_unix(errno); + } + } + return NT_STATUS_OK; } -- cgit From c283c1bb8b3a167ab20140dac914f3b6ddc21aec Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:19:51 +0300 Subject: Support GPFS prealloc interface Signed-off-by: Alexander Bokovoy (This used to be commit c26e355533e473c4386d0e6d651637e71d4231dc) --- source3/modules/vfs_prealloc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/modules/vfs_prealloc.c b/source3/modules/vfs_prealloc.c index 2d64bc0184..cb3508dc30 100644 --- a/source3/modules/vfs_prealloc.c +++ b/source3/modules/vfs_prealloc.c @@ -47,11 +47,16 @@ #define lock_type struct flock64 #endif +#ifdef HAVE_GPFS +#include "gpfs_gpl.h" +#endif + #define MODULE "prealloc" static int module_debug; static int preallocate_space(int fd, SMB_OFF_T size) { +#ifndef HAVE_GPFS lock_type fl = {0}; int err; @@ -78,6 +83,9 @@ static int preallocate_space(int fd, SMB_OFF_T size) err = -1; errno = ENOSYS; #endif +#else /* GPFS uses completely different interface */ + err = gpfs_prealloc(fd, (gpfs_off64_t)0, (gpfs_off64_t)size); +#endif if (err) { DEBUG(module_debug, -- cgit From d52b66daac5ffdedb11dc0e346d55d94890d9fbf Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:21:38 +0300 Subject: Merge a variant of Shadow Copy module for exposing snapshots to windows clients as shadow copies from Samba 3.0 CTDB This is a 2nd implemetation of a shadow copy module for exposing snapshots to windows clients as shadow copies. This version has the following features: 1) you don't need to populate your shares with symlinks to the snapshots. This can be very important when you have thousands of shares, or use [homes] 2) the inode number of the files is altered so it is different from the original. This allows the 'restore' button to work without a sharing violation Signed-off-by: Alexander Bokovoy (This used to be commit 10c2ae1efd799b44255ce82c3bb0c7c9df0ec634) --- source3/modules/vfs_shadow_copy2.c | 637 +++++++++++++++++++++++++++++++++++++ 1 file changed, 637 insertions(+) create mode 100644 source3/modules/vfs_shadow_copy2.c diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c new file mode 100644 index 0000000000..54fc672b9c --- /dev/null +++ b/source3/modules/vfs_shadow_copy2.c @@ -0,0 +1,637 @@ +/* + * implementation of an Shadow Copy module - version 2 + * + * Copyright (C) Andrew Tridgell 2007 + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +/* + + This is a 2nd implemetation of a shadow copy module for exposing + snapshots to windows clients as shadow copies. This version has the + following features: + + 1) you don't need to populate your shares with symlinks to the + snapshots. This can be very important when you have thousands of + shares, or use [homes] + + 2) the inode number of the files is altered so it is different + from the original. This allows the 'restore' button to work + without a sharing violation + + Module options: + + shadow:snapdir = + + This is the directory containing the @GMT-* snapshot directories. If it is an absolute + path it is used as-is. If it is a relative path, then it is taken relative to the mount + point of the filesystem that the root of this share is on + + shadow:basedir = + + This is an optional parameter that specifies the directory that + the snapshots are relative to. It defaults to the filesystem + mount point + + shadow:fixinodes = yes/no + + If you enable shadow:fixinodes then this module will modify the + apparent inode number of files in the snapshot directories using + a hash of the files path. This is needed for snapshot systems + where the snapshots have the same device:inode number as the + original files (such as happens with GPFS snapshots). If you + don't set this option then the 'restore' button in the shadow + copy UI will fail with a sharing violation. + + Note that the directory names in the snapshot directory must take the form + @GMT-YYYY.MM.DD-HH.MM.SS + + The following command would generate a correctly formatted directory name: + date -u +@GMT-%Y.%m.%d-%H.%M.%S + + */ + +static int vfs_shadow_copy2_debug_level = DBGC_VFS; + +#undef DBGC_CLASS +#define DBGC_CLASS vfs_shadow_copy2_debug_level + +#define GMT_NAME_LEN 24 /* length of a @GMT- name */ + +/* + make very sure it is one of our special names + */ +static inline bool shadow_copy2_match_name(const char *name) +{ + unsigned year, month, day, hr, min, sec; + if (name[0] != '@') return False; + if (strncmp(name, "@GMT-", 5) != 0) return False; + if (sscanf(name, "@GMT-%04u.%02u.%02u-%02u.%02u.%02u", &year, &month, + &day, &hr, &min, &sec) != 6) { + return False; + } + if (name[24] != 0 && name[24] != '/') { + return False; + } + return True; +} + +/* + convert a name to the shadow directory + */ + +#define _SHADOW2_NEXT(op, args, rtype, eret, extra) do { \ + const char *name = fname; \ + if (shadow_copy2_match_name(fname)) { \ + char *name2; \ + rtype ret; \ + name2 = convert_shadow2_name(handle, fname); \ + if (name2 == NULL) { \ + errno = EINVAL; \ + return eret; \ + } \ + name = name2; \ + ret = SMB_VFS_NEXT_ ## op args; \ + talloc_free(name2); \ + if (ret != eret) extra; \ + return ret; \ + } else { \ + return SMB_VFS_NEXT_ ## op args; \ + } \ +} while (0) + +/* + convert a name to the shadow directory: NTSTATUS-specific handling + */ + +#define _SHADOW2_NTSTATUS_NEXT(op, args, eret, extra) do { \ + const char *name = fname; \ + if (shadow_copy2_match_name(fname)) { \ + char *name2; \ + NTSTATUS ret; \ + name2 = convert_shadow2_name(handle, fname); \ + if (name2 == NULL) { \ + errno = EINVAL; \ + return eret; \ + } \ + name = name2; \ + ret = SMB_VFS_NEXT_ ## op args; \ + talloc_free(name2); \ + if (!NT_STATUS_EQUAL(ret, eret)) extra; \ + return ret; \ + } else { \ + return SMB_VFS_NEXT_ ## op args; \ + } \ +} while (0) + +#define SHADOW2_NTSTATUS_NEXT(op, args, eret) _SHADOW2_NTSTATUS_NEXT(op, args, eret, ) + +#define SHADOW2_NEXT(op, args, rtype, eret) _SHADOW2_NEXT(op, args, rtype, eret, ) + +#define SHADOW2_NEXT2(op, args) do { \ + if (shadow_copy2_match_name(oldname) || shadow_copy2_match_name(newname)) { \ + errno = EROFS; \ + return -1; \ + } else { \ + return SMB_VFS_NEXT_ ## op args; \ + } \ +} while (0) + + +/* + find the mount point of a filesystem + */ +static char *find_mount_point(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle) +{ + char *path = talloc_strdup(mem_ctx, handle->conn->connectpath); + dev_t dev; + struct stat st; + char *p; + + if (stat(path, &st) != 0) { + talloc_free(path); + return NULL; + } + + dev = st.st_dev; + + while ((p = strrchr(path, '/')) && p > path) { + *p = 0; + if (stat(path, &st) != 0) { + talloc_free(path); + return NULL; + } + if (st.st_dev != dev) { + *p = '/'; + break; + } + } + + return path; +} + +/* + work out the location of the snapshot for this share + */ +static const char *shadow_copy2_find_snapdir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle) +{ + const char *snapdir; + char *mount_point; + const char *ret; + + snapdir = lp_parm_const_string(SNUM(handle->conn), "shadow", "snapdir", NULL); + if (snapdir == NULL) { + return NULL; + } + /* if its an absolute path, we're done */ + if (*snapdir == '/') { + return snapdir; + } + + /* other its relative to the filesystem mount point */ + mount_point = find_mount_point(mem_ctx, handle); + if (mount_point == NULL) { + return NULL; + } + + ret = talloc_asprintf(mem_ctx, "%s/%s", mount_point, snapdir); + talloc_free(mount_point); + return ret; +} + +/* + work out the location of the base directory for snapshots of this share + */ +static const char *shadow_copy2_find_basedir(TALLOC_CTX *mem_ctx, vfs_handle_struct *handle) +{ + const char *basedir = lp_parm_const_string(SNUM(handle->conn), "shadow", "basedir", NULL); + + /* other its the filesystem mount point */ + if (basedir == NULL) { + basedir = find_mount_point(mem_ctx, handle); + } + + return basedir; +} + +/* + convert a filename from a share relative path, to a path in the + snapshot directory + */ +static char *convert_shadow2_name(vfs_handle_struct *handle, const char *fname) +{ + TALLOC_CTX *tmp_ctx = talloc_new(handle->data); + const char *snapdir, *relpath, *baseoffset, *basedir; + size_t baselen; + char *ret; + + snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle); + if (snapdir == NULL) { + DEBUG(2,("no snapdir found for share at %s\n", handle->conn->connectpath)); + talloc_free(tmp_ctx); + return NULL; + } + + basedir = shadow_copy2_find_basedir(tmp_ctx, handle); + if (basedir == NULL) { + DEBUG(2,("no basedir found for share at %s\n", handle->conn->connectpath)); + talloc_free(tmp_ctx); + return NULL; + } + + relpath = fname + GMT_NAME_LEN; + baselen = strlen(basedir); + baseoffset = handle->conn->connectpath + baselen; + + /* some sanity checks */ + if (strncmp(basedir, handle->conn->connectpath, baselen) != 0 || + (handle->conn->connectpath[baselen] != 0 && handle->conn->connectpath[baselen] != '/')) { + DEBUG(0,("convert_shadow2_name: basedir %s is not a parent of %s\n", + basedir, handle->conn->connectpath)); + talloc_free(tmp_ctx); + return NULL; + } + + if (*relpath == '/') relpath++; + if (*baseoffset == '/') baseoffset++; + + ret = talloc_asprintf(handle->data, "%s/%.*s/%s/%s", + snapdir, + GMT_NAME_LEN, fname, + baseoffset, + relpath); + DEBUG(6,("convert_shadow2_name: '%s' -> '%s'\n", fname, ret)); + talloc_free(tmp_ctx); + return ret; +} + + +/* + simple string hash + */ +static uint32 string_hash(const char *s) +{ + uint32 n = 0; + while (*s) { + n = ((n << 5) + n) ^ (uint32)(*s++); + } + return n; +} + +/* + modify a sbuf return to ensure that inodes in the shadow directory + are different from those in the main directory + */ +static void convert_sbuf(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) +{ + if (lp_parm_bool(SNUM(handle->conn), "shadow", "fixinodes", False)) { + /* some snapshot systems, like GPFS, return the name + device:inode for the snapshot files as the current + files. That breaks the 'restore' button in the shadow copy + GUI, as the client gets a sharing violation. + + This is a crude way of allowing both files to be + open at once. It has a slight chance of inode + number collision, but I can't see a better approach + without significant VFS changes + */ + uint32_t shash = string_hash(fname) & 0xFF000000; + if (shash == 0) { + shash = 1; + } + sbuf->st_ino ^= shash; + } +} + +static int shadow_copy2_rename(vfs_handle_struct *handle, + const char *oldname, const char *newname) +{ + SHADOW2_NEXT2(RENAME, (handle, oldname, newname)); +} + +static int shadow_copy2_symlink(vfs_handle_struct *handle, + const char *oldname, const char *newname) +{ + SHADOW2_NEXT2(SYMLINK, (handle, oldname, newname)); +} + +static int shadow_copy2_link(vfs_handle_struct *handle, + const char *oldname, const char *newname) +{ + SHADOW2_NEXT2(LINK, (handle, oldname, newname)); +} + +static int shadow_copy2_open(vfs_handle_struct *handle, + const char *fname, files_struct *fsp, int flags, mode_t mode) +{ + SHADOW2_NEXT(OPEN, (handle, name, fsp, flags, mode), int, -1); +} + +static SMB_STRUCT_DIR *shadow_copy2_opendir(vfs_handle_struct *handle, + const char *fname, const char *mask, uint32 attr) +{ + SHADOW2_NEXT(OPENDIR, (handle, name, mask, attr), void*, NULL); +} + +static int shadow_copy2_stat(vfs_handle_struct *handle, + const char *fname, SMB_STRUCT_STAT *sbuf) +{ + _SHADOW2_NEXT(STAT, (handle, name, sbuf), int, -1, convert_sbuf(handle, fname, sbuf)); +} + +static int shadow_copy2_lstat(vfs_handle_struct *handle, + const char *fname, SMB_STRUCT_STAT *sbuf) +{ + _SHADOW2_NEXT(LSTAT, (handle, name, sbuf), int, -1, convert_sbuf(handle, fname, sbuf)); +} + +static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) +{ + int ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); + if (ret == 0 && shadow_copy2_match_name(fsp->fsp_name)) { + convert_sbuf(handle, fsp->fsp_name, sbuf); + } + return ret; +} + +static int shadow_copy2_unlink(vfs_handle_struct *handle, const char *fname) +{ + SHADOW2_NEXT(UNLINK, (handle, name), int, -1); +} + +static int shadow_copy2_chmod(vfs_handle_struct *handle, + const char *fname, mode_t mode) +{ + SHADOW2_NEXT(CHMOD, (handle, name, mode), int, -1); +} + +static int shadow_copy2_chown(vfs_handle_struct *handle, + const char *fname, uid_t uid, gid_t gid) +{ + SHADOW2_NEXT(CHOWN, (handle, name, uid, gid), int, -1); +} + +static int shadow_copy2_chdir(vfs_handle_struct *handle, + const char *fname) +{ + SHADOW2_NEXT(CHDIR, (handle, name), int, -1); +} + +static int shadow_copy2_ntimes(vfs_handle_struct *handle, + const char *fname, const struct timespec ts[2]) +{ + SHADOW2_NEXT(NTIMES, (handle, name, ts), int, -1); +} + +static int shadow_copy2_readlink(vfs_handle_struct *handle, + const char *fname, char *buf, size_t bufsiz) +{ + SHADOW2_NEXT(READLINK, (handle, name, buf, bufsiz), int, -1); +} + +static int shadow_copy2_mknod(vfs_handle_struct *handle, + const char *fname, mode_t mode, SMB_DEV_T dev) +{ + SHADOW2_NEXT(MKNOD, (handle, name, mode, dev), int, -1); +} + +static char *shadow_copy2_realpath(vfs_handle_struct *handle, + const char *fname, char *resolved_path) +{ + SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), void*, NULL); +} + +static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, + const char *fname, uint32 security_info, + struct security_descriptor **ppdesc) +{ + SHADOW2_NTSTATUS_NEXT(GET_NT_ACL, (handle, name, security_info, ppdesc), NT_STATUS_ACCESS_DENIED); +} + +static NTSTATUS shadow_copy2_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, + const char *fname, uint32 security_info_sent, + struct security_descriptor *psd) +{ + SHADOW2_NTSTATUS_NEXT(SET_NT_ACL, (handle, fsp, name, security_info_sent, psd), NT_STATUS_ACCESS_DENIED); +} + +static int shadow_copy2_mkdir(vfs_handle_struct *handle, const char *fname, mode_t mode) +{ + SHADOW2_NEXT(MKDIR, (handle, name, mode), int, -1); +} + +static int shadow_copy2_rmdir(vfs_handle_struct *handle, const char *fname) +{ + SHADOW2_NEXT(RMDIR, (handle, name), int, -1); +} + +static int shadow_copy2_chflags(vfs_handle_struct *handle, const char *fname, int flags) +{ + SHADOW2_NEXT(CHFLAGS, (handle, name, flags), int, -1); +} + +static ssize_t shadow_copy2_getxattr(vfs_handle_struct *handle, + const char *fname, const char *aname, void *value, size_t size) +{ + SHADOW2_NEXT(GETXATTR, (handle, name, aname, value, size), ssize_t, -1); +} + +static ssize_t shadow_copy2_lgetxattr(vfs_handle_struct *handle, + const char *fname, const char *aname, void *value, size_t size) +{ + SHADOW2_NEXT(LGETXATTR, (handle, name, aname, value, size), ssize_t, -1); +} + +static ssize_t shadow_copy2_listxattr(struct vfs_handle_struct *handle, const char *fname, + char *list, size_t size) +{ + SHADOW2_NEXT(LISTXATTR, (handle, name, list, size), ssize_t, -1); +} + +static int shadow_copy2_removexattr(struct vfs_handle_struct *handle, const char *fname, + const char *aname) +{ + SHADOW2_NEXT(REMOVEXATTR, (handle, name, aname), int, -1); +} + +static int shadow_copy2_lremovexattr(struct vfs_handle_struct *handle, const char *fname, + const char *aname) +{ + SHADOW2_NEXT(LREMOVEXATTR, (handle, name, aname), int, -1); +} + +static int shadow_copy2_setxattr(struct vfs_handle_struct *handle, const char *fname, + const char *aname, const void *value, size_t size, int flags) +{ + SHADOW2_NEXT(SETXATTR, (handle, name, aname, value, size, flags), int, -1); +} + +static int shadow_copy2_lsetxattr(struct vfs_handle_struct *handle, const char *fname, + const char *aname, const void *value, size_t size, int flags) +{ + SHADOW2_NEXT(LSETXATTR, (handle, name, aname, value, size, flags), int, -1); +} + +static int shadow_copy2_chmod_acl(vfs_handle_struct *handle, + const char *fname, mode_t mode) +{ + /* If the underlying VFS doesn't have ACL support... */ + if (!handle->vfs_next.ops.chmod_acl) { + errno = ENOSYS; + return -1; + } + SHADOW2_NEXT(CHMOD_ACL, (handle, name, mode), int, -1); +} + +static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle, + files_struct *fsp, + SHADOW_COPY_DATA *shadow_copy2_data, + bool labels) +{ + SMB_STRUCT_DIR *p; + const char *snapdir; + SMB_STRUCT_DIRENT *d; + TALLOC_CTX *tmp_ctx = talloc_new(handle->data); + + snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle); + if (snapdir == NULL) { + DEBUG(0,("shadow:snapdir not found for %s in get_shadow_copy_data\n", + handle->conn->connectpath)); + errno = EINVAL; + talloc_free(tmp_ctx); + return -1; + } + + p = SMB_VFS_NEXT_OPENDIR(handle, snapdir, NULL, 0); + + if (!p) { + DEBUG(0,("shadow_copy2: SMB_VFS_NEXT_OPENDIR() failed for '%s' - %s\n", + snapdir, strerror(errno))); + talloc_free(tmp_ctx); + return -1; + } + + talloc_free(tmp_ctx); + + shadow_copy2_data->num_volumes = 0; + shadow_copy2_data->labels = NULL; + + while ((d = SMB_VFS_NEXT_READDIR(handle, p))) { + SHADOW_COPY_LABEL *tlabels; + + /* ignore names not of the right form in the snapshot directory */ + if (!shadow_copy2_match_name(d->d_name)) { + continue; + } + + if (!labels) { + /* the caller doesn't want the labels */ + shadow_copy2_data->num_volumes++; + continue; + } + + tlabels = talloc_realloc(shadow_copy2_data->mem_ctx, + shadow_copy2_data->labels, + SHADOW_COPY_LABEL, shadow_copy2_data->num_volumes+1); + if (tlabels == NULL) { + DEBUG(0,("shadow_copy2: out of memory\n")); + SMB_VFS_NEXT_CLOSEDIR(handle, p); + return -1; + } + + strlcpy(tlabels[shadow_copy2_data->num_volumes], d->d_name, sizeof(*tlabels)); + shadow_copy2_data->num_volumes++; + shadow_copy2_data->labels = tlabels; + } + + SMB_VFS_NEXT_CLOSEDIR(handle,p); + return 0; +} + +/* VFS operations structure */ + +static vfs_op_tuple shadow_copy2_ops[] = { + {SMB_VFS_OP(shadow_copy2_opendir), SMB_VFS_OP_OPENDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* directory operations */ + {SMB_VFS_OP(shadow_copy2_mkdir), SMB_VFS_OP_MKDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_rmdir), SMB_VFS_OP_RMDIR, SMB_VFS_LAYER_TRANSPARENT}, + + /* xattr and flags operations */ + {SMB_VFS_OP(shadow_copy2_chflags), SMB_VFS_OP_CHFLAGS, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_listxattr), SMB_VFS_OP_LISTXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_removexattr), SMB_VFS_OP_REMOVEXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_lremovexattr),SMB_VFS_OP_LREMOVEXATTR,SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_setxattr), SMB_VFS_OP_SETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_lsetxattr), SMB_VFS_OP_LSETXATTR, SMB_VFS_LAYER_TRANSPARENT}, + + /* File operations */ + {SMB_VFS_OP(shadow_copy2_open), SMB_VFS_OP_OPEN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_rename), SMB_VFS_OP_RENAME, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_stat), SMB_VFS_OP_STAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_lstat), SMB_VFS_OP_LSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_fstat), SMB_VFS_OP_FSTAT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_unlink), SMB_VFS_OP_UNLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_chmod), SMB_VFS_OP_CHMOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_chown), SMB_VFS_OP_CHOWN, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_chdir), SMB_VFS_OP_CHDIR, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_ntimes), SMB_VFS_OP_NTIMES, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_symlink), SMB_VFS_OP_SYMLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_readlink), SMB_VFS_OP_READLINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_link), SMB_VFS_OP_LINK, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_mknod), SMB_VFS_OP_MKNOD, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_realpath), SMB_VFS_OP_REALPATH, SMB_VFS_LAYER_TRANSPARENT}, + + /* NT File ACL operations */ + {SMB_VFS_OP(shadow_copy2_get_nt_acl), SMB_VFS_OP_GET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(shadow_copy2_set_nt_acl), SMB_VFS_OP_SET_NT_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + /* POSIX ACL operations */ + {SMB_VFS_OP(shadow_copy2_chmod_acl), SMB_VFS_OP_CHMOD_ACL, SMB_VFS_LAYER_TRANSPARENT}, + + /* special shadown copy op */ + {SMB_VFS_OP(shadow_copy2_get_shadow_copy2_data), + SMB_VFS_OP_GET_SHADOW_COPY_DATA,SMB_VFS_LAYER_OPAQUE}, + + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_shadow_copy2_init(void); +NTSTATUS vfs_shadow_copy2_init(void) +{ + NTSTATUS ret; + + ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "shadow_copy2", shadow_copy2_ops); + + if (!NT_STATUS_IS_OK(ret)) + return ret; + + vfs_shadow_copy2_debug_level = debug_add_class("shadow_copy2"); + if (vfs_shadow_copy2_debug_level == -1) { + vfs_shadow_copy2_debug_level = DBGC_VFS; + DEBUG(0, ("%s: Couldn't register custom debugging class!\n", + "vfs_shadow_copy2_init")); + } else { + DEBUG(10, ("%s: Debug class number of '%s': %d\n", + "vfs_shadow_copy2_init","shadow_copy2",vfs_shadow_copy2_debug_level)); + } + + return ret; +} -- cgit From e633e4ddab68212b47f9ce44d8194007f245b5f1 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:26:35 +0300 Subject: Add offline storage support with Tivoli Storage Manager Space Manager Signed-off-by: Alexander Bokovoy (This used to be commit d7752449f38747d59c93869656a5f7c02ebdf084) --- source3/modules/vfs_tsmsm.c | 338 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 source3/modules/vfs_tsmsm.c diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c new file mode 100644 index 0000000000..fe791b24bf --- /dev/null +++ b/source3/modules/vfs_tsmsm.c @@ -0,0 +1,338 @@ +/* + Unix SMB/CIFS implementation. + Samba VFS module for handling offline files + with Tivoli Storage Manager Space Management + + (c) Alexander Bokovoy, 2007 + (c) Andrew Tridgell, 2007 + + 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +/* + This VFS module accepts following options: + tsmsm: hsm script = (/bin/true by default, i.e. does nothing) + hsm script should point to a shell script which accepts two arguments: + + where is currently 'offline' to set offline status of the + + tsmsm: online ratio = ratio to check reported size against actual file size (0.5 by default) + + The TSMSM VFS module tries to avoid calling expensive DMAPI calls with some heuristics + based on the fact that number of blocks reported of a file multiplied by 512 will be + bigger than 'online ratio' of actual size for online (non-migrated) files. + + If checks fail, we call DMAPI and ask for specific IBM attribute which present for + offline (migrated) files. If this attribute presents, we consider file offline. + */ + +#include "includes.h" + +#ifndef USE_DMAPI +#error "This module requires DMAPI support!" +#endif + +#ifdef HAVE_XFS_DMAPI_H +#include +#elif defined(HAVE_SYS_DMI_H) +#include +#elif defined(HAVE_SYS_JFSDMAPI_H) +#include +#elif defined(HAVE_SYS_DMAPI_H) +#include +#elif defined(HAVE_DMAPI_H) +#include +#endif + +#ifndef _ISOC99_SOURCE +#define _ISOC99_SOURCE +#endif + +#include + +/* optimisation tunables - used to avoid the DMAPI slow path */ +#define FILE_IS_ONLINE_RATIO 0.5 +#define DM_ATTRIB_OBJECT "IBMObj" +#define DM_ATTRIB_MIGRATED "IBMMig" + +struct tsmsm_struct { + dm_sessid_t sid; + float online_ratio; + char *hsmscript; +}; + +#define TSM_STRINGIFY(a) #a +#define TSM_TOSTRING(a) TSM_STRINGIFY(a) + +static void tsmsm_free_data(void **pptr) { + struct tsmsm_struct **tsmd = (struct tsmsm_struct **)pptr; + if(!tsmd) return; + TALLOC_FREE(*tsmd); +} + +static int tsmsm_connect(struct vfs_handle_struct *handle, + const char *service, + const char *user) { + struct tsmsm_struct *tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct); + const char *hsmscript, *tsmname; + const char *fres; + + if (!tsmd) { + DEBUG(0,("tsmsm_connect: out of memory!\n")); + return -1; + } + + tsmd->sid = *(dm_sessid_t*) dmapi_get_current_session(); + + if (tsmd->sid == DM_NO_SESSION) { + DEBUG(0,("tsmsm_connect: no DMAPI session for Samba is available!\n")); + TALLOC_FREE(tsmd); + return -1; + } + + tsmname = (handle->param ? handle->param : "tsmsm"); + hsmscript = lp_parm_const_string(SNUM(handle->conn), tsmname, + "hsm script", NULL); + if (hsmscript) { + tsmd->hsmscript = talloc_strdup(tsmd, hsmscript); + if(!tsmd->hsmscript) { + DEBUG(1, ("tsmsm_connect: can't allocate memory for hsm script path")); + TALLOC_FREE(tsmd); + return -1; + } + } else { + DEBUG(1, ("tsmsm_connect: can't call hsm script because it " + "is not set to anything in the smb.conf\n" + "Use %s: 'hsm script = path' to set it\n", + tsmname)); + TALLOC_FREE(tsmd); + return -1; + } + + fres = lp_parm_const_string(SNUM(handle->conn), tsmname, + "online ratio", TSM_TOSTRING(FILE_IS_ONLINE_RATIO)); + tsmd->online_ratio = strtof(fres, NULL); + if((tsmd->online_ratio == (float)0) || ((errno == ERANGE) && + ((tsmd->online_ratio == HUGE_VALF) || + (tsmd->online_ratio == HUGE_VALL)))) { + DEBUG(1, ("tsmsm_connect: error while getting online ratio from smb.conf." + "Default to %s.\n", TSM_TOSTRING(FILE_IS_ONLINE_RATIO))); + tsmd->online_ratio = FILE_IS_ONLINE_RATIO; + } + + /* Store the private data. */ + SMB_VFS_HANDLE_SET_DATA(handle, tsmd, tsmsm_free_data, + struct tsmsm_struct, return -1); + return SMB_VFS_NEXT_CONNECT(handle, service, user); +} + +static int tsmsm_is_offline(struct vfs_handle_struct *handle, + struct connection_struct *conn, + const char *path, + SMB_STRUCT_STAT *stbuf, + bool *offline) { + struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; + void *dmhandle = NULL; + size_t dmhandle_len = 0; + size_t rlen; + dm_attrname_t dmname; + int ret; + + /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available, + then assume it is not offline (it may not be 100%, as it could be sparse) */ + if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size * tsmd->online_ratio) { + *offline = false; + DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld online_ratio=%.2f\n", + path, stbuf->st_blocks, stbuf->st_size, tsmd->online_ratio)); + return 0; + } + + /* using POSIX capabilities does not work here. It's a slow path, so + * become_root() is just as good anyway (tridge) + */ + + /* Also, AIX has DMAPI but no POSIX capablities support. In this case, + * we need to be root to do DMAPI manipulations. + */ + become_root(); + + /* go the slow DMAPI route */ + if (dm_path_to_handle((char*)path, &dmhandle, &dmhandle_len) != 0) { + ret = -1; + DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) - %s\n", + path, strerror(errno))); + *offline = True; + goto done; + } + + memset(&dmname, 0, sizeof(dmname)); + strlcpy((char *)&dmname.an_chars[0], DM_ATTRIB_OBJECT, sizeof(dmname.an_chars)); + + ret = dm_get_dmattr(tsmd->sid, dmhandle, dmhandle_len, + DM_NO_TOKEN, &dmname, 0, NULL, &rlen); + + /* its offline if the IBMObj attribute exists */ + *offline = (ret == 0 || (ret == -1 && errno == E2BIG)); + + DEBUG(10,("dm_get_dmattr %s ret=%d (%s)\n", path, ret, strerror(errno))); + + ret = 0; + + dm_handle_free(dmhandle, dmhandle_len); + +done: + unbecome_root(); + return ret; +} + + +static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + SMB_STRUCT_STAT sbuf; + struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; + /* see if the file might be offline. This is called before each IO + to ensure we use AIO if the file is offline. We don't do the full dmapi + call as that would be too slow, instead we err on the side of using AIO + if the file might be offline + */ + if(SMB_VFS_FSTAT(fsp, &sbuf) == 0) { + DEBUG(10,("tsmsm_aio_force st_blocks=%ld st_size=%ld online_ratio=%.2f\n", + sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio)); + return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio); + } + return False; +} + +static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, + SMB_STRUCT_AIOCB *aiocb) +{ + ssize_t result; + + result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb); + if(result >= 0) { + notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED, + FILE_NOTIFY_CHANGE_ATTRIBUTES, + fsp->fsp_name); + } + + return result; +} + +static ssize_t tsmsm_sendfile(vfs_handle_struct *handle, int tofd, files_struct *fsp, const DATA_BLOB *hdr, + SMB_OFF_T offset, size_t n) +{ + bool file_online = tsmsm_aio_force(handle, fsp); + + if(!file_online) + return ENOSYS; + + return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n); +} + +/* We do overload pread to allow notification when file becomes online after offline status */ +/* We don't intercept SMB_VFS_READ here because all file I/O now goes through SMB_VFS_PREAD instead */ +static ssize_t tsmsm_pread(struct vfs_handle_struct *handle, struct files_struct *fsp, + void *data, size_t n, SMB_OFF_T offset) { + ssize_t result; + bool notify_online = tsmsm_aio_force(handle, fsp); + + result = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); + if((result != -1) && notify_online) { + /* We can't actually force AIO at this point (came here not from reply_read_and_X) + what we can do is to send notification that file became online + */ + notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED, + FILE_NOTIFY_CHANGE_ATTRIBUTES, + fsp->fsp_name); + } + + return result; +} + +static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struct *fsp, + void *data, size_t n, SMB_OFF_T offset) { + ssize_t result; + bool notify_online = tsmsm_aio_force(handle, fsp); + + result = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); + if((result != -1) && notify_online) { + /* We can't actually force AIO at this point (came here not from reply_read_and_X) + what we can do is to send notification that file became online + */ + notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED, + FILE_NOTIFY_CHANGE_ATTRIBUTES, + fsp->fsp_name); + } + + return result; +} + +static int tsmsm_set_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, + const char *path) { + struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; + int result = 0; + char *command; + + /* Now, call the script */ + command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, path); + if(!command) { + DEBUG(1, ("tsmsm_set_offline: can't allocate memory to run hsm script")); + return -1; + } + DEBUG(10, ("tsmsm_set_offline: Running [%s]\n", command)); + if((result = smbrun(command, NULL)) != 0) { + DEBUG(1,("tsmsm_set_offline: Running [%s] returned %d\n", command, result)); + } + TALLOC_FREE(command); + return result; +} + +static bool tsmsm_is_remotestorage(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) { + return True; +} + +static vfs_op_tuple vfs_tsmsm_ops[] = { + + /* Disk operations */ + + {SMB_VFS_OP(tsmsm_connect), SMB_VFS_OP_CONNECT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_aio_force), SMB_VFS_OP_AIO_FORCE, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_aio_return), SMB_VFS_OP_AIO_RETURN, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_pread), SMB_VFS_OP_PREAD, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_pwrite), SMB_VFS_OP_PWRITE, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_sendfile), SMB_VFS_OP_SENDFILE, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_is_offline),SMB_VFS_OP_IS_OFFLINE, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(tsmsm_set_offline),SMB_VFS_OP_SET_OFFLINE, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(tsmsm_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE, + SMB_VFS_LAYER_OPAQUE}, + + /* Finish VFS operations definition */ + + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, + SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_tsmsm_init(void); +NTSTATUS vfs_tsmsm_init(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, + "tsmsm", vfs_tsmsm_ops); +} -- cgit From 3bd3483fab4b55c36c276ccaf607a5ed3f1c6f29 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:27:29 +0300 Subject: idmap TDB2 backend, used for clustered Samba setups. This uses 2 tdb files. One is permanent, and is in shared storage on the cluster (using "tdb:idmap2.tdb =" in smb.conf). The other is a temporary cache tdb on local storage. Signed-off-by: Alexander Bokovoy (This used to be commit b6df7e7709365fb620867ad8954bc5bf24496775) --- source3/winbindd/idmap_tdb2.c | 1014 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1014 insertions(+) create mode 100644 source3/winbindd/idmap_tdb2.c diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c new file mode 100644 index 0000000000..fa106aa134 --- /dev/null +++ b/source3/winbindd/idmap_tdb2.c @@ -0,0 +1,1014 @@ +/* + Unix SMB/CIFS implementation. + + idmap TDB2 backend, used for clustered Samba setups. + + This uses 2 tdb files. One is permanent, and is in shared storage + on the cluster (using "tdb:idmap2.tdb =" in smb.conf). The other is a + temporary cache tdb on local storage. + + Copyright (C) Andrew Tridgell 2007 + + This is heavily based upon idmap_tdb.c, which is: + + Copyright (C) Tim Potter 2000 + Copyright (C) Jim McDonough 2003 + Copyright (C) Jeremy Allison 2006 + Copyright (C) Simo Sorce 2003-2006 + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "winbindd.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_IDMAP + +/* High water mark keys */ +#define HWM_GROUP "GROUP HWM" +#define HWM_USER "USER HWM" + +static struct idmap_tdb2_state { + /* User and group id pool */ + uid_t low_uid, high_uid; /* Range of uids to allocate */ + gid_t low_gid, high_gid; /* Range of gids to allocate */ + const char *idmap_script; +} idmap_tdb2_state; + + + +/* tdb context for the local cache tdb */ +static TDB_CONTEXT *idmap_tdb2_tmp; + +/* handle to the permanent tdb */ +static struct db_context *idmap_tdb2_perm; + +/* + open the cache tdb + */ +static NTSTATUS idmap_tdb2_open_cache_db(void) +{ + const char *db_path; + + if (idmap_tdb2_tmp) { + /* its already open */ + return NT_STATUS_OK; + } + + db_path = lock_path("idmap2_cache.tdb"); + + /* Open idmap repository */ + if (!(idmap_tdb2_tmp = tdb_open_log(db_path, 0, TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0644))) { + DEBUG(0, ("Unable to open cache idmap database '%s'\n", db_path)); + return NT_STATUS_UNSUCCESSFUL; + } + + return NT_STATUS_OK; +} + + +static NTSTATUS idmap_tdb2_alloc_load(void); + +/* + open the permanent tdb + */ +static NTSTATUS idmap_tdb2_open_perm_db(void) +{ + char *db_path; + + if (idmap_tdb2_perm) { + /* its already open */ + return NT_STATUS_OK; + } + + db_path = lp_parm_talloc_string(-1, "tdb", "idmap2.tdb", NULL); + if (db_path == NULL) { + /* fall back to the private directory, which, despite + its name, is usually on shared storage */ + db_path = talloc_asprintf(NULL, "%s/idmap2.tdb", lp_private_dir()); + } + NT_STATUS_HAVE_NO_MEMORY(db_path); + + /* Open idmap repository */ + idmap_tdb2_perm = db_open(NULL, db_path, 0, TDB_DEFAULT, + O_RDWR|O_CREAT, 0644); + TALLOC_FREE(db_path); + + if (idmap_tdb2_perm == NULL) { + DEBUG(0, ("Unable to open permanent idmap database '%s'\n", + db_path)); + return NT_STATUS_UNSUCCESSFUL; + } + + /* load the ranges and high/low water marks */ + return idmap_tdb2_alloc_load(); +} + + +/* + load the idmap allocation ranges and high/low water marks +*/ +static NTSTATUS idmap_tdb2_alloc_load(void) +{ + const char *range; + uid_t low_uid = 0; + uid_t high_uid = 0; + gid_t low_gid = 0; + gid_t high_gid = 0; + + /* load ranges */ + idmap_tdb2_state.low_uid = 0; + idmap_tdb2_state.high_uid = 0; + idmap_tdb2_state.low_gid = 0; + idmap_tdb2_state.high_gid = 0; + + /* see if a idmap script is configured */ + idmap_tdb2_state.idmap_script = lp_parm_const_string(-1, "idmap", "script", NULL); + + if (idmap_tdb2_state.idmap_script) { + DEBUG(1, ("using idmap script '%s'\n", idmap_tdb2_state.idmap_script)); + } + + range = lp_parm_const_string(-1, "idmap alloc config", "range", NULL); + if (range && range[0]) { + unsigned low_id, high_id; + if (sscanf(range, "%u - %u", &low_id, &high_id) == 2) { + if (low_id < high_id) { + idmap_tdb2_state.low_gid = idmap_tdb2_state.low_uid = low_id; + idmap_tdb2_state.high_gid = idmap_tdb2_state.high_uid = high_id; + } else { + DEBUG(1, ("ERROR: invalid idmap alloc range [%s]", range)); + } + } else { + DEBUG(1, ("ERROR: invalid syntax for idmap alloc config:range [%s]", range)); + } + } + + /* Create high water marks for group and user id */ + if (lp_idmap_uid(&low_uid, &high_uid)) { + idmap_tdb2_state.low_uid = low_uid; + idmap_tdb2_state.high_uid = high_uid; + } + + if (lp_idmap_gid(&low_gid, &high_gid)) { + idmap_tdb2_state.low_gid = low_gid; + idmap_tdb2_state.high_gid = high_gid; + } + + if (idmap_tdb2_state.high_uid <= idmap_tdb2_state.low_uid) { + DEBUG(1, ("idmap uid range missing or invalid\n")); + DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n")); + return NT_STATUS_UNSUCCESSFUL; + } else { + uint32 low_id; + + if (((low_id = dbwrap_fetch_int32(idmap_tdb2_perm, + HWM_USER)) == -1) || + (low_id < idmap_tdb2_state.low_uid)) { + if (dbwrap_store_int32( + idmap_tdb2_perm, HWM_USER, + idmap_tdb2_state.low_uid) == -1) { + DEBUG(0, ("Unable to initialise user hwm in idmap database\n")); + return NT_STATUS_INTERNAL_DB_ERROR; + } + } + } + + if (idmap_tdb2_state.high_gid <= idmap_tdb2_state.low_gid) { + DEBUG(1, ("idmap gid range missing or invalid\n")); + DEBUGADD(1, ("idmap will be unable to map foreign SIDs\n")); + return NT_STATUS_UNSUCCESSFUL; + } else { + uint32 low_id; + + if (((low_id = dbwrap_fetch_int32(idmap_tdb2_perm, + HWM_GROUP)) == -1) || + (low_id < idmap_tdb2_state.low_gid)) { + if (dbwrap_store_int32( + idmap_tdb2_perm, HWM_GROUP, + idmap_tdb2_state.low_gid) == -1) { + DEBUG(0, ("Unable to initialise group hwm in idmap database\n")); + return NT_STATUS_INTERNAL_DB_ERROR; + } + } + } + + return NT_STATUS_OK; +} + + +/* + Initialise idmap alloc database. +*/ +static NTSTATUS idmap_tdb2_alloc_init(const char *params) +{ + /* nothing to do - we want to avoid opening the permanent + database if possible. Instead we load the params when we + first need it. */ + return NT_STATUS_OK; +} + + +/* + Allocate a new id. +*/ +static NTSTATUS idmap_tdb2_allocate_id(struct unixid *xid) +{ + bool ret; + const char *hwmkey; + const char *hwmtype; + uint32_t high_hwm; + uint32_t hwm; + NTSTATUS status; + + status = idmap_tdb2_open_perm_db(); + NT_STATUS_NOT_OK_RETURN(status); + + /* Get current high water mark */ + switch (xid->type) { + + case ID_TYPE_UID: + hwmkey = HWM_USER; + hwmtype = "UID"; + high_hwm = idmap_tdb2_state.high_uid; + break; + + case ID_TYPE_GID: + hwmkey = HWM_GROUP; + hwmtype = "GID"; + high_hwm = idmap_tdb2_state.high_gid; + break; + + default: + DEBUG(2, ("Invalid ID type (0x%x)\n", xid->type)); + return NT_STATUS_INVALID_PARAMETER; + } + + if ((hwm = dbwrap_fetch_int32(idmap_tdb2_perm, hwmkey)) == -1) { + return NT_STATUS_INTERNAL_DB_ERROR; + } + + /* check it is in the range */ + if (hwm > high_hwm) { + DEBUG(1, ("Fatal Error: %s range full!! (max: %lu)\n", + hwmtype, (unsigned long)high_hwm)); + return NT_STATUS_UNSUCCESSFUL; + } + + /* fetch a new id and increment it */ + ret = dbwrap_change_uint32_atomic(idmap_tdb2_perm, hwmkey, &hwm, 1); + if (ret == -1) { + DEBUG(1, ("Fatal error while fetching a new %s value\n!", hwmtype)); + return NT_STATUS_UNSUCCESSFUL; + } + + /* recheck it is in the range */ + if (hwm > high_hwm) { + DEBUG(1, ("Fatal Error: %s range full!! (max: %lu)\n", + hwmtype, (unsigned long)high_hwm)); + return NT_STATUS_UNSUCCESSFUL; + } + + xid->id = hwm; + DEBUG(10,("New %s = %d\n", hwmtype, hwm)); + + return NT_STATUS_OK; +} + +/* + Get current highest id. +*/ +static NTSTATUS idmap_tdb2_get_hwm(struct unixid *xid) +{ + const char *hwmkey; + const char *hwmtype; + uint32_t hwm; + uint32_t high_hwm; + + /* Get current high water mark */ + switch (xid->type) { + + case ID_TYPE_UID: + hwmkey = HWM_USER; + hwmtype = "UID"; + high_hwm = idmap_tdb2_state.high_uid; + break; + + case ID_TYPE_GID: + hwmkey = HWM_GROUP; + hwmtype = "GID"; + high_hwm = idmap_tdb2_state.high_gid; + break; + + default: + return NT_STATUS_INVALID_PARAMETER; + } + + if ((hwm = dbwrap_fetch_int32(idmap_tdb2_perm, hwmkey)) == -1) { + return NT_STATUS_INTERNAL_DB_ERROR; + } + + xid->id = hwm; + + /* Warn if it is out of range */ + if (hwm >= high_hwm) { + DEBUG(0, ("Warning: %s range full!! (max: %lu)\n", + hwmtype, (unsigned long)high_hwm)); + } + + return NT_STATUS_OK; +} + +/* + Set high id. +*/ +static NTSTATUS idmap_tdb2_set_hwm(struct unixid *xid) +{ + /* not supported, or we would invalidate the cache tdb on + other nodes */ + DEBUG(0,("idmap_tdb2_set_hwm not supported\n")); + return NT_STATUS_NOT_SUPPORTED; +} + +/* + Close the alloc tdb +*/ +static NTSTATUS idmap_tdb2_alloc_close(void) +{ + /* don't actually close it */ + return NT_STATUS_OK; +} + +/* + IDMAP MAPPING TDB BACKEND +*/ +struct idmap_tdb2_context { + uint32_t filter_low_id; + uint32_t filter_high_id; +}; + +/* + try fetching from the cache tdb, and if that fails then + fetch from the permanent tdb + */ +static TDB_DATA tdb2_fetch_bystring(TALLOC_CTX *mem_ctx, const char *keystr) +{ + TDB_DATA ret; + NTSTATUS status; + + ret = tdb_fetch_bystring(idmap_tdb2_tmp, keystr); + if (ret.dptr != NULL) { + /* got it from cache */ + unsigned char *tmp; + + tmp = (unsigned char *)talloc_memdup(mem_ctx, ret.dptr, + ret.dsize); + SAFE_FREE(ret.dptr); + ret.dptr = tmp; + + if (ret.dptr == NULL) { + return make_tdb_data(NULL, 0); + } + return ret; + } + + status = idmap_tdb2_open_perm_db(); + if (!NT_STATUS_IS_OK(status)) { + return ret; + } + + /* fetch from the permanent tdb */ + return dbwrap_fetch_bystring(idmap_tdb2_perm, mem_ctx, keystr); +} + +/* + store into both databases + */ +static NTSTATUS tdb2_store_bystring(const char *keystr, TDB_DATA data, int flags) +{ + NTSTATUS ret; + NTSTATUS status = idmap_tdb2_open_perm_db(); + if (!NT_STATUS_IS_OK(status)) { + return NT_STATUS_UNSUCCESSFUL; + } + ret = dbwrap_store_bystring(idmap_tdb2_perm, keystr, data, flags); + if (!NT_STATUS_IS_OK(ret)) { + ret = tdb_store_bystring(idmap_tdb2_tmp, keystr, data, flags) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + } + return ret; +} + +/* + delete from both databases + */ +static NTSTATUS tdb2_delete_bystring(const char *keystr) +{ + NTSTATUS ret; + NTSTATUS status = idmap_tdb2_open_perm_db(); + if (!NT_STATUS_IS_OK(status)) { + return NT_STATUS_UNSUCCESSFUL; + } + ret = dbwrap_delete_bystring(idmap_tdb2_perm, keystr); + if (!NT_STATUS_IS_OK(ret)) { + ret = tdb_delete_bystring(idmap_tdb2_tmp, keystr) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL; + } + return ret; +} + +/* + Initialise idmap database. +*/ +static NTSTATUS idmap_tdb2_db_init(struct idmap_domain *dom) +{ + NTSTATUS ret; + struct idmap_tdb2_context *ctx; + char *config_option = NULL; + const char *range; + NTSTATUS status; + + status = idmap_tdb2_open_cache_db(); + NT_STATUS_NOT_OK_RETURN(status); + + ctx = talloc(dom, struct idmap_tdb2_context); + if ( ! ctx) { + DEBUG(0, ("Out of memory!\n")); + return NT_STATUS_NO_MEMORY; + } + + config_option = talloc_asprintf(ctx, "idmap config %s", dom->name); + if ( ! config_option) { + DEBUG(0, ("Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto failed; + } + + range = lp_parm_const_string(-1, config_option, "range", NULL); + if (( ! range) || + (sscanf(range, "%u - %u", &ctx->filter_low_id, &ctx->filter_high_id) != 2) || + (ctx->filter_low_id > ctx->filter_high_id)) { + ctx->filter_low_id = 0; + ctx->filter_high_id = 0; + } + + dom->private_data = ctx; + dom->initialized = True; + + talloc_free(config_option); + return NT_STATUS_OK; + +failed: + talloc_free(ctx); + return ret; +} + + +/* + run a script to perform a mapping + + The script should the following command lines: + + SIDTOID S-1-xxxx + IDTOSID UID xxxx + IDTOSID GID xxxx + + and should return one of the following as a single line of text + UID:xxxx + GID:xxxx + SID:xxxx + ERR:xxxx + */ +static NTSTATUS idmap_tdb2_script(struct idmap_tdb2_context *ctx, struct id_map *map, + const char *fmt, ...) +{ + va_list ap; + char *cmd; + FILE *p; + char line[64]; + unsigned long v; + + cmd = talloc_asprintf(ctx, "%s ", idmap_tdb2_state.idmap_script); + NT_STATUS_HAVE_NO_MEMORY(cmd); + + va_start(ap, fmt); + cmd = talloc_vasprintf_append(cmd, fmt, ap); + va_end(ap); + NT_STATUS_HAVE_NO_MEMORY(cmd); + + p = popen(cmd, "r"); + talloc_free(cmd); + if (p == NULL) { + return NT_STATUS_NONE_MAPPED; + } + + if (fgets(line, sizeof(line)-1, p) == NULL) { + pclose(p); + return NT_STATUS_NONE_MAPPED; + } + pclose(p); + + DEBUG(10,("idmap script gave: %s\n", line)); + + if (sscanf(line, "UID:%lu", &v) == 1) { + map->xid.id = v; + map->xid.type = ID_TYPE_UID; + } else if (sscanf(line, "GID:%lu", &v) == 1) { + map->xid.id = v; + map->xid.type = ID_TYPE_GID; + } else if (strncmp(line, "SID:S-", 6) == 0) { + if (!string_to_sid(map->sid, &line[4])) { + DEBUG(0,("Bad SID in '%s' from idmap script %s\n", + line, idmap_tdb2_state.idmap_script)); + return NT_STATUS_NONE_MAPPED; + } + } else { + DEBUG(0,("Bad reply '%s' from idmap script %s\n", + line, idmap_tdb2_state.idmap_script)); + return NT_STATUS_NONE_MAPPED; + } + + return NT_STATUS_OK; +} + + + +/* + Single id to sid lookup function. +*/ +static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_map *map) +{ + NTSTATUS ret; + TDB_DATA data; + char *keystr; + + if (!ctx || !map) { + return NT_STATUS_INVALID_PARAMETER; + } + + /* apply filters before checking */ + if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) || + (ctx->filter_high_id && (map->xid.id > ctx->filter_high_id))) { + DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n", + map->xid.id, ctx->filter_low_id, ctx->filter_high_id)); + return NT_STATUS_NONE_MAPPED; + } + + switch (map->xid.type) { + + case ID_TYPE_UID: + keystr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id); + break; + + case ID_TYPE_GID: + keystr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id); + break; + + default: + DEBUG(2, ("INVALID unix ID type: 0x02%x\n", map->xid.type)); + return NT_STATUS_INVALID_PARAMETER; + } + + /* final SAFE_FREE safe */ + data.dptr = NULL; + + if (keystr == NULL) { + DEBUG(0, ("Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto done; + } + + DEBUG(10,("Fetching record %s\n", keystr)); + + /* Check if the mapping exists */ + data = tdb2_fetch_bystring(keystr, keystr); + + if (!data.dptr) { + fstring sidstr; + + DEBUG(10,("Record %s not found\n", keystr)); + if (idmap_tdb2_state.idmap_script == NULL) { + ret = NT_STATUS_NONE_MAPPED; + goto done; + } + + ret = idmap_tdb2_script(ctx, map, "IDTOSID %s", keystr); + + /* store it on shared storage */ + if (!NT_STATUS_IS_OK(ret)) { + goto done; + } + + if (sid_to_string(sidstr, map->sid)) { + /* both forward and reverse mappings */ + tdb2_store_bystring(keystr, + string_term_tdb_data(sidstr), + TDB_REPLACE); + tdb2_store_bystring(sidstr, + string_term_tdb_data(keystr), + TDB_REPLACE); + } + goto done; + } + + if (!string_to_sid(map->sid, (const char *)data.dptr)) { + DEBUG(10,("INVALID SID (%s) in record %s\n", + (const char *)data.dptr, keystr)); + ret = NT_STATUS_INTERNAL_DB_ERROR; + goto done; + } + + DEBUG(10,("Found record %s -> %s\n", keystr, (const char *)data.dptr)); + ret = NT_STATUS_OK; + +done: + talloc_free(keystr); + return ret; +} + + +/* + Single sid to id lookup function. +*/ +static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_map *map) +{ + NTSTATUS ret; + TDB_DATA data; + char *keystr; + unsigned long rec_id = 0; + + if ((keystr = talloc_asprintf(ctx, "%s", sid_string_static(map->sid))) == NULL) { + DEBUG(0, ("Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto done; + } + + DEBUG(10,("Fetching record %s\n", keystr)); + + /* Check if sid is present in database */ + data = tdb2_fetch_bystring(keystr, keystr); + if (!data.dptr) { + fstring idstr; + + DEBUG(10,(__location__ " Record %s not found\n", keystr)); + + if (idmap_tdb2_state.idmap_script == NULL) { + ret = NT_STATUS_NONE_MAPPED; + goto done; + } + + ret = idmap_tdb2_script(ctx, map, "SIDTOID %s", keystr); + /* store it on shared storage */ + if (!NT_STATUS_IS_OK(ret)) { + goto done; + } + + snprintf(idstr, sizeof(idstr), "%cID %lu", + map->xid.type == ID_TYPE_UID?'U':'G', + (unsigned long)map->xid.id); + /* store both forward and reverse mappings */ + tdb2_store_bystring(keystr, string_term_tdb_data(idstr), + TDB_REPLACE); + tdb2_store_bystring(idstr, string_term_tdb_data(keystr), + TDB_REPLACE); + goto done; + } + + /* What type of record is this ? */ + if (sscanf((const char *)data.dptr, "UID %lu", &rec_id) == 1) { /* Try a UID record. */ + map->xid.id = rec_id; + map->xid.type = ID_TYPE_UID; + DEBUG(10,("Found uid record %s -> %s \n", keystr, (const char *)data.dptr )); + ret = NT_STATUS_OK; + + } else if (sscanf((const char *)data.dptr, "GID %lu", &rec_id) == 1) { /* Try a GID record. */ + map->xid.id = rec_id; + map->xid.type = ID_TYPE_GID; + DEBUG(10,("Found gid record %s -> %s \n", keystr, (const char *)data.dptr )); + ret = NT_STATUS_OK; + + } else { /* Unknown record type ! */ + DEBUG(2, ("Found INVALID record %s -> %s\n", keystr, (const char *)data.dptr)); + ret = NT_STATUS_INTERNAL_DB_ERROR; + } + + /* apply filters before returning result */ + if ((ctx->filter_low_id && (map->xid.id < ctx->filter_low_id)) || + (ctx->filter_high_id && (map->xid.id > ctx->filter_high_id))) { + DEBUG(5, ("Requested id (%u) out of range (%u - %u). Filtered!\n", + map->xid.id, ctx->filter_low_id, ctx->filter_high_id)); + ret = NT_STATUS_NONE_MAPPED; + } + +done: + talloc_free(keystr); + return ret; +} + +/* + lookup a set of unix ids. +*/ +static NTSTATUS idmap_tdb2_unixids_to_sids(struct idmap_domain *dom, struct id_map **ids) +{ + struct idmap_tdb2_context *ctx; + NTSTATUS ret; + int i; + + /* make sure we initialized */ + if ( ! dom->initialized) { + ret = idmap_tdb2_db_init(dom); + if ( ! NT_STATUS_IS_OK(ret)) { + return ret; + } + } + + ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context); + + for (i = 0; ids[i]; i++) { + ret = idmap_tdb2_id_to_sid(ctx, ids[i]); + if ( ! NT_STATUS_IS_OK(ret)) { + + /* if it is just a failed mapping continue */ + if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) { + + /* make sure it is marked as unmapped */ + ids[i]->status = ID_UNMAPPED; + continue; + } + + /* some fatal error occurred, return immediately */ + goto done; + } + + /* all ok, id is mapped */ + ids[i]->status = ID_MAPPED; + } + + ret = NT_STATUS_OK; + +done: + return ret; +} + +/* + lookup a set of sids. +*/ +static NTSTATUS idmap_tdb2_sids_to_unixids(struct idmap_domain *dom, struct id_map **ids) +{ + struct idmap_tdb2_context *ctx; + NTSTATUS ret; + int i; + + /* make sure we initialized */ + if ( ! dom->initialized) { + ret = idmap_tdb2_db_init(dom); + if ( ! NT_STATUS_IS_OK(ret)) { + return ret; + } + } + + ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context); + + for (i = 0; ids[i]; i++) { + ret = idmap_tdb2_sid_to_id(ctx, ids[i]); + if ( ! NT_STATUS_IS_OK(ret)) { + + /* if it is just a failed mapping continue */ + if (NT_STATUS_EQUAL(ret, NT_STATUS_NONE_MAPPED)) { + + /* make sure it is marked as unmapped */ + ids[i]->status = ID_UNMAPPED; + continue; + } + + /* some fatal error occurred, return immediately */ + goto done; + } + + /* all ok, id is mapped */ + ids[i]->status = ID_MAPPED; + } + + ret = NT_STATUS_OK; + +done: + return ret; +} + + +/* + set a mapping. +*/ +static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom, const struct id_map *map) +{ + struct idmap_tdb2_context *ctx; + NTSTATUS ret; + TDB_DATA data; + char *ksidstr, *kidstr; + struct db_record *update_lock = NULL; + struct db_record *rec = NULL; + + /* make sure we initialized */ + if ( ! dom->initialized) { + ret = idmap_tdb2_db_init(dom); + if ( ! NT_STATUS_IS_OK(ret)) { + return ret; + } + } + + if (!map || !map->sid) { + return NT_STATUS_INVALID_PARAMETER; + } + + ksidstr = kidstr = NULL; + data.dptr = NULL; + + /* TODO: should we filter a set_mapping using low/high filters ? */ + + ctx = talloc_get_type(dom->private_data, struct idmap_tdb2_context); + + switch (map->xid.type) { + + case ID_TYPE_UID: + kidstr = talloc_asprintf(ctx, "UID %lu", (unsigned long)map->xid.id); + break; + + case ID_TYPE_GID: + kidstr = talloc_asprintf(ctx, "GID %lu", (unsigned long)map->xid.id); + break; + + default: + DEBUG(2, ("INVALID unix ID type: 0x02%x\n", map->xid.type)); + return NT_STATUS_INVALID_PARAMETER; + } + + if (kidstr == NULL) { + DEBUG(0, ("ERROR: Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto done; + } + + if (!(ksidstr = talloc_strdup(ctx, sid_string_static(map->sid)))) { + DEBUG(0, ("Out of memory!\n")); + ret = NT_STATUS_NO_MEMORY; + goto done; + } + + DEBUG(10, ("Storing %s <-> %s map\n", ksidstr, kidstr)); + + /* + * Get us the update lock. This is necessary to get the lock orders + * right, we need to deal with two records under a lock. + */ + + if (!(update_lock = idmap_tdb2_perm->fetch_locked( + idmap_tdb2_perm, ctx, + string_term_tdb_data("UPDATELOCK")))) { + DEBUG(10,("Failed to lock record %s\n", ksidstr)); + ret = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + /* + * *DELETE* previous mappings if any. * + */ + + /* First delete indexed on SID */ + + if (((rec = idmap_tdb2_perm->fetch_locked( + idmap_tdb2_perm, update_lock, + string_term_tdb_data(ksidstr))) != NULL) + && (rec->value.dsize != 0)) { + struct db_record *rec2; + + if ((rec2 = idmap_tdb2_perm->fetch_locked( + idmap_tdb2_perm, update_lock, rec->value)) + != NULL) { + rec2->delete_rec(rec2); + TALLOC_FREE(rec2); + } + + rec->delete_rec(rec); + + tdb_delete(idmap_tdb2_tmp, rec->key); + tdb_delete(idmap_tdb2_tmp, rec->value); + } + TALLOC_FREE(rec); + + /* Now delete indexed on unix ID */ + + if (((rec = idmap_tdb2_perm->fetch_locked( + idmap_tdb2_perm, update_lock, + string_term_tdb_data(kidstr))) != NULL) + && (rec->value.dsize != 0)) { + struct db_record *rec2; + + if ((rec2 = idmap_tdb2_perm->fetch_locked( + idmap_tdb2_perm, update_lock, rec->value)) + != NULL) { + rec2->delete_rec(rec2); + TALLOC_FREE(rec2); + } + + rec->delete_rec(rec); + + tdb_delete(idmap_tdb2_tmp, rec->key); + tdb_delete(idmap_tdb2_tmp, rec->value); + } + TALLOC_FREE(rec); + + if (!NT_STATUS_IS_OK(tdb2_store_bystring(ksidstr, string_term_tdb_data(kidstr), + TDB_INSERT))) { + DEBUG(0, ("Error storing SID -> ID\n")); + ret = NT_STATUS_UNSUCCESSFUL; + goto done; + } + if (!NT_STATUS_IS_OK(tdb2_store_bystring(kidstr, string_term_tdb_data(ksidstr), + TDB_INSERT))) { + DEBUG(0, ("Error storing ID -> SID\n")); + /* try to remove the previous stored SID -> ID map */ + tdb2_delete_bystring(ksidstr); + ret = NT_STATUS_UNSUCCESSFUL; + goto done; + } + + DEBUG(10,("Stored %s <-> %s\n", ksidstr, kidstr)); + ret = NT_STATUS_OK; + +done: + talloc_free(ksidstr); + talloc_free(kidstr); + SAFE_FREE(data.dptr); + TALLOC_FREE(update_lock); + return ret; +} + +/* + remove a mapping. +*/ +static NTSTATUS idmap_tdb2_remove_mapping(struct idmap_domain *dom, const struct id_map *map) +{ + /* not supported as it would invalidate the cache tdb on other + nodes */ + DEBUG(0,("idmap_tdb2_remove_mapping not supported\n")); + return NT_STATUS_NOT_SUPPORTED; +} + +/* + Close the idmap tdb instance +*/ +static NTSTATUS idmap_tdb2_close(struct idmap_domain *dom) +{ + /* don't do anything */ + return NT_STATUS_OK; +} + + +/* + Dump all mappings out +*/ +static NTSTATUS idmap_tdb2_dump_data(struct idmap_domain *dom, struct id_map **maps, int *num_maps) +{ + DEBUG(0,("idmap_tdb2_dump_data not supported\n")); + return NT_STATUS_NOT_SUPPORTED; +} + +static struct idmap_methods db_methods = { + .init = idmap_tdb2_db_init, + .unixids_to_sids = idmap_tdb2_unixids_to_sids, + .sids_to_unixids = idmap_tdb2_sids_to_unixids, + .set_mapping = idmap_tdb2_set_mapping, + .remove_mapping = idmap_tdb2_remove_mapping, + .dump_data = idmap_tdb2_dump_data, + .close_fn = idmap_tdb2_close +}; + +static struct idmap_alloc_methods db_alloc_methods = { + .init = idmap_tdb2_alloc_init, + .allocate_id = idmap_tdb2_allocate_id, + .get_id_hwm = idmap_tdb2_get_hwm, + .set_id_hwm = idmap_tdb2_set_hwm, + .close_fn = idmap_tdb2_alloc_close +}; + +NTSTATUS idmap_tdb2_init(void) +{ + NTSTATUS ret; + + /* register both backends */ + ret = smb_register_idmap_alloc(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_alloc_methods); + NT_STATUS_NOT_OK_RETURN(ret); + + return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_methods); +} -- cgit From 80f1cc3879b7c93a2fe3e5387992e0ef0ea985d9 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:28:28 +0300 Subject: Enable building of VFS modules: vfs_tsmsm, vfs_shadowcopy2 and IDMAP module idmap_tdb2 Signed-off-by: Alexander Bokovoy (This used to be commit 136c024c9a32ca8ca33cb36b9a6b731237179af5) --- source3/Makefile.in | 16 +++++++++++++++- source3/configure.in | 11 ++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 46f733c0bc..265d14547c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -308,7 +308,7 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/util_str.o lib/clobber.o lib/util_sid.o lib/util_uuid.o \ lib/util_unistr.o lib/util_file.o lib/data_blob.o \ lib/util.o lib/util_sock.o lib/sock_exec.o lib/util_sec.o \ - lib/substitute.o lib/fsusage.o \ + lib/substitute.o lib/fsusage.o lib/dbwrap_util.o \ lib/ms_fnmatch.o lib/select.o lib/errmap_unix.o \ lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \ lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \ @@ -503,6 +503,7 @@ VFS_READONLY_OBJ = modules/vfs_readonly.o modules/getdate.o VFS_CAP_OBJ = modules/vfs_cap.o VFS_EXPAND_MSDFS_OBJ = modules/vfs_expand_msdfs.o VFS_SHADOW_COPY_OBJ = modules/vfs_shadow_copy.o +VFS_SHADOW_COPY2_OBJ = modules/vfs_shadow_copy2.o VFS_AFSACL_OBJ = modules/vfs_afsacl.o VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o librpc/gen_ndr/ndr_xattr.o VFS_POSIXACL_OBJ = modules/vfs_posixacl.o @@ -520,6 +521,7 @@ VFS_COMMIT_OBJ = modules/vfs_commit.o VFS_GPFS_OBJ = modules/vfs_gpfs.o modules/gpfs.o modules/nfs4_acls.o VFS_NOTIFY_FAM_OBJ = modules/vfs_notify_fam.o VFS_READAHEAD_OBJ = modules/vfs_readahead.o +VFS_TSMSM_OBJ = modules/vfs_tsmsm.o VFS_FILEID_OBJ = modules/vfs_fileid.o VFS_SYNCOPS_OBJ = modules/vfs_syncops.o @@ -1611,6 +1613,10 @@ bin/ad.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ad.o @echo "Building plugin $@" @$(SHLD_MODULE) winbindd/idmap_ad.o +bin/tdb2.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_tdb2.o + @echo "Building plugin $@" + @$(SHLD_MODULE) winbindd/idmap_tdb2.o + bin/ldap.@SHLIBEXT@: $(BINARY_PREREQS) winbindd/idmap_ldap.o @echo "Building plugin $@" @$(SHLD_MODULE) winbindd/idmap_ldap.o @@ -1670,6 +1676,10 @@ bin/shadow_copy.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SHADOW_COPY_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_SHADOW_COPY_OBJ) +bin/shadow_copy2.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SHADOW_COPY2_OBJ) + @echo "Building plugin $@" + @$(SHLD_MODULE) $(VFS_SHADOW_COPY2_OBJ) + bin/syncops.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_SYNCOPS_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_SYNCOPS_OBJ) @@ -1750,6 +1760,10 @@ bin/readahead.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_READAHEAD_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_READAHEAD_OBJ) +bin/tsmsm.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_TSMSM_OBJ) + @echo "Building plugin $@" + @$(SHLD_MODULE) $(VFS_TSMSM_OBJ) + bin/fileid.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_FILEID_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_FILEID_OBJ) diff --git a/source3/configure.in b/source3/configure.in index cd04b598c0..f65eb3c204 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -707,7 +707,7 @@ dnl These have to be built static: default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template" dnl These are preferably build shared, and static if dlopen() is not available -default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb" +default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb" if test "x$developer" = xyes; then default_static_modules="$default_static_modules rpc_rpcecho" @@ -2751,6 +2751,12 @@ AC_SUBST(SMB_FAM_LIBS) SMB_CHECK_DMAPI([], AC_MSG_NOTICE(DMAPI support not present) ) +# Add TSM SM VFS module only if there are both GPFS and DMAPI support +# Theoretically it should work with AIX JFS2 too but this needs testing +if test x"$samba_cv_HAVE_GPFS" = x"yes" && test x"$samba_dmapi_libs" != x"" ; then + default_shared_modules="$default_shared_modules vfs_tsmsm" +fi + AC_CACHE_CHECK([for kernel share modes],samba_cv_HAVE_KERNEL_SHARE_MODES,[ AC_TRY_RUN([ #include @@ -6452,6 +6458,7 @@ SMB_SUBSYSTEM(RPC,smbd/server.o) SMB_MODULE(idmap_ldap, winbindd/idmap_ldap.o, "bin/ldap.$SHLIBEXT", IDMAP) SMB_MODULE(idmap_tdb, winbindd/idmap_tdb.o, "bin/tdb.$SHLIBEXT", IDMAP) +SMB_MODULE(idmap_tdb2, winbindd/idmap_tdb2.o, "bin/tdb2.$SHLIBEXT", IDMAP) SMB_MODULE(idmap_passdb, winbindd/idmap_passdb.o, "bin/passdb.$SHLIBEXT", IDMAP) SMB_MODULE(idmap_nss, winbindd/idmap_nss.o, "bin/nss.$SHLIBEXT", IDMAP) SMB_MODULE(idmap_rid, winbindd/idmap_rid.o, "bin/rid.$SHLIBEXT", IDMAP) @@ -6488,6 +6495,7 @@ SMB_MODULE(vfs_readonly, \$(VFS_READONLY_OBJ), "bin/readonly.$SHLIBEXT", VFS) SMB_MODULE(vfs_cap, \$(VFS_CAP_OBJ), "bin/cap.$SHLIBEXT", VFS) SMB_MODULE(vfs_expand_msdfs, \$(VFS_EXPAND_MSDFS_OBJ), "bin/expand_msdfs.$SHLIBEXT", VFS) SMB_MODULE(vfs_shadow_copy, \$(VFS_SHADOW_COPY_OBJ), "bin/shadow_copy.$SHLIBEXT", VFS) +SMB_MODULE(vfs_shadow_copy2, \$(VFS_SHADOW_COPY2_OBJ), "bin/shadow_copy2.$SHLIBEXT", VFS) SMB_MODULE(vfs_afsacl, \$(VFS_AFSACL_OBJ), "bin/afsacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_xattr_tdb, \$(VFS_XATTR_TDB_OBJ), "bin/xattr_tdb.$SHLIBEXT", VFS) SMB_MODULE(vfs_posixacl, \$(VFS_POSIXACL_OBJ), "bin/posixacl.$SHLIBEXT", VFS) @@ -6503,6 +6511,7 @@ SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS) SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS) SMB_MODULE(vfs_gpfs, \$(VFS_GPFS_OBJ), "bin/gpfs.$SHLIBEXT", VFS) SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS) +SMB_MODULE(vfs_tsmsm, \$(VFS_TSMSM_OBJ), "bin/tsmsm.$SHLIBEXT", VFS) SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS) SMB_MODULE(vfs_syncops, \$(VFS_SYNCOPS_OBJ), "bin/syncops.$SHLIBEXT", VFS) SMB_MODULE(vfs_zfsacl, \$(VFS_ZFSACL_OBJ), "bin/zfsacl.$SHLIBEXT", VFS) -- cgit From 1e0abd97f9f6919ca338ee696d35064efd0f8774 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:28:52 +0300 Subject: Fix build for pam_smbpass Signed-off-by: Alexander Bokovoy (This used to be commit 060587fce558bf9e83d6c7b8e070a5ae58e3f275) --- source3/pam_smbpass/pam_smb_acct.c | 2 +- source3/pam_smbpass/pam_smb_passwd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c index 59ed4eee8b..b9bcb31091 100644 --- a/source3/pam_smbpass/pam_smb_acct.c +++ b/source3/pam_smbpass/pam_smb_acct.c @@ -78,7 +78,7 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags, } if (geteuid() != 0) { - _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root."); + _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root."); return PAM_AUTHINFO_UNAVAIL; } diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c index de5310761f..326a0b59e7 100644 --- a/source3/pam_smbpass/pam_smb_passwd.c +++ b/source3/pam_smbpass/pam_smb_passwd.c @@ -130,7 +130,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, } if (geteuid() != 0) { - _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root."); + _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root."); return PAM_AUTHINFO_UNAVAIL; } -- cgit From b9d21dd668d3032643bf8d465d7b988de2d2f49a Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 12:28:52 +0300 Subject: Fix build for pam_smbpass Signed-off-by: Alexander Bokovoy (This used to be commit dc568fd52ae8ffaaaef2015c5a207ed9a58a9a7f) --- source3/pam_smbpass/pam_smb_acct.c | 2 +- source3/pam_smbpass/pam_smb_passwd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/pam_smbpass/pam_smb_acct.c b/source3/pam_smbpass/pam_smb_acct.c index 59ed4eee8b..b9bcb31091 100644 --- a/source3/pam_smbpass/pam_smb_acct.c +++ b/source3/pam_smbpass/pam_smb_acct.c @@ -78,7 +78,7 @@ int pam_sm_acct_mgmt( pam_handle_t *pamh, int flags, } if (geteuid() != 0) { - _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root."); + _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root."); return PAM_AUTHINFO_UNAVAIL; } diff --git a/source3/pam_smbpass/pam_smb_passwd.c b/source3/pam_smbpass/pam_smb_passwd.c index de5310761f..326a0b59e7 100644 --- a/source3/pam_smbpass/pam_smb_passwd.c +++ b/source3/pam_smbpass/pam_smb_passwd.c @@ -130,7 +130,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, } if (geteuid() != 0) { - _log_err(pamh, LOG_DEBUG, "Cannot access samba password database, not running as root."); + _log_err( LOG_DEBUG, "Cannot access samba password database, not running as root."); return PAM_AUTHINFO_UNAVAIL; } -- cgit From 1bb220174fdefb36106124736eccd9c0a55d07d7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 10:37:48 +0100 Subject: Avoid use of NDR_PRINT_X_DEBUG (that debugs with level 0) in libnetjoin. Guenther (This used to be commit 357a393b106fe88629bf5f6c634d16c0fc47cee9) --- source3/libnet/libnet_join.c | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index a189a38ea3..49868192e8 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -24,6 +24,35 @@ /**************************************************************** ****************************************************************/ +#define LIBNET_JOIN_DUMP_CTX(ctx, r, f) \ + do { \ + char *str = NULL; \ + str = NDR_PRINT_FUNCTION_STRING(ctx, libnet_JoinCtx, f, r); \ + DEBUG(1,("libnet_Join:\n%s", str)); \ + talloc_free(str); \ + } while (0) + +#define LIBNET_JOIN_IN_DUMP_CTX(ctx, r) \ + LIBNET_JOIN_DUMP_CTX(ctx, r, NDR_IN | NDR_SET_VALUES) +#define LIBNET_JOIN_OUT_DUMP_CTX(ctx, r) \ + LIBNET_JOIN_DUMP_CTX(ctx, r, NDR_OUT) + +#define LIBNET_UNJOIN_DUMP_CTX(ctx, r, f) \ + do { \ + char *str = NULL; \ + str = NDR_PRINT_FUNCTION_STRING(ctx, libnet_UnjoinCtx, f, r); \ + DEBUG(1,("libnet_Unjoin:\n%s", str)); \ + talloc_free(str); \ + } while (0) + +#define LIBNET_UNJOIN_IN_DUMP_CTX(ctx, r) \ + LIBNET_UNJOIN_DUMP_CTX(ctx, r, NDR_IN | NDR_SET_VALUES) +#define LIBNET_UNJOIN_OUT_DUMP_CTX(ctx, r) \ + LIBNET_UNJOIN_DUMP_CTX(ctx, r, NDR_OUT) + +/**************************************************************** +****************************************************************/ + static void libnet_join_set_error_string(TALLOC_CTX *mem_ctx, struct libnet_JoinCtx *r, const char *format, ...) @@ -1214,7 +1243,7 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, WERROR werr; if (r->in.debug) { - NDR_PRINT_IN_DEBUG(libnet_JoinCtx, r); + LIBNET_JOIN_IN_DUMP_CTX(mem_ctx, r); } werr = libnet_join_pre_processing(mem_ctx, r); @@ -1234,8 +1263,10 @@ WERROR libnet_Join(TALLOC_CTX *mem_ctx, goto done; } done: + r->out.result = werr; + if (r->in.debug) { - NDR_PRINT_OUT_DEBUG(libnet_JoinCtx, r); + LIBNET_JOIN_OUT_DUMP_CTX(mem_ctx, r); } return werr; } @@ -1328,7 +1359,7 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, WERROR werr; if (r->in.debug) { - NDR_PRINT_IN_DEBUG(libnet_UnjoinCtx, r); + LIBNET_UNJOIN_IN_DUMP_CTX(mem_ctx, r); } werr = libnet_unjoin_pre_processing(mem_ctx, r); @@ -1349,8 +1380,10 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx, } done: + r->out.result = werr; + if (r->in.debug) { - NDR_PRINT_OUT_DEBUG(libnet_UnjoinCtx, r); + LIBNET_UNJOIN_OUT_DUMP_CTX(mem_ctx, r); } return werr; -- cgit From 1311918d177723616a01ac5fa2c61d2f93b431a2 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 10:48:11 +0100 Subject: Nicen some error strings in libnetjoin. Guenther (This used to be commit 05cf1413cc92e15bbe7ba0477df282ad31e40412) --- source3/libnet/libnet_join.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 49868192e8..f699b09b78 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1176,8 +1176,9 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, &info); if (!NT_STATUS_IS_OK(status)) { libnet_join_set_error_string(mem_ctx, r, - "failed to find DC: %s", - nt_errstr(status)); + "failed to find DC for domain %s", + r->in.domain_name, + get_friendly_nt_error_msg(status)); return WERR_DOMAIN_CONTROLLER_NOT_FOUND; } @@ -1211,7 +1212,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, if (!NT_STATUS_IS_OK(status)) { libnet_join_set_error_string(mem_ctx, r, "failed to join domain over rpc: %s", - nt_errstr(status)); + get_friendly_nt_error_msg(status)); if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { return WERR_SETUP_ALREADY_JOINED; } @@ -1292,8 +1293,9 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, &info); if (!NT_STATUS_IS_OK(status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to find DC: %s", - nt_errstr(status)); + "failed to find DC for domain %s", + r->in.domain_name, + get_friendly_nt_error_msg(status)); return WERR_DOMAIN_CONTROLLER_NOT_FOUND; } @@ -1305,8 +1307,8 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, status = libnet_join_unjoindomain_rpc(mem_ctx, r); if (!NT_STATUS_IS_OK(status)) { libnet_unjoin_set_error_string(mem_ctx, r, - "failed to unjoin domain: %s", - nt_errstr(status)); + "failed to disable machine account via rpc: %s", + get_friendly_nt_error_msg(status)); if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) { return WERR_SETUP_NOT_JOINED; } @@ -1350,6 +1352,7 @@ static WERROR libnet_unjoin_pre_processing(TALLOC_CTX *mem_ctx, return WERR_OK; } + /**************************************************************** ****************************************************************/ -- cgit From 168e122682debee53041250292da214f88f534fa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 10:56:40 +0100 Subject: Autofetch domain_sid while unjoining in libnetjoin. Guenther (This used to be commit 622109895c56ed7cc02dac006f02cac89424b569) --- source3/libnet/libnet_join.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index f699b09b78..af7f9a6a21 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1280,6 +1280,17 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, { NTSTATUS status; + if (!r->in.domain_sid) { + struct dom_sid sid; + if (!secrets_fetch_domain_sid(lp_workgroup(), &sid)) { + libnet_unjoin_set_error_string(mem_ctx, r, + "Unable to fetch domain sid: are we joined?"); + return WERR_SETUP_NOT_JOINED; + } + r->in.domain_sid = sid_dup_talloc(mem_ctx, &sid); + W_ERROR_HAVE_NO_MEMORY(r->in.domain_sid); + } + if (!r->in.dc_name) { struct DS_DOMAIN_CONTROLLER_INFO *info; status = dsgetdcname(mem_ctx, -- cgit From 41c72bd80465122d836fe19a784982bf5cb82cdd Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 11:02:52 +0100 Subject: Fix (non-activated) _wkssvc_NetrJoinDomain2 server code. Guenther (This used to be commit dea64a0d886919dfd5bcc550cb36deabe4ec010d) --- source3/rpc_server/srv_wkssvc_nt.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c index 849ec9c4eb..de2e33732d 100644 --- a/source3/rpc_server/srv_wkssvc_nt.c +++ b/source3/rpc_server/srv_wkssvc_nt.c @@ -287,7 +287,7 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r { #if 0 struct libnet_JoinCtx *j = NULL; - char *pwd = NULL; + char *cleartext_pwd = NULL; char *admin_domain = NULL; char *admin_account = NULL; WERROR werr; @@ -308,12 +308,7 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r werr = decode_wkssvc_join_password_buffer(p->mem_ctx, r->in.encrypted_password, &p->session_key, - &pwd); - if (!W_ERROR_IS_OK(werr)) { - return werr; - } - - werr = libnet_init_JoinCtx(p->mem_ctx, &j); + &cleartext_pwd); if (!W_ERROR_IS_OK(werr)) { return werr; } @@ -323,7 +318,7 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r &admin_domain, &admin_account); - status = DsGetDcName(p->mem_ctx, + status = dsgetdcname(p->mem_ctx, NULL, r->in.domain_name, NULL, @@ -336,14 +331,18 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p, struct wkssvc_NetrJoinDomain2 *r return ntstatus_to_werror(status); } - j->in.server_name = info->domain_controller_name; + werr = libnet_init_JoinCtx(p->mem_ctx, &j); + if (!W_ERROR_IS_OK(werr)) { + return werr; + } + + j->in.dc_name = info->domain_controller_name; j->in.domain_name = r->in.domain_name; j->in.account_ou = r->in.account_ou; j->in.join_flags = r->in.join_flags; - - j->in.admin_account = admin_account; - j->in.password = pwd; - j->in.modify_config = true; + j->in.admin_account = admin_account; + j->in.admin_password = cleartext_pwd; + j->in.modify_config = true; become_root(); werr = libnet_Join(p->mem_ctx, j); -- cgit From 594a1645482cd4f993df7d63f5037a159de03442 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 11:39:20 +0100 Subject: Fix a crash bug in nt_printer_publish_ads Reported by Martin Zielinski (This used to be commit 4db26c803de52d3efccc940efc55f14131a057f5) --- source3/printing/nt_printing.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index bba55c0e4a..d5803b711b 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -3315,8 +3315,13 @@ static WERROR nt_printer_publish_ads(ADS_STRUCT *ads, /* publish it */ ads_rc = ads_mod_printer_entry(ads, prt_dn, ctx, &mods); - if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) + if (ads_rc.err.rc == LDAP_NO_SUCH_OBJECT) { + int i; + for (i=0; mods[i] != 0; i++) + ; + mods[i] = (LDAPMod *)-1; ads_rc = ads_add_printer_entry(ads, prt_dn, ctx, &mods); + } if (!ADS_ERR_OK(ads_rc)) DEBUG(3, ("error publishing %s: %s\n", printer->info_2->sharename, ads_errstr(ads_rc))); -- cgit From 024741500abd30ac74adfdfa88694026792ba284 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 16 Jan 2008 16:50:46 +0300 Subject: Convert old sid-string handling in idmap_tdb2 to a new one (This used to be commit ee851730cef1eb506b47faf57e25789ad3c6aafa) --- source3/winbindd/idmap_tdb2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index fa106aa134..ab89e615f7 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -610,7 +610,7 @@ static NTSTATUS idmap_tdb2_id_to_sid(struct idmap_tdb2_context *ctx, struct id_m goto done; } - if (sid_to_string(sidstr, map->sid)) { + if (sid_to_fstring(sidstr, map->sid)) { /* both forward and reverse mappings */ tdb2_store_bystring(keystr, string_term_tdb_data(sidstr), @@ -648,7 +648,7 @@ static NTSTATUS idmap_tdb2_sid_to_id(struct idmap_tdb2_context *ctx, struct id_m char *keystr; unsigned long rec_id = 0; - if ((keystr = talloc_asprintf(ctx, "%s", sid_string_static(map->sid))) == NULL) { + if ((keystr = sid_string_talloc(ctx, map->sid)) == NULL) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -859,7 +859,7 @@ static NTSTATUS idmap_tdb2_set_mapping(struct idmap_domain *dom, const struct id goto done; } - if (!(ksidstr = talloc_strdup(ctx, sid_string_static(map->sid)))) { + if (!(ksidstr = sid_string_talloc(ctx, map->sid))) { DEBUG(0, ("Out of memory!\n")); ret = NT_STATUS_NO_MEMORY; goto done; @@ -1008,7 +1008,10 @@ NTSTATUS idmap_tdb2_init(void) /* register both backends */ ret = smb_register_idmap_alloc(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_alloc_methods); - NT_STATUS_NOT_OK_RETURN(ret); + if (! NT_STATUS_IS_OK(ret)) { + DEBUG(0, ("Unable to register idmap alloc tdb2 module: %s\n", get_friendly_nt_error_msg(ret))); + return ret; + } return smb_register_idmap(SMB_IDMAP_INTERFACE_VERSION, "tdb2", &db_methods); } -- cgit From 12d31ba2b8b4c0e15567d427abef97a184450b1f Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 16 Jan 2008 14:35:44 +0000 Subject: Add a (very!) trivial cache to the example authentication callback. (This used to be commit 01f6a4cca7a91ae41ff393263418216324502f84) --- examples/libsmbclient/get_auth_data_fn.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h index eb493885af..b1d36c8bea 100644 --- a/examples/libsmbclient/get_auth_data_fn.h +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -8,7 +8,23 @@ get_auth_data_fn(const char * pServer, char * pPassword, int maxLenPassword) { - char temp[128]; + char temp[128]; + char server[256] = { '\0' }; + char share[256] = { '\0' }; + char workgroup[256] = { '\0' }; + char username[256] = { '\0' }; + char password[256] = { '\0' }; + + if (strcmp(server, pServer) == 0 && + strcmp(share, pShare) == 0 && + *workgroup != '\0' && + *username != '\0') + { + strncpy(pWorkgroup, workgroup, maxLenWorkgroup - 1); + strncpy(pUsername, username, maxLenUsername - 1); + strncpy(pPassword, password, maxLenPassword - 1); + return; + } fprintf(stdout, "Workgroup: [%s] ", pWorkgroup); fgets(temp, sizeof(temp), stdin); @@ -48,4 +64,8 @@ get_auth_data_fn(const char * pServer, { strncpy(pPassword, temp, maxLenPassword - 1); } + + strncpy(workgroup, pWorkgroup, sizeof(workgroup) - 1); + strncpy(username, pUsername, sizeof(username) - 1); + strncpy(password, pPassword, sizeof(password) - 1); } -- cgit From 735e98759c0f860727c24c4cdb14235abdeb8879 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 16 Jan 2008 14:37:40 +0000 Subject: Replace GetTimeOfDay() with gettimeofday() in example program. GetTimeOfDay() seems to no longer be exported. For the smbsh example, just use the native gettimeofday() for now. (This used to be commit 296a6783fbc03460e87ac4136a0a9e6d2743b2ff) --- examples/libsmbclient/smbwrapper/select.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/libsmbclient/smbwrapper/select.c b/examples/libsmbclient/smbwrapper/select.c index 4e87a2e2e8..bb7a25f13e 100644 --- a/examples/libsmbclient/smbwrapper/select.c +++ b/examples/libsmbclient/smbwrapper/select.c @@ -72,13 +72,12 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf int ret; fd_set *readfds2, readfds_buf, *writefds2, writefds_buf, *errorfds2, errorfds_buf; struct timeval tval2, *ptval, end_time, now_time; - extern void GetTimeOfDay(struct timeval *tval); readfds2 = (readfds ? &readfds_buf : NULL); writefds2 = (writefds ? &writefds_buf : NULL); errorfds2 = (errorfds ? &errorfds_buf : NULL); if (tval) { - GetTimeOfDay(&end_time); + gettimeofday(&end_time, NULL); end_time.tv_sec += tval->tv_sec; end_time.tv_usec += tval->tv_usec; end_time.tv_sec += end_time.tv_usec / 1000000; @@ -96,7 +95,7 @@ int sys_select_intr(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *errorf if (errorfds) errorfds_buf = *errorfds; if (tval) { - GetTimeOfDay(&now_time); + gettimeofday(&now_time, NULL); tval2.tv_sec = end_time.tv_sec - now_time.tv_sec; tval2.tv_usec = end_time.tv_usec - now_time.tv_usec; if ((signed long) tval2.tv_usec < 0) { -- cgit From 3e494442de5eff6d0619c793eef139c15efe0657 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Wed, 16 Jan 2008 14:41:11 +0000 Subject: Modify testread example to loop using same context. There's been a problem seen where open/read/close a number of times causes open failures eventually. This program has been modified to create the context once and then loop requesting file names to open/read/close. This program also demonstrates the current error in cli_read() where it returns an error instead of length 0 upon end of file. Derrell (This used to be commit 9d75ea577b407ccab59196760d376831062a3ab5) --- examples/libsmbclient/testread.c | 76 ++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/examples/libsmbclient/testread.c b/examples/libsmbclient/testread.c index d59fc70ec1..3f94884895 100644 --- a/examples/libsmbclient/testread.c +++ b/examples/libsmbclient/testread.c @@ -10,66 +10,58 @@ int main(int argc, char * argv[]) { + int i; int fd; int ret; int debug = 0; int mode = 0666; int savedErrno; char buffer[2048]; - char * pSmbPath = NULL; + char path[2048]; + char * p; time_t t0; time_t t1; struct stat st; - if (argc == 1) - { - pSmbPath = "smb://RANDOM/Public/bigfile"; - } - else if (argc == 2) - { - pSmbPath = argv[1]; - } - else - { - printf("usage: " - "%s [ smb://path/to/file ]\n", - argv[0]); - return 1; - } - smbc_init(get_auth_data_fn, debug); - printf("Open file %s\n", pSmbPath); - - t0 = time(NULL); - - if ((fd = smbc_open(pSmbPath, O_RDONLY, 0)) < 0) + for (;;) { - perror("smbc_open"); - return 1; - } + fprintf(stdout, "Path: "); + *path = '\0'; + fgets(path, sizeof(path) - 1, stdin); + if (strlen(path) == 0) + { + return 0; + } - printf("Beginning read loop.\n"); + p = path + strlen(path) - 1; + if (*p == '\n') + { + *p = '\0'; + } + + if ((fd = smbc_open(path, O_RDONLY, 0)) < 0) + { + perror("smbc_open"); + continue; + } - do - { - ret = smbc_read(fd, buffer, sizeof(buffer)); - savedErrno = errno; - if (ret > 0) fwrite(buffer, 1, ret, stdout); - } while (ret > 0); + do + { + ret = smbc_read(fd, buffer, sizeof(buffer)); + savedErrno = errno; + if (ret > 0) fwrite(buffer, 1, ret, stdout); + } while (ret > 0); - smbc_close(fd); + smbc_close(fd); - if (ret < 0) - { - errno = savedErrno; - perror("read"); - return 1; + if (ret < 0) + { + errno = savedErrno; + perror("read"); + } } - t1 = time(NULL); - - printf("Elapsed time: %d seconds\n", t1 - t0); - return 0; } -- cgit From 94fdd59f1c2a41b8e737aa8ca8939e9bf2b59a77 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Wed, 19 Dec 2007 17:48:43 +0300 Subject: Adds support for cifs.resolver upcall. Here is a patch for userspace cifs.spnego handler that adds support for cifs.resolver upcall used in DFS code. Any comments are appreciated. ############################# Cifs upcall with key type cifs.resolver is used for resolving server names in handling DFS refferals. Signed-off-by: Igor Mammedov (This used to be commit dfc80b4f1c00c131ba8077432bfe79f22f63ccd1) --- source3/client/cifs.spnego.c | 63 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/source3/client/cifs.spnego.c b/source3/client/cifs.spnego.c index caa22276c4..d10d19da96 100644 --- a/source3/client/cifs.spnego.c +++ b/source3/client/cifs.spnego.c @@ -3,11 +3,13 @@ * Copyright (C) Igor Mammedov (niallain@gmail.com) 2007 * * Used by /sbin/request-key for handling -* cifs upcall for kerberos authorization of access to share. +* cifs upcall for kerberos authorization of access to share and +* cifs upcall for DFS srver name resolving (IPv4/IPv6 aware). * You should have keyutils installed and add following line to * /etc/request-key.conf file create cifs.spnego * * /usr/local/sbin/cifs.spnego [-v][-c] %k +create cifs.resolver * * /usr/local/sbin/cifs.spnego [-v] %k * 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 @@ -27,7 +29,7 @@ create cifs.spnego * * /usr/local/sbin/cifs.spnego [-v][-c] %k #include "cifs_spnego.h" -const char* CIFSSPNEGO_VERSION="1.0"; +const char *CIFSSPNEGO_VERSION = "1.1"; static const char *prog = "cifs.spnego"; typedef enum _secType { KRB5, @@ -146,6 +148,58 @@ int decode_key_description(const char *desc, int *ver, secType_t * sec, return retval; } +int cifs_resolver(const key_serial_t key, const char *key_descr) +{ + int c; + struct addrinfo *addr; + char ip[INET6_ADDRSTRLEN]; + void *p; + const char *keyend = key_descr; + /* skip next 4 ';' delimiters to get to description */ + for (c = 1; c <= 4; c++) { + keyend = index(keyend+1, ';'); + if (!keyend) { + syslog(LOG_WARNING, "invalid key description: %s", + key_descr); + return 1; + } + } + keyend++; + + /* resolve name to ip */ + c = getaddrinfo(keyend, NULL, NULL, &addr); + if (c) { + syslog(LOG_WARNING, "unable to resolve hostname: %s [%s]", + keyend, gai_strerror(c)); + return 1; + } + + /* conver ip to string form */ + if (addr->ai_family == AF_INET) { + p = &(((struct sockaddr_in *)addr->ai_addr)->sin_addr); + } else { + p = &(((struct sockaddr_in6 *)addr->ai_addr)->sin6_addr); + } + if (!inet_ntop(addr->ai_family, p, ip, sizeof(ip))) { + syslog(LOG_WARNING, "%s: inet_ntop: %s", + __FUNCTION__, strerror(errno)); + freeaddrinfo(addr); + return 1; + } + + /* setup key */ + c = keyctl_instantiate(key, ip, strlen(ip)+1, 0); + if (c == -1) { + syslog(LOG_WARNING, "%s: keyctl_instantiate: %s", + __FUNCTION__, strerror(errno)); + freeaddrinfo(addr); + return 1; + } + + freeaddrinfo(addr); + return 0; +} + int main(const int argc, char *const argv[]) { struct cifs_spnego_msg *keydata = NULL; @@ -199,6 +253,11 @@ int main(const int argc, char *const argv[]) goto out; } + if (strncmp(buf, "cifs.resolver", sizeof("cifs.resolver")-1) == 0) { + rc = cifs_resolver(key, buf); + goto out; + } + rc = decode_key_description(buf, &kernel_upcall_version, §ype, &hostname, &uid); if ((rc & DKD_MUSTHAVE_SET) != DKD_MUSTHAVE_SET) { -- cgit From fbcc7820c620d45f02ab75e08d840e3a676fe671 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 15:51:52 +0100 Subject: Fix memleak in ads_build_path(). Guenther (This used to be commit b7a06b54e0a58c4cd6c5351b1e4a0a2c253cfea1) --- source3/libads/ads_struct.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index 041878916e..44bcdf76ea 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -32,18 +32,23 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int r = SMB_STRDUP(realm); - if (!r || !*r) + if (!r || !*r) { return r; + } - for (p=r; *p; p++) - if (strchr(sep, *p)) + for (p=r; *p; p++) { + if (strchr(sep, *p)) { numbits++; + } + } len = (numbits+1)*(strlen(field)+1) + strlen(r) + 1; ret = (char *)SMB_MALLOC(len); - if (!ret) + if (!ret) { + free(r); return NULL; + } strlcpy(ret,field, len); p=strtok(r,sep); @@ -57,7 +62,8 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int else asprintf(&s, "%s,%s%s", ret, field, p); free(ret); - ret = s; + ret = SMB_STRDUP(s); + free(s); } } -- cgit From d06559c1e6ac0d9a9092e21c703397eb588aef94 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 15:52:53 +0100 Subject: Make resolve_ads() static. Guenther (This used to be commit 57dc747136e880a25c03bdc4a1431fc41afd93a1) --- source3/libsmb/namequery.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index ad999b34b4..ad16452e3e 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1299,11 +1299,11 @@ static NTSTATUS resolve_hosts(const char *name, int name_type, Resolve via "ADS" method. *********************************************************/ -NTSTATUS resolve_ads(const char *name, - int name_type, - const char *sitename, - struct ip_service **return_iplist, - int *return_count) +static NTSTATUS resolve_ads(const char *name, + int name_type, + const char *sitename, + struct ip_service **return_iplist, + int *return_count) { int i, j; NTSTATUS status; -- cgit From 0331ff72f055b5b037c2dbab94ee6484965ad1b0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 16:01:50 +0100 Subject: Add lsa_PolicyAuditEventType and lsa_PolicyAuditPolicy enums from samba3 to IDL. Guenther (This used to be commit 92bfa25922860a6951c72d41799f4d3c1bc7a007) --- source3/librpc/idl/lsa.idl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index 7daf648a63..54a71df74f 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -138,9 +138,29 @@ import "security.idl"; uint32 unknown; } lsa_AuditLogInfo; + typedef [v1_enum] enum { + LSA_AUDIT_POLICY_NONE=0, + LSA_AUDIT_POLICY_SUCCESS=1, + LSA_AUDIT_POLICY_FAILURE=2, + LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE), + LSA_AUDIT_POLICY_CLEAR=4 + } lsa_PolicyAuditPolicy; + + typedef enum { + LSA_AUDIT_CATEGORY_SYSTEM = 0, + LSA_AUDIT_CATEGORY_LOGON = 1, + LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2, + LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3, + LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4, + LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5, + LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6, + LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */ + LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */ + } lsa_PolicyAuditEventType; + typedef struct { uint32 auditing_mode; - [size_is(count)] uint32 *settings; + [size_is(count)] lsa_PolicyAuditPolicy *settings; uint32 count; } lsa_AuditEventsInfo; -- cgit From 587a2dbf8d000640109c2b36a924cd4c2694897f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 16:31:49 +0100 Subject: Merge lsarpc.idl from samba4 and rerun make idl. Guenther (This used to be commit d9c8a2271d5d4ff845f1fe5986a2c63d79c41415) --- source3/include/rpc_lsa.h | 19 -- source3/librpc/gen_ndr/cli_lsa.c | 26 +- source3/librpc/gen_ndr/cli_lsa.h | 16 +- source3/librpc/gen_ndr/lsa.h | 135 +++++++- source3/librpc/gen_ndr/ndr_lsa.c | 679 +++++++++++++++++++++++++++++++++++---- source3/librpc/gen_ndr/ndr_lsa.h | 46 ++- source3/librpc/gen_ndr/srv_lsa.c | 21 +- source3/librpc/gen_ndr/srv_lsa.h | 2 +- source3/librpc/idl/lsa.idl | 105 ++++-- source3/rpc_server/srv_lsa_nt.c | 2 +- 10 files changed, 914 insertions(+), 137 deletions(-) diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h index ef6ff6db28..72aabc310e 100644 --- a/source3/include/rpc_lsa.h +++ b/source3/include/rpc_lsa.h @@ -87,27 +87,8 @@ #define LSA_AUDIT_NUM_CATEGORIES_NT4 7 #define LSA_AUDIT_NUM_CATEGORIES_WIN2K 9 - #define LSA_AUDIT_NUM_CATEGORIES LSA_AUDIT_NUM_CATEGORIES_NT4 -#define LSA_AUDIT_POLICY_NONE 0x00 -#define LSA_AUDIT_POLICY_SUCCESS 0x01 -#define LSA_AUDIT_POLICY_FAILURE 0x02 -#define LSA_AUDIT_POLICY_ALL (LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE) -#define LSA_AUDIT_POLICY_CLEAR 0x04 - -enum lsa_audit_categories { - LSA_AUDIT_CATEGORY_SYSTEM = 0, - LSA_AUDIT_CATEGORY_LOGON = 1, - LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS, - LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS, - LSA_AUDIT_CATEGORY_PROCCESS_TRACKING, - LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES, - LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT, - LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS, /* only in win2k/2k3 */ - LSA_AUDIT_CATEGORY_ACCOUNT_LOGON /* only in win2k/2k3 */ -}; - /* level 1 is auditing settings */ typedef struct dom_query_1 { diff --git a/source3/librpc/gen_ndr/cli_lsa.c b/source3/librpc/gen_ndr/cli_lsa.c index 92ba8bdfee..76370cabf1 100644 --- a/source3/librpc/gen_ndr/cli_lsa.c +++ b/source3/librpc/gen_ndr/cli_lsa.c @@ -609,7 +609,7 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count) { struct lsa_LookupNames r; @@ -2528,7 +2528,7 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) @@ -2920,7 +2920,7 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) @@ -3120,16 +3120,23 @@ NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, return r.out.result; } -NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx) +NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *trusted_domain_name, + uint16_t unknown, + struct lsa_ForestTrustInformation **forest_trust_info) { - struct lsa_LSARQUERYFORESTTRUSTINFORMATION r; + struct lsa_lsaRQueryForestTrustInformation r; NTSTATUS status; /* In parameters */ + r.in.handle = handle; + r.in.trusted_domain_name = trusted_domain_name; + r.in.unknown = unknown; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, &r); } status = cli_do_rpc_ndr(cli, @@ -3144,7 +3151,7 @@ NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -3152,6 +3159,7 @@ NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } /* Return variables */ + *forest_trust_info = *r.out.forest_trust_info; /* Return result */ return r.out.result; @@ -3292,7 +3300,7 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2) diff --git a/source3/librpc/gen_ndr/cli_lsa.h b/source3/librpc/gen_ndr/cli_lsa.h index 4ab8be9939..c45aed1d37 100644 --- a/source3/librpc/gen_ndr/cli_lsa.h +++ b/source3/librpc/gen_ndr/cli_lsa.h @@ -71,7 +71,7 @@ NTSTATUS rpccli_lsa_LookupNames(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count); NTSTATUS rpccli_lsa_LookupSids(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -280,7 +280,7 @@ NTSTATUS rpccli_lsa_LookupNames2(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray2 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); @@ -309,7 +309,7 @@ NTSTATUS rpccli_lsa_LookupNames3(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); @@ -321,8 +321,12 @@ NTSTATUS rpccli_lsa_LSARGENAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_lsa_LSARUNREGISTERAUDITEVENT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); -NTSTATUS rpccli_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx); +NTSTATUS rpccli_lsa_lsaRQueryForestTrustInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + struct lsa_String *trusted_domain_name, + uint16_t unknown, + struct lsa_ForestTrustInformation **forest_trust_info); NTSTATUS rpccli_lsa_LSARSETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_lsa_CREDRRENAME(struct rpc_pipe_client *cli, @@ -342,7 +346,7 @@ NTSTATUS rpccli_lsa_LookupNames4(struct rpc_pipe_client *cli, struct lsa_String *names, struct lsa_RefDomainList *domains, struct lsa_TransSidArray3 *sids, - uint16_t level, + enum lsa_LookupNamesLevel level, uint32_t *count, uint32_t unknown1, uint32_t unknown2); diff --git a/source3/librpc/gen_ndr/lsa.h b/source3/librpc/gen_ndr/lsa.h index 513d17b5df..cbaa9083e4 100644 --- a/source3/librpc/gen_ndr/lsa.h +++ b/source3/librpc/gen_ndr/lsa.h @@ -75,9 +75,55 @@ struct lsa_AuditLogInfo { uint32_t unknown; }; +enum lsa_PolicyAuditPolicy +#ifndef USE_UINT_ENUMS + { + LSA_AUDIT_POLICY_NONE=0, + LSA_AUDIT_POLICY_SUCCESS=1, + LSA_AUDIT_POLICY_FAILURE=2, + LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE), + LSA_AUDIT_POLICY_CLEAR=4 +} +#else + { __donnot_use_enum_lsa_PolicyAuditPolicy=0x7FFFFFFF} +#define LSA_AUDIT_POLICY_NONE ( 0 ) +#define LSA_AUDIT_POLICY_SUCCESS ( 1 ) +#define LSA_AUDIT_POLICY_FAILURE ( 2 ) +#define LSA_AUDIT_POLICY_ALL ( (LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE) ) +#define LSA_AUDIT_POLICY_CLEAR ( 4 ) +#endif +; + +enum lsa_PolicyAuditEventType +#ifndef USE_UINT_ENUMS + { + LSA_AUDIT_CATEGORY_SYSTEM=0, + LSA_AUDIT_CATEGORY_LOGON=1, + LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS=2, + LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS=3, + LSA_AUDIT_CATEGORY_PROCCESS_TRACKING=4, + LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES=5, + LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT=6, + LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS=7, + LSA_AUDIT_CATEGORY_ACCOUNT_LOGON=8 +} +#else + { __donnot_use_enum_lsa_PolicyAuditEventType=0x7FFFFFFF} +#define LSA_AUDIT_CATEGORY_SYSTEM ( 0 ) +#define LSA_AUDIT_CATEGORY_LOGON ( 1 ) +#define LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS ( 2 ) +#define LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS ( 3 ) +#define LSA_AUDIT_CATEGORY_PROCCESS_TRACKING ( 4 ) +#define LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES ( 5 ) +#define LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT ( 6 ) +#define LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS ( 7 ) +#define LSA_AUDIT_CATEGORY_ACCOUNT_LOGON ( 8 ) +#endif +; + struct lsa_AuditEventsInfo { uint32_t auditing_mode; - uint32_t *settings;/* [unique,size_is(count)] */ + enum lsa_PolicyAuditPolicy *settings;/* [unique,size_is(count)] */ uint32_t count; }; @@ -240,6 +286,27 @@ struct lsa_RefDomainList { uint32_t max_size; }; +enum lsa_LookupNamesLevel +#ifndef USE_UINT_ENUMS + { + LSA_LOOKUP_NAMES_ALL=1, + LSA_LOOKUP_NAMES_DOMAINS_ONLY=2, + LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY=3, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY=4, + LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY=5, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2=6 +} +#else + { __donnot_use_enum_lsa_LookupNamesLevel=0x7FFFFFFF} +#define LSA_LOOKUP_NAMES_ALL ( 1 ) +#define LSA_LOOKUP_NAMES_DOMAINS_ONLY ( 2 ) +#define LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY ( 3 ) +#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY ( 4 ) +#define LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY ( 5 ) +#define LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 ( 6 ) +#endif +; + struct lsa_TranslatedName { enum lsa_SidType sid_type; struct lsa_String name; @@ -464,6 +531,53 @@ struct lsa_TransSidArray3 { struct lsa_TranslatedSid3 *sids;/* [unique,size_is(count)] */ }; +struct lsa_ForestTrustBinaryData { + uint32_t length;/* [range(0 131072)] */ + uint8_t *data;/* [unique,size_is(length)] */ +}; + +struct lsa_ForestTrustDomainInfo { + struct dom_sid2 *domain_sid;/* [unique] */ + struct lsa_StringLarge dns_domain_name; + struct lsa_StringLarge netbios_domain_name; +}; + +union lsa_ForestTrustData { + struct lsa_String top_level_name;/* [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] */ + struct lsa_StringLarge top_level_name_ex;/* [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] */ + struct lsa_ForestTrustDomainInfo domain_info;/* [case(LSA_FOREST_TRUST_DOMAIN_INFO)] */ + struct lsa_ForestTrustBinaryData data;/* [default] */ +}/* [switch_type(uint32)] */; + +enum lsa_ForestTrustRecordType +#ifndef USE_UINT_ENUMS + { + LSA_FOREST_TRUST_TOP_LEVEL_NAME=0, + LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX=1, + LSA_FOREST_TRUST_DOMAIN_INFO=2, + LSA_FOREST_TRUST_RECORD_TYPE_LAST=3 +} +#else + { __donnot_use_enum_lsa_ForestTrustRecordType=0x7FFFFFFF} +#define LSA_FOREST_TRUST_TOP_LEVEL_NAME ( 0 ) +#define LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX ( 1 ) +#define LSA_FOREST_TRUST_DOMAIN_INFO ( 2 ) +#define LSA_FOREST_TRUST_RECORD_TYPE_LAST ( 3 ) +#endif +; + +struct lsa_ForestTrustRecord { + uint32_t flags; + enum lsa_ForestTrustRecordType level; + uint64_t unknown; + union lsa_ForestTrustData forest_trust_data;/* [switch_is(level)] */ +}; + +struct lsa_ForestTrustInformation { + uint32_t count;/* [range(0 4000)] */ + struct lsa_ForestTrustRecord **entries;/* [unique,size_is(count)] */ +}/* [public] */; + struct lsa_Close { struct { @@ -636,7 +750,7 @@ struct lsa_CreateTrustedDomain { struct lsa_EnumTrustDom { struct { struct policy_handle *handle;/* [ref] */ - uint32_t max_size;/* [range(0 1000)] */ + uint32_t max_size; uint32_t *resume_handle;/* [ref] */ } in; @@ -654,7 +768,7 @@ struct lsa_LookupNames { struct policy_handle *handle;/* [ref] */ uint32_t num_names;/* [range(0 1000)] */ struct lsa_String *names;/* [size_is(num_names)] */ - uint16_t level; + enum lsa_LookupNamesLevel level; struct lsa_TransSidArray *sids;/* [ref] */ uint32_t *count;/* [ref] */ } in; @@ -1241,7 +1355,7 @@ struct lsa_LookupNames2 { struct policy_handle *handle;/* [ref] */ uint32_t num_names;/* [range(0 1000)] */ struct lsa_String *names;/* [size_is(num_names)] */ - uint16_t level; + enum lsa_LookupNamesLevel level; uint32_t unknown1; uint32_t unknown2; struct lsa_TransSidArray2 *sids;/* [ref] */ @@ -1335,7 +1449,7 @@ struct lsa_LookupNames3 { struct policy_handle *handle;/* [ref] */ uint32_t num_names;/* [range(0 1000)] */ struct lsa_String *names;/* [size_is(num_names)] */ - uint16_t level; + enum lsa_LookupNamesLevel level; uint32_t unknown1; uint32_t unknown2; struct lsa_TransSidArray3 *sids;/* [ref] */ @@ -1384,8 +1498,15 @@ struct lsa_LSARUNREGISTERAUDITEVENT { }; -struct lsa_LSARQUERYFORESTTRUSTINFORMATION { +struct lsa_lsaRQueryForestTrustInformation { struct { + struct policy_handle *handle;/* [ref] */ + struct lsa_String *trusted_domain_name;/* [ref] */ + uint16_t unknown; + } in; + + struct { + struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */ NTSTATUS result; } out; @@ -1432,7 +1553,7 @@ struct lsa_LookupNames4 { struct { uint32_t num_names;/* [range(0 1000)] */ struct lsa_String *names;/* [size_is(num_names)] */ - uint16_t level; + enum lsa_LookupNamesLevel level; uint32_t unknown1; uint32_t unknown2; struct lsa_TransSidArray3 *sids;/* [ref] */ diff --git a/source3/librpc/gen_ndr/ndr_lsa.c b/source3/librpc/gen_ndr/ndr_lsa.c index eed2a8e0e3..25fa3d2129 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.c +++ b/source3/librpc/gen_ndr/ndr_lsa.c @@ -690,6 +690,34 @@ _PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name ndr->depth--; } +static enum ndr_err_code ndr_push_lsa_PolicyAuditPolicy(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_PolicyAuditPolicy(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r) +{ + const char *val = NULL; + + switch (r) { + case LSA_AUDIT_POLICY_NONE: val = "LSA_AUDIT_POLICY_NONE"; break; + case LSA_AUDIT_POLICY_SUCCESS: val = "LSA_AUDIT_POLICY_SUCCESS"; break; + case LSA_AUDIT_POLICY_FAILURE: val = "LSA_AUDIT_POLICY_FAILURE"; break; + case LSA_AUDIT_POLICY_ALL: val = "LSA_AUDIT_POLICY_ALL"; break; + case LSA_AUDIT_POLICY_CLEAR: val = "LSA_AUDIT_POLICY_CLEAR"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + static enum ndr_err_code ndr_push_lsa_AuditEventsInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditEventsInfo *r) { uint32_t cntr_settings_1; @@ -703,7 +731,7 @@ static enum ndr_err_code ndr_push_lsa_AuditEventsInfo(struct ndr_push *ndr, int if (r->settings) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->settings[cntr_settings_1])); + NDR_CHECK(ndr_push_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, r->settings[cntr_settings_1])); } } } @@ -736,7 +764,7 @@ static enum ndr_err_code ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int _mem_save_settings_1 = NDR_PULL_GET_MEM_CTX(ndr); NDR_PULL_SET_MEM_CTX(ndr, r->settings, 0); for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) { - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->settings[cntr_settings_1])); + NDR_CHECK(ndr_pull_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, &r->settings[cntr_settings_1])); } NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_1, 0); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_0, 0); @@ -763,7 +791,7 @@ _PUBLIC_ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *n char *idx_1=NULL; asprintf(&idx_1, "[%d]", cntr_settings_1); if (idx_1) { - ndr_print_uint32(ndr, "settings", r->settings[cntr_settings_1]); + ndr_print_lsa_PolicyAuditPolicy(ndr, "settings", r->settings[cntr_settings_1]); free(idx_1); } } @@ -1939,6 +1967,35 @@ _PUBLIC_ void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *nam ndr->depth--; } +static enum ndr_err_code ndr_push_lsa_LookupNamesLevel(struct ndr_push *ndr, int ndr_flags, enum lsa_LookupNamesLevel r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_LookupNamesLevel(struct ndr_pull *ndr, int ndr_flags, enum lsa_LookupNamesLevel *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r) +{ + const char *val = NULL; + + switch (r) { + case LSA_LOOKUP_NAMES_ALL: val = "LSA_LOOKUP_NAMES_ALL"; break; + case LSA_LOOKUP_NAMES_DOMAINS_ONLY: val = "LSA_LOOKUP_NAMES_DOMAINS_ONLY"; break; + case LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY: val = "LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY"; break; + case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY"; break; + case LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY"; break; + case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + static enum ndr_err_code ndr_push_lsa_TranslatedName(struct ndr_push *ndr, int ndr_flags, const struct lsa_TranslatedName *r) { if (ndr_flags & NDR_SCALARS) { @@ -4027,6 +4084,434 @@ _PUBLIC_ void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *na ndr->depth--; } +static enum ndr_err_code ndr_push_lsa_ForestTrustBinaryData(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustBinaryData *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_ForestTrustBinaryData(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustBinaryData *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + if (r->length < 0 || r->length > 131072) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); + NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + if (r->data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r) +{ + ndr_print_struct(ndr, name, "lsa_ForestTrustBinaryData"); + ndr->depth++; + ndr_print_uint32(ndr, "length", r->length); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_array_uint8(ndr, "data", r->data, r->length); + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_lsa_ForestTrustDomainInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustDomainInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain_sid)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain_name)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_domain_name)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->domain_sid) { + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->domain_sid)); + } + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain_name)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_domain_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_ForestTrustDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustDomainInfo *r) +{ + uint32_t _ptr_domain_sid; + TALLOC_CTX *_mem_save_domain_sid_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_sid)); + if (_ptr_domain_sid) { + NDR_PULL_ALLOC(ndr, r->domain_sid); + } else { + r->domain_sid = NULL; + } + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain_name)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_domain_name)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->domain_sid) { + _mem_save_domain_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->domain_sid, 0); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->domain_sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_sid_0, 0); + } + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain_name)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_domain_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r) +{ + ndr_print_struct(ndr, name, "lsa_ForestTrustDomainInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_sid", r->domain_sid); + ndr->depth++; + if (r->domain_sid) { + ndr_print_dom_sid2(ndr, "domain_sid", r->domain_sid); + } + ndr->depth--; + ndr_print_lsa_StringLarge(ndr, "dns_domain_name", &r->dns_domain_name); + ndr_print_lsa_StringLarge(ndr, "netbios_domain_name", &r->netbios_domain_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_lsa_ForestTrustData(struct ndr_push *ndr, int ndr_flags, const union lsa_ForestTrustData *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, level)); + switch (level) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->top_level_name)); + break; + + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->top_level_name_ex)); + break; + + case LSA_FOREST_TRUST_DOMAIN_INFO: + NDR_CHECK(ndr_push_lsa_ForestTrustDomainInfo(ndr, NDR_SCALARS, &r->domain_info)); + break; + + default: + NDR_CHECK(ndr_push_lsa_ForestTrustBinaryData(ndr, NDR_SCALARS, &r->data)); + break; + + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->top_level_name)); + break; + + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->top_level_name_ex)); + break; + + case LSA_FOREST_TRUST_DOMAIN_INFO: + NDR_CHECK(ndr_push_lsa_ForestTrustDomainInfo(ndr, NDR_BUFFERS, &r->domain_info)); + break; + + default: + NDR_CHECK(ndr_push_lsa_ForestTrustBinaryData(ndr, NDR_BUFFERS, &r->data)); + break; + + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_ForestTrustData(struct ndr_pull *ndr, int ndr_flags, union lsa_ForestTrustData *r) +{ + int level; + uint32_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->top_level_name)); + break; } + + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: { + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->top_level_name_ex)); + break; } + + case LSA_FOREST_TRUST_DOMAIN_INFO: { + NDR_CHECK(ndr_pull_lsa_ForestTrustDomainInfo(ndr, NDR_SCALARS, &r->domain_info)); + break; } + + default: { + NDR_CHECK(ndr_pull_lsa_ForestTrustBinaryData(ndr, NDR_SCALARS, &r->data)); + break; } + + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->top_level_name)); + break; + + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->top_level_name_ex)); + break; + + case LSA_FOREST_TRUST_DOMAIN_INFO: + NDR_CHECK(ndr_pull_lsa_ForestTrustDomainInfo(ndr, NDR_BUFFERS, &r->domain_info)); + break; + + default: + NDR_CHECK(ndr_pull_lsa_ForestTrustBinaryData(ndr, NDR_BUFFERS, &r->data)); + break; + + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "lsa_ForestTrustData"); + switch (level) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: + ndr_print_lsa_String(ndr, "top_level_name", &r->top_level_name); + break; + + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: + ndr_print_lsa_StringLarge(ndr, "top_level_name_ex", &r->top_level_name_ex); + break; + + case LSA_FOREST_TRUST_DOMAIN_INFO: + ndr_print_lsa_ForestTrustDomainInfo(ndr, "domain_info", &r->domain_info); + break; + + default: + ndr_print_lsa_ForestTrustBinaryData(ndr, "data", &r->data); + break; + + } +} + +static enum ndr_err_code ndr_push_lsa_ForestTrustRecordType(struct ndr_push *ndr, int ndr_flags, enum lsa_ForestTrustRecordType r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_ForestTrustRecordType(struct ndr_pull *ndr, int ndr_flags, enum lsa_ForestTrustRecordType *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r) +{ + const char *val = NULL; + + switch (r) { + case LSA_FOREST_TRUST_TOP_LEVEL_NAME: val = "LSA_FOREST_TRUST_TOP_LEVEL_NAME"; break; + case LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX: val = "LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX"; break; + case LSA_FOREST_TRUST_DOMAIN_INFO: val = "LSA_FOREST_TRUST_DOMAIN_INFO"; break; + case LSA_FOREST_TRUST_RECORD_TYPE_LAST: val = "LSA_FOREST_TRUST_RECORD_TYPE_LAST"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_lsa_ForestTrustRecord(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustRecord *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->flags)); + NDR_CHECK(ndr_push_lsa_ForestTrustRecordType(ndr, NDR_SCALARS, r->level)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->unknown)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->forest_trust_data, r->level)); + NDR_CHECK(ndr_push_lsa_ForestTrustData(ndr, NDR_SCALARS, &r->forest_trust_data)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_ForestTrustData(ndr, NDR_BUFFERS, &r->forest_trust_data)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_lsa_ForestTrustRecord(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustRecord *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->flags)); + NDR_CHECK(ndr_pull_lsa_ForestTrustRecordType(ndr, NDR_SCALARS, &r->level)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->unknown)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->forest_trust_data, r->level)); + NDR_CHECK(ndr_pull_lsa_ForestTrustData(ndr, NDR_SCALARS, &r->forest_trust_data)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_ForestTrustData(ndr, NDR_BUFFERS, &r->forest_trust_data)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r) +{ + ndr_print_struct(ndr, name, "lsa_ForestTrustRecord"); + ndr->depth++; + ndr_print_uint32(ndr, "flags", r->flags); + ndr_print_lsa_ForestTrustRecordType(ndr, "level", r->level); + ndr_print_hyper(ndr, "unknown", r->unknown); + ndr_print_set_switch_value(ndr, &r->forest_trust_data, r->level); + ndr_print_lsa_ForestTrustData(ndr, "forest_trust_data", &r->forest_trust_data); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + if (r->entries[cntr_entries_1]) { + NDR_CHECK(ndr_push_lsa_ForestTrustRecord(ndr, NDR_SCALARS|NDR_BUFFERS, r->entries[cntr_entries_1])); + } + } + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + TALLOC_CTX *_mem_save_entries_2; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + if (r->count < 0 || r->count > 4000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries[cntr_entries_1]); + } else { + r->entries[cntr_entries_1] = NULL; + } + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + if (r->entries[cntr_entries_1]) { + _mem_save_entries_2 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries[cntr_entries_1], 0); + NDR_CHECK(ndr_pull_lsa_ForestTrustRecord(ndr, NDR_SCALARS|NDR_BUFFERS, r->entries[cntr_entries_1])); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_2, 0); + } + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "lsa_ForestTrustInformation"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_ptr(ndr, "entries", r->entries[cntr_entries_1]); + ndr->depth++; + if (r->entries[cntr_entries_1]) { + ndr_print_lsa_ForestTrustRecord(ndr, "entries", r->entries[cntr_entries_1]); + } + ndr->depth--; + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + static enum ndr_err_code ndr_push_lsa_Close(struct ndr_push *ndr, int flags, const struct lsa_Close *r) { if (flags & NDR_IN) { @@ -4103,7 +4588,7 @@ _PUBLIC_ void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int f ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -4117,7 +4602,7 @@ static enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, co return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r) { TALLOC_CTX *_mem_save_handle_0; if (flags & NDR_IN) { @@ -4160,7 +4645,7 @@ _PUBLIC_ void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -4187,7 +4672,7 @@ static enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_resume_handle_0; @@ -4441,7 +4926,7 @@ _PUBLIC_ void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *na ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r) { if (flags & NDR_IN) { NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); @@ -4464,7 +4949,7 @@ static enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r) { uint32_t _ptr_system_name; TALLOC_CTX *_mem_save_system_name_0; @@ -4754,7 +5239,7 @@ _PUBLIC_ void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *nam ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -4777,7 +5262,7 @@ static enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int fl return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_sid_0; @@ -4850,7 +5335,7 @@ _PUBLIC_ void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *nam ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -4877,7 +5362,7 @@ static enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int fla return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_resume_handle_0; @@ -4966,7 +5451,7 @@ _PUBLIC_ void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -4989,7 +5474,7 @@ static enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_info_0; @@ -5112,9 +5597,6 @@ static enum ndr_err_code ndr_pull_lsa_EnumTrustDom(struct ndr_pull *ndr, int fla NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size)); - if (r->in.max_size < 0 || r->in.max_size > 1000) { - return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); - } NDR_PULL_ALLOC(ndr, r->out.resume_handle); *r->out.resume_handle = *r->in.resume_handle; NDR_PULL_ALLOC(ndr, r->out.domains); @@ -5178,7 +5660,7 @@ _PUBLIC_ void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r) { uint32_t cntr_names_0; if (flags & NDR_IN) { @@ -5198,7 +5680,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flag return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_lsa_TransSidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level)); if (r->in.count == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -5222,7 +5704,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r) { uint32_t cntr_names_0; uint32_t _ptr_domains; @@ -5263,7 +5745,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flag NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_lsa_TransSidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.count); } @@ -5342,7 +5824,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, ndr->depth++; ndr_print_lsa_TransSidArray(ndr, "sids", r->in.sids); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level); ndr_print_ptr(ndr, "count", r->in.count); ndr->depth++; ndr_print_uint32(ndr, "count", *r->in.count); @@ -5372,7 +5854,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -5411,7 +5893,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r) { uint32_t _ptr_domains; TALLOC_CTX *_mem_save_handle_0; @@ -5540,7 +6022,7 @@ _PUBLIC_ void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name, ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -5560,7 +6042,7 @@ static enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int fla return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_sec_handle_0; @@ -6349,7 +6831,7 @@ _PUBLIC_ void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, c ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -6369,7 +6851,7 @@ static enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r) { TALLOC_CTX *_mem_save_handle_0; TALLOC_CTX *_mem_save_sec_handle_0; @@ -6432,7 +6914,7 @@ _PUBLIC_ void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name, ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r) { if (flags & NDR_IN) { if (r->in.sec_handle == NULL) { @@ -6454,7 +6936,7 @@ static enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r) { uint32_t _ptr_new_val; uint32_t _ptr_old_val; @@ -6537,7 +7019,7 @@ _PUBLIC_ void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, i ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r) { if (flags & NDR_IN) { if (r->in.sec_handle == NULL) { @@ -6583,7 +7065,7 @@ static enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r) { uint32_t _ptr_new_val; uint32_t _ptr_new_mtime; @@ -7824,7 +8306,7 @@ _PUBLIC_ void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const cha ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r) { if (flags & NDR_IN) { NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); @@ -7850,7 +8332,7 @@ static enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r) { uint32_t _ptr_system_name; TALLOC_CTX *_mem_save_system_name_0; @@ -8985,7 +9467,7 @@ _PUBLIC_ void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, in ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r) { if (flags & NDR_IN) { if (r->in.handle == NULL) { @@ -9026,7 +9508,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r) { uint32_t _ptr_domains; TALLOC_CTX *_mem_save_handle_0; @@ -9159,7 +9641,7 @@ _PUBLIC_ void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name, ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r) { uint32_t cntr_names_0; if (flags & NDR_IN) { @@ -9179,7 +9661,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int fla return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_lsa_TransSidArray2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level)); if (r->in.count == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -9205,7 +9687,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int fla return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r) { uint32_t cntr_names_0; uint32_t _ptr_domains; @@ -9246,7 +9728,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int fla NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_lsa_TransSidArray2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.count); } @@ -9327,7 +9809,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_lsa_TransSidArray2(ndr, "sids", r->in.sids); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level); ndr_print_ptr(ndr, "count", r->in.count); ndr->depth++; ndr_print_uint32(ndr, "count", *r->in.count); @@ -9728,7 +10210,7 @@ _PUBLIC_ void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r) { uint32_t cntr_names_0; if (flags & NDR_IN) { @@ -9748,7 +10230,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int fla return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level)); if (r->in.count == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -9774,7 +10256,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int fla return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r) { uint32_t cntr_names_0; uint32_t _ptr_domains; @@ -9815,7 +10297,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int fla NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.count); } @@ -9896,7 +10378,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_lsa_TransSidArray3(ndr, "sids", r->in.sids); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level); ndr_print_ptr(ndr, "count", r->in.count); ndr->depth++; ndr_print_uint32(ndr, "count", *r->in.count); @@ -10092,41 +10574,112 @@ _PUBLIC_ void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, cons ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_push_lsa_lsaRQueryForestTrustInformation(struct ndr_push *ndr, int flags, const struct lsa_lsaRQueryForestTrustInformation *r) { if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + if (r->in.trusted_domain_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain_name)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.unknown)); } if (flags & NDR_OUT) { + if (r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_pull_lsa_lsaRQueryForestTrustInformation(struct ndr_pull *ndr, int flags, struct lsa_lsaRQueryForestTrustInformation *r) { + uint32_t _ptr_forest_trust_info; + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_trusted_domain_name_0; + TALLOC_CTX *_mem_save_forest_trust_info_0; + TALLOC_CTX *_mem_save_forest_trust_info_1; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.trusted_domain_name); + } + _mem_save_trusted_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.trusted_domain_name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.trusted_domain_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domain_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + ZERO_STRUCTP(r->out.forest_trust_info); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + } + _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r) +_PUBLIC_ void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct lsa_lsaRQueryForestTrustInformation *r) { - ndr_print_struct(ndr, name, "lsa_LSARQUERYFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, name, "lsa_lsaRQueryForestTrustInformation"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "lsa_LSARQUERYFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "in", "lsa_lsaRQueryForestTrustInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name); + ndr->depth++; + ndr_print_lsa_String(ndr, "trusted_domain_name", r->in.trusted_domain_name); + ndr->depth--; + ndr_print_uint16(ndr, "unknown", r->in.unknown); ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "lsa_LSARQUERYFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "out", "lsa_lsaRQueryForestTrustInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info); + ndr->depth++; + ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); ndr->depth++; + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + ndr->depth--; + ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; } @@ -10215,7 +10768,7 @@ _PUBLIC_ void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name, ndr->depth--; } -static enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r) +_PUBLIC_ enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r) { if (flags & NDR_IN) { if (r->in.sids == NULL) { @@ -10252,7 +10805,7 @@ static enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flag return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r) +_PUBLIC_ enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r) { uint32_t _ptr_domains; TALLOC_CTX *_mem_save_sids_0; @@ -10389,7 +10942,7 @@ static enum ndr_err_code ndr_push_lsa_LookupNames4(struct ndr_push *ndr, int fla return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_LookupNamesLevel(ndr, NDR_SCALARS, r->in.level)); if (r->in.count == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } @@ -10448,7 +11001,7 @@ static enum ndr_err_code ndr_pull_lsa_LookupNames4(struct ndr_pull *ndr, int fla NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_lsa_TransSidArray3(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_LookupNamesLevel(ndr, NDR_SCALARS, &r->in.level)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->in.count); } @@ -10525,7 +11078,7 @@ _PUBLIC_ void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name ndr->depth++; ndr_print_lsa_TransSidArray3(ndr, "sids", r->in.sids); ndr->depth--; - ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_LookupNamesLevel(ndr, "level", r->in.level); ndr_print_ptr(ndr, "count", r->in.count); ndr->depth++; ndr_print_uint32(ndr, "count", *r->in.count); @@ -11307,11 +11860,11 @@ static const struct ndr_interface_call lsarpc_calls[] = { false, }, { - "lsa_LSARQUERYFORESTTRUSTINFORMATION", - sizeof(struct lsa_LSARQUERYFORESTTRUSTINFORMATION), - (ndr_push_flags_fn_t) ndr_push_lsa_LSARQUERYFORESTTRUSTINFORMATION, - (ndr_pull_flags_fn_t) ndr_pull_lsa_LSARQUERYFORESTTRUSTINFORMATION, - (ndr_print_function_t) ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION, + "lsa_lsaRQueryForestTrustInformation", + sizeof(struct lsa_lsaRQueryForestTrustInformation), + (ndr_push_flags_fn_t) ndr_push_lsa_lsaRQueryForestTrustInformation, + (ndr_pull_flags_fn_t) ndr_pull_lsa_lsaRQueryForestTrustInformation, + (ndr_print_function_t) ndr_print_lsa_lsaRQueryForestTrustInformation, false, }, { diff --git a/source3/librpc/gen_ndr/ndr_lsa.h b/source3/librpc/gen_ndr/ndr_lsa.h index dc100297f5..ab4043f2a1 100644 --- a/source3/librpc/gen_ndr/ndr_lsa.h +++ b/source3/librpc/gen_ndr/ndr_lsa.h @@ -194,6 +194,7 @@ void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, const stru void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, const struct lsa_QosInfo *r); void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, const struct lsa_ObjectAttribute *r); void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditLogInfo *r); +void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r); void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditEventsInfo *r); void ndr_print_lsa_DomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfo *r); void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *name, const struct lsa_PDAccountInfo *r); @@ -215,6 +216,7 @@ void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_Sid void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid *r); void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray *r); void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, const struct lsa_RefDomainList *r); +void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r); void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName *r); void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray *r); void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, const struct lsa_LUIDAttribute *r); @@ -246,22 +248,48 @@ void ndr_print_lsa_TranslatedSid2(struct ndr_print *ndr, const char *name, const void ndr_print_lsa_TransSidArray2(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray2 *r); void ndr_print_lsa_TranslatedSid3(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid3 *r); void ndr_print_lsa_TransSidArray3(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray3 *r); +void ndr_print_lsa_ForestTrustBinaryData(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustBinaryData *r); +void ndr_print_lsa_ForestTrustDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustDomainInfo *r); +void ndr_print_lsa_ForestTrustData(struct ndr_print *ndr, const char *name, const union lsa_ForestTrustData *r); +void ndr_print_lsa_ForestTrustRecordType(struct ndr_print *ndr, const char *name, enum lsa_ForestTrustRecordType r); +void ndr_print_lsa_ForestTrustRecord(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustRecord *r); +enum ndr_err_code ndr_push_lsa_ForestTrustInformation(struct ndr_push *ndr, int ndr_flags, const struct lsa_ForestTrustInformation *r); +enum ndr_err_code ndr_pull_lsa_ForestTrustInformation(struct ndr_pull *ndr, int ndr_flags, struct lsa_ForestTrustInformation *r); +void ndr_print_lsa_ForestTrustInformation(struct ndr_print *ndr, const char *name, const struct lsa_ForestTrustInformation *r); void ndr_print_lsa_Close(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Close *r); +enum ndr_err_code ndr_push_lsa_Delete(struct ndr_push *ndr, int flags, const struct lsa_Delete *r); +enum ndr_err_code ndr_pull_lsa_Delete(struct ndr_pull *ndr, int flags, struct lsa_Delete *r); void ndr_print_lsa_Delete(struct ndr_print *ndr, const char *name, int flags, const struct lsa_Delete *r); +enum ndr_err_code ndr_push_lsa_EnumPrivs(struct ndr_push *ndr, int flags, const struct lsa_EnumPrivs *r); +enum ndr_err_code ndr_pull_lsa_EnumPrivs(struct ndr_pull *ndr, int flags, struct lsa_EnumPrivs *r); void ndr_print_lsa_EnumPrivs(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivs *r); void ndr_print_lsa_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecurity *r); void ndr_print_lsa_SetSecObj(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecObj *r); void ndr_print_lsa_ChangePassword(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ChangePassword *r); +enum ndr_err_code ndr_push_lsa_OpenPolicy(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy *r); +enum ndr_err_code ndr_pull_lsa_OpenPolicy(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy *r); void ndr_print_lsa_OpenPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy *r); void ndr_print_lsa_QueryInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy *r); void ndr_print_lsa_SetInfoPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInfoPolicy *r); void ndr_print_lsa_ClearAuditLog(struct ndr_print *ndr, const char *name, int flags, const struct lsa_ClearAuditLog *r); +enum ndr_err_code ndr_push_lsa_CreateAccount(struct ndr_push *ndr, int flags, const struct lsa_CreateAccount *r); +enum ndr_err_code ndr_pull_lsa_CreateAccount(struct ndr_pull *ndr, int flags, struct lsa_CreateAccount *r); void ndr_print_lsa_CreateAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateAccount *r); +enum ndr_err_code ndr_push_lsa_EnumAccounts(struct ndr_push *ndr, int flags, const struct lsa_EnumAccounts *r); +enum ndr_err_code ndr_pull_lsa_EnumAccounts(struct ndr_pull *ndr, int flags, struct lsa_EnumAccounts *r); void ndr_print_lsa_EnumAccounts(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumAccounts *r); +enum ndr_err_code ndr_push_lsa_CreateTrustedDomain(struct ndr_push *ndr, int flags, const struct lsa_CreateTrustedDomain *r); +enum ndr_err_code ndr_pull_lsa_CreateTrustedDomain(struct ndr_pull *ndr, int flags, struct lsa_CreateTrustedDomain *r); void ndr_print_lsa_CreateTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomain *r); void ndr_print_lsa_EnumTrustDom(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumTrustDom *r); +enum ndr_err_code ndr_push_lsa_LookupNames(struct ndr_push *ndr, int flags, const struct lsa_LookupNames *r); +enum ndr_err_code ndr_pull_lsa_LookupNames(struct ndr_pull *ndr, int flags, struct lsa_LookupNames *r); void ndr_print_lsa_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames *r); +enum ndr_err_code ndr_push_lsa_LookupSids(struct ndr_push *ndr, int flags, const struct lsa_LookupSids *r); +enum ndr_err_code ndr_pull_lsa_LookupSids(struct ndr_pull *ndr, int flags, struct lsa_LookupSids *r); void ndr_print_lsa_LookupSids(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids *r); +enum ndr_err_code ndr_push_lsa_CreateSecret(struct ndr_push *ndr, int flags, const struct lsa_CreateSecret *r); +enum ndr_err_code ndr_pull_lsa_CreateSecret(struct ndr_pull *ndr, int flags, struct lsa_CreateSecret *r); void ndr_print_lsa_CreateSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateSecret *r); void ndr_print_lsa_OpenAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenAccount *r); void ndr_print_lsa_EnumPrivsAccount(struct ndr_print *ndr, const char *name, int flags, const struct lsa_EnumPrivsAccount *r); @@ -274,8 +302,14 @@ void ndr_print_lsa_SetSystemAccessAccount(struct ndr_print *ndr, const char *nam void ndr_print_lsa_OpenTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomain *r); void ndr_print_lsa_QueryTrustedDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryTrustedDomainInfo *r); void ndr_print_lsa_SetInformationTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetInformationTrustedDomain *r); +enum ndr_err_code ndr_push_lsa_OpenSecret(struct ndr_push *ndr, int flags, const struct lsa_OpenSecret *r); +enum ndr_err_code ndr_pull_lsa_OpenSecret(struct ndr_pull *ndr, int flags, struct lsa_OpenSecret *r); void ndr_print_lsa_OpenSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenSecret *r); +enum ndr_err_code ndr_push_lsa_SetSecret(struct ndr_push *ndr, int flags, const struct lsa_SetSecret *r); +enum ndr_err_code ndr_pull_lsa_SetSecret(struct ndr_pull *ndr, int flags, struct lsa_SetSecret *r); void ndr_print_lsa_SetSecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetSecret *r); +enum ndr_err_code ndr_push_lsa_QuerySecret(struct ndr_push *ndr, int flags, const struct lsa_QuerySecret *r); +enum ndr_err_code ndr_pull_lsa_QuerySecret(struct ndr_pull *ndr, int flags, struct lsa_QuerySecret *r); void ndr_print_lsa_QuerySecret(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QuerySecret *r); void ndr_print_lsa_LookupPrivValue(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivValue *r); void ndr_print_lsa_LookupPrivName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupPrivName *r); @@ -290,6 +324,8 @@ void ndr_print_lsa_SetTrustedDomainInfo(struct ndr_print *ndr, const char *name, void ndr_print_lsa_DeleteTrustedDomain(struct ndr_print *ndr, const char *name, int flags, const struct lsa_DeleteTrustedDomain *r); void ndr_print_lsa_StorePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_StorePrivateData *r); void ndr_print_lsa_RetrievePrivateData(struct ndr_print *ndr, const char *name, int flags, const struct lsa_RetrievePrivateData *r); +enum ndr_err_code ndr_push_lsa_OpenPolicy2(struct ndr_push *ndr, int flags, const struct lsa_OpenPolicy2 *r); +enum ndr_err_code ndr_pull_lsa_OpenPolicy2(struct ndr_pull *ndr, int flags, struct lsa_OpenPolicy2 *r); void ndr_print_lsa_OpenPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenPolicy2 *r); void ndr_print_lsa_GetUserName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_GetUserName *r); void ndr_print_lsa_QueryInfoPolicy2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_QueryInfoPolicy2 *r); @@ -303,7 +339,11 @@ void ndr_print_lsa_QueryDomainInformationPolicy(struct ndr_print *ndr, const cha void ndr_print_lsa_SetDomainInformationPolicy(struct ndr_print *ndr, const char *name, int flags, const struct lsa_SetDomainInformationPolicy *r); void ndr_print_lsa_OpenTrustedDomainByName(struct ndr_print *ndr, const char *name, int flags, const struct lsa_OpenTrustedDomainByName *r); void ndr_print_lsa_TestCall(struct ndr_print *ndr, const char *name, int flags, const struct lsa_TestCall *r); +enum ndr_err_code ndr_push_lsa_LookupSids2(struct ndr_push *ndr, int flags, const struct lsa_LookupSids2 *r); +enum ndr_err_code ndr_pull_lsa_LookupSids2(struct ndr_pull *ndr, int flags, struct lsa_LookupSids2 *r); void ndr_print_lsa_LookupSids2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids2 *r); +enum ndr_err_code ndr_push_lsa_LookupNames2(struct ndr_push *ndr, int flags, const struct lsa_LookupNames2 *r); +enum ndr_err_code ndr_pull_lsa_LookupNames2(struct ndr_pull *ndr, int flags, struct lsa_LookupNames2 *r); void ndr_print_lsa_LookupNames2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames2 *r); void ndr_print_lsa_CreateTrustedDomainEx2(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CreateTrustedDomainEx2 *r); void ndr_print_lsa_CREDRWRITE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRWRITE *r); @@ -314,14 +354,18 @@ void ndr_print_lsa_CREDRREADDOMAINCREDENTIALS(struct ndr_print *ndr, const char void ndr_print_lsa_CREDRDELETE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRDELETE *r); void ndr_print_lsa_CREDRGETTARGETINFO(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETTARGETINFO *r); void ndr_print_lsa_CREDRPROFILELOADED(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRPROFILELOADED *r); +enum ndr_err_code ndr_push_lsa_LookupNames3(struct ndr_push *ndr, int flags, const struct lsa_LookupNames3 *r); +enum ndr_err_code ndr_pull_lsa_LookupNames3(struct ndr_pull *ndr, int flags, struct lsa_LookupNames3 *r); void ndr_print_lsa_LookupNames3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames3 *r); void ndr_print_lsa_CREDRGETSESSIONTYPES(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRGETSESSIONTYPES *r); void ndr_print_lsa_LSARREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARREGISTERAUDITEVENT *r); void ndr_print_lsa_LSARGENAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARGENAUDITEVENT *r); void ndr_print_lsa_LSARUNREGISTERAUDITEVENT(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARUNREGISTERAUDITEVENT *r); -void ndr_print_lsa_LSARQUERYFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r); +void ndr_print_lsa_lsaRQueryForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct lsa_lsaRQueryForestTrustInformation *r); void ndr_print_lsa_LSARSETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSARSETFORESTTRUSTINFORMATION *r); void ndr_print_lsa_CREDRRENAME(struct ndr_print *ndr, const char *name, int flags, const struct lsa_CREDRRENAME *r); +enum ndr_err_code ndr_push_lsa_LookupSids3(struct ndr_push *ndr, int flags, const struct lsa_LookupSids3 *r); +enum ndr_err_code ndr_pull_lsa_LookupSids3(struct ndr_pull *ndr, int flags, struct lsa_LookupSids3 *r); void ndr_print_lsa_LookupSids3(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupSids3 *r); void ndr_print_lsa_LookupNames4(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LookupNames4 *r); void ndr_print_lsa_LSAROPENPOLICYSCE(struct ndr_print *ndr, const char *name, int flags, const struct lsa_LSAROPENPOLICYSCE *r); diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c index 68dc32cef5..8f8f985650 100644 --- a/source3/librpc/gen_ndr/srv_lsa.c +++ b/source3/librpc/gen_ndr/srv_lsa.c @@ -5579,18 +5579,18 @@ static bool api_lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p) return true; } -static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) +static bool api_lsa_lsaRQueryForestTrustInformation(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r; + struct lsa_lsaRQueryForestTrustInformation *r; call = &ndr_table_lsarpc.calls[NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION]; - r = talloc(NULL, struct lsa_LSARQUERYFORESTTRUSTINFORMATION); + r = talloc(NULL, struct lsa_lsaRQueryForestTrustInformation); if (r == NULL) { return false; } @@ -5614,10 +5614,17 @@ static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r); + NDR_PRINT_IN_DEBUG(lsa_lsaRQueryForestTrustInformation, r); } - r->out.result = _lsa_LSARQUERYFORESTTRUSTINFORMATION(p, r); + ZERO_STRUCT(r->out); + r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _lsa_lsaRQueryForestTrustInformation(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -5626,7 +5633,7 @@ static bool api_lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(lsa_LSARQUERYFORESTTRUSTINFORMATION, r); + NDR_PRINT_OUT_DEBUG(lsa_lsaRQueryForestTrustInformation, r); } push = ndr_push_init_ctx(r); @@ -6331,7 +6338,7 @@ static struct api_struct api_lsarpc_cmds[] = {"LSA_LSARREGISTERAUDITEVENT", NDR_LSA_LSARREGISTERAUDITEVENT, api_lsa_LSARREGISTERAUDITEVENT}, {"LSA_LSARGENAUDITEVENT", NDR_LSA_LSARGENAUDITEVENT, api_lsa_LSARGENAUDITEVENT}, {"LSA_LSARUNREGISTERAUDITEVENT", NDR_LSA_LSARUNREGISTERAUDITEVENT, api_lsa_LSARUNREGISTERAUDITEVENT}, - {"LSA_LSARQUERYFORESTTRUSTINFORMATION", NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, api_lsa_LSARQUERYFORESTTRUSTINFORMATION}, + {"LSA_LSARQUERYFORESTTRUSTINFORMATION", NDR_LSA_LSARQUERYFORESTTRUSTINFORMATION, api_lsa_lsaRQueryForestTrustInformation}, {"LSA_LSARSETFORESTTRUSTINFORMATION", NDR_LSA_LSARSETFORESTTRUSTINFORMATION, api_lsa_LSARSETFORESTTRUSTINFORMATION}, {"LSA_CREDRRENAME", NDR_LSA_CREDRRENAME, api_lsa_CREDRRENAME}, {"LSA_LOOKUPSIDS3", NDR_LSA_LOOKUPSIDS3, api_lsa_LookupSids3}, diff --git a/source3/librpc/gen_ndr/srv_lsa.h b/source3/librpc/gen_ndr/srv_lsa.h index e3decb2862..223ee5e970 100644 --- a/source3/librpc/gen_ndr/srv_lsa.h +++ b/source3/librpc/gen_ndr/srv_lsa.h @@ -74,7 +74,7 @@ NTSTATUS _lsa_CREDRGETSESSIONTYPES(pipes_struct *p, struct lsa_CREDRGETSESSIONTY NTSTATUS _lsa_LSARREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARREGISTERAUDITEVENT *r); NTSTATUS _lsa_LSARGENAUDITEVENT(pipes_struct *p, struct lsa_LSARGENAUDITEVENT *r); NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTERAUDITEVENT *r); -NTSTATUS _lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r); +NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r); NTSTATUS _lsa_LSARSETFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARSETFORESTTRUSTINFORMATION *r); NTSTATUS _lsa_CREDRRENAME(pipes_struct *p, struct lsa_CREDRRENAME *r); NTSTATUS _lsa_LookupSids3(pipes_struct *p, struct lsa_LookupSids3 *r); diff --git a/source3/librpc/idl/lsa.idl b/source3/librpc/idl/lsa.idl index 54a71df74f..8d26ec0aad 100644 --- a/source3/librpc/idl/lsa.idl +++ b/source3/librpc/idl/lsa.idl @@ -47,7 +47,7 @@ import "security.idl"; /******************/ /* Function: 0x01 */ - NTSTATUS lsa_Delete ( + [public] NTSTATUS lsa_Delete ( [in] policy_handle *handle ); @@ -69,7 +69,7 @@ import "security.idl"; [size_is(count)] lsa_PrivEntry *privs; } lsa_PrivArray; - NTSTATUS lsa_EnumPrivs ( + [public] NTSTATUS lsa_EnumPrivs ( [in] policy_handle *handle, [in,out] uint32 *resume_handle, [in] uint32 max_count, @@ -116,7 +116,7 @@ import "security.idl"; /* notice the screwup with the system_name - thats why MS created OpenPolicy2 */ - NTSTATUS lsa_OpenPolicy ( + [public] NTSTATUS lsa_OpenPolicy ( [in,unique] uint16 *system_name, [in] lsa_ObjectAttribute *attr, [in] uint32 access_mask, @@ -271,7 +271,7 @@ import "security.idl"; /******************/ /* Function: 0x0a */ - NTSTATUS lsa_CreateAccount ( + [public] NTSTATUS lsa_CreateAccount ( [in] policy_handle *handle, [in] dom_sid2 *sid, [in] uint32 access_mask, @@ -292,7 +292,7 @@ import "security.idl"; [size_is(num_sids)] lsa_SidPtr *sids; } lsa_SidArray; - NTSTATUS lsa_EnumAccounts ( + [public] NTSTATUS lsa_EnumAccounts ( [in] policy_handle *handle, [in,out] uint32 *resume_handle, [in,range(0,8192)] uint32 num_entries, @@ -303,7 +303,7 @@ import "security.idl"; /*************************************************/ /* Function: 0x0c */ - NTSTATUS lsa_CreateTrustedDomain( + [public] NTSTATUS lsa_CreateTrustedDomain( [in] policy_handle *handle, [in] lsa_DomainInfo *info, [in] uint32 access_mask, @@ -325,7 +325,7 @@ import "security.idl"; NTSTATUS lsa_EnumTrustDom ( [in] policy_handle *handle, [in,out] uint32 *resume_handle, - [in,range(0,1000)] uint32 max_size, + [in] uint32 max_size, [out] lsa_DomainList *domains ); @@ -363,13 +363,30 @@ import "security.idl"; uint32 max_size; } lsa_RefDomainList; - NTSTATUS lsa_LookupNames ( + /* Level 1: Ask everywhere + * Level 2: Ask domain and trusted domains, no builtin and wkn + * Level 3: Only ask domain + * Level 4: W2k3ad: Only ask AD trusts + * Level 5: Only ask transitive forest trusts + * Level 6: Like 4 + */ + + typedef enum { + LSA_LOOKUP_NAMES_ALL = 1, + LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2, + LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4, + LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6 + } lsa_LookupNamesLevel; + + [public] NTSTATUS lsa_LookupNames ( [in] policy_handle *handle, [in,range(0,1000)] uint32 num_names, [in,size_is(num_names)] lsa_String names[], [out,unique] lsa_RefDomainList *domains, [in,out] lsa_TransSidArray *sids, - [in] uint16 level, + [in] lsa_LookupNamesLevel level, [in,out] uint32 *count ); @@ -388,7 +405,7 @@ import "security.idl"; [size_is(count)] lsa_TranslatedName *names; } lsa_TransNameArray; - NTSTATUS lsa_LookupSids ( + [public] NTSTATUS lsa_LookupSids ( [in] policy_handle *handle, [in] lsa_SidArray *sids, [out,unique] lsa_RefDomainList *domains, @@ -399,7 +416,7 @@ import "security.idl"; /* Function: 0x10 */ - NTSTATUS lsa_CreateSecret( + [public] NTSTATUS lsa_CreateSecret( [in] policy_handle *handle, [in] lsa_String name, [in] uint32 access_mask, @@ -579,7 +596,7 @@ import "security.idl"; NTSTATUS lsa_SetInformationTrustedDomain(); /* Function: 0x1c */ - NTSTATUS lsa_OpenSecret( + [public] NTSTATUS lsa_OpenSecret( [in] policy_handle *handle, [in] lsa_String name, [in] uint32 access_mask, @@ -588,7 +605,7 @@ import "security.idl"; /* Function: 0x1d */ - NTSTATUS lsa_SetSecret( + [public] NTSTATUS lsa_SetSecret( [in] policy_handle *sec_handle, [in,unique] lsa_DATA_BUF *new_val, [in,unique] lsa_DATA_BUF *old_val @@ -599,7 +616,7 @@ import "security.idl"; } lsa_DATA_BUF_PTR; /* Function: 0x1e */ - NTSTATUS lsa_QuerySecret ( + [public] NTSTATUS lsa_QuerySecret ( [in] policy_handle *sec_handle, [in,out,unique] lsa_DATA_BUF_PTR *new_val, [in,out,unique] NTTIME_hyper *new_mtime, @@ -705,7 +722,7 @@ import "security.idl"; /**********************/ /* Function: 0x2c */ - NTSTATUS lsa_OpenPolicy2 ( + [public] NTSTATUS lsa_OpenPolicy2 ( [in,unique] [string,charset(UTF16)] uint16 *system_name, [in] lsa_ObjectAttribute *attr, [in] uint32 access_mask, @@ -852,7 +869,7 @@ import "security.idl"; [size_is(count)] lsa_TranslatedName2 *names; } lsa_TransNameArray2; - NTSTATUS lsa_LookupSids2( + [public] NTSTATUS lsa_LookupSids2( [in] policy_handle *handle, [in] lsa_SidArray *sids, [out,unique] lsa_RefDomainList *domains, @@ -878,13 +895,13 @@ import "security.idl"; [size_is(count)] lsa_TranslatedSid2 *sids; } lsa_TransSidArray2; - NTSTATUS lsa_LookupNames2 ( + [public] NTSTATUS lsa_LookupNames2 ( [in] policy_handle *handle, [in,range(0,1000)] uint32 num_names, [in,size_is(num_names)] lsa_String names[], [out,unique] lsa_RefDomainList *domains, [in,out] lsa_TransSidArray2 *sids, - [in] uint16 level, + [in] lsa_LookupNamesLevel level, [in,out] uint32 *count, [in] uint32 unknown1, [in] uint32 unknown2 @@ -931,13 +948,13 @@ import "security.idl"; [size_is(count)] lsa_TranslatedSid3 *sids; } lsa_TransSidArray3; - NTSTATUS lsa_LookupNames3 ( + [public] NTSTATUS lsa_LookupNames3 ( [in] policy_handle *handle, [in,range(0,1000)] uint32 num_names, [in,size_is(num_names)] lsa_String names[], [out,unique] lsa_RefDomainList *domains, [in,out] lsa_TransSidArray3 *sids, - [in] uint16 level, + [in] lsa_LookupNamesLevel level, [in,out] uint32 *count, [in] uint32 unknown1, [in] uint32 unknown2 @@ -956,7 +973,49 @@ import "security.idl"; NTSTATUS lsa_LSARUNREGISTERAUDITEVENT(); /* Function 0x49 */ - NTSTATUS lsa_LSARQUERYFORESTTRUSTINFORMATION(); + typedef struct { + [range(0,131072)] uint32 length; + [size_is(length)] uint8 *data; + } lsa_ForestTrustBinaryData; + + typedef struct { + dom_sid2 *domain_sid; + lsa_StringLarge dns_domain_name; + lsa_StringLarge netbios_domain_name; + } lsa_ForestTrustDomainInfo; + + typedef [switch_type(uint32)] union { + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name; + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex; + [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info; + [default] lsa_ForestTrustBinaryData data; + } lsa_ForestTrustData; + + typedef [v1_enum] enum { + LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0, + LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1, + LSA_FOREST_TRUST_DOMAIN_INFO = 2, + LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3 + } lsa_ForestTrustRecordType; + + typedef struct { + uint32 flags; + lsa_ForestTrustRecordType level; + hyper unknown; + [switch_is(level)] lsa_ForestTrustData forest_trust_data; + } lsa_ForestTrustRecord; + + typedef [public] struct { + [range(0,4000)] uint32 count; + [size_is(count)] lsa_ForestTrustRecord **entries; + } lsa_ForestTrustInformation; + + NTSTATUS lsa_lsaRQueryForestTrustInformation( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain_name, + [in] uint16 unknown, /* level ? */ + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); /* Function 0x4a */ NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION(); @@ -967,7 +1026,7 @@ import "security.idl"; /*****************/ /* Function 0x4c */ - NTSTATUS lsa_LookupSids3( + [public] NTSTATUS lsa_LookupSids3( [in] lsa_SidArray *sids, [out,unique] lsa_RefDomainList *domains, [in,out] lsa_TransNameArray2 *names, @@ -983,7 +1042,7 @@ import "security.idl"; [in,size_is(num_names)] lsa_String names[], [out,unique] lsa_RefDomainList *domains, [in,out] lsa_TransSidArray3 *sids, - [in] uint16 level, + [in] lsa_LookupNamesLevel level, [in,out] uint32 *count, [in] uint32 unknown1, [in] uint32 unknown2 diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c index 1b78772a79..20cafbd0af 100644 --- a/source3/rpc_server/srv_lsa_nt.c +++ b/source3/rpc_server/srv_lsa_nt.c @@ -2583,7 +2583,7 @@ NTSTATUS _lsa_LSARUNREGISTERAUDITEVENT(pipes_struct *p, struct lsa_LSARUNREGISTE return NT_STATUS_NOT_IMPLEMENTED; } -NTSTATUS _lsa_LSARQUERYFORESTTRUSTINFORMATION(pipes_struct *p, struct lsa_LSARQUERYFORESTTRUSTINFORMATION *r) +NTSTATUS _lsa_lsaRQueryForestTrustInformation(pipes_struct *p, struct lsa_lsaRQueryForestTrustInformation *r) { p->rng_fault_state = True; return NT_STATUS_NOT_IMPLEMENTED; -- cgit From f2b2e01fd83666289d0e6771fbccb33b54e94393 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jan 2008 13:44:51 +0100 Subject: Re-order an option block in parm_table to re-unite the misc options. Michael (This used to be commit 9e11768256623636e69eda67b3bb888426f9ab84) --- source3/param/loadparm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index eaf19b746a..475b6b61fa 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1215,14 +1215,14 @@ static struct parm_struct parm_table[] = { {"ldap page size", P_INTEGER, P_GLOBAL, &Globals.ldap_page_size, NULL, NULL, FLAG_ADVANCED}, {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, NULL, NULL, FLAG_ADVANCED}, + {N_("EventLog Options"), P_SEP, P_SEPARATOR}, + {"eventlog list", P_LIST, P_GLOBAL, &Globals.szEventLogs, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE}, + {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR}, {"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, FLAG_ADVANCED}, {"change share command", P_STRING, P_GLOBAL, &Globals.szChangeShareCommand, NULL, NULL, FLAG_ADVANCED}, {"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, FLAG_ADVANCED}, - {N_("EventLog Options"), P_SEP, P_SEPARATOR}, - {"eventlog list", P_LIST, P_GLOBAL, &Globals.szEventLogs, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE}, - {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE}, {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED}, -- cgit From 789720e0ed8506d7373c2879187dd7b43f76c040 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jan 2008 13:46:02 +0100 Subject: Add "MSDFS options" separator to parm_table. Michael (This used to be commit a103509a467bf6a93fbb21ec5e64456c5f086d6c) --- source3/param/loadparm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 475b6b61fa..d226ebe20a 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1294,6 +1294,8 @@ static struct parm_struct parm_table[] = { {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_HIDE}, + {N_("MSDFS options"), P_SEP, P_SEPARATOR}, + {"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, {"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED}, -- cgit From 89b1c68b37dd5f020982de82ba6ef9790986d8c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 16:18:28 +0100 Subject: Add config parameter "config backend = registry". This adds a new config parameter "config backend" that can have values "file" (default) and "registry". When lp_load() encounters a "config backend = registry", then all config read up to that point is discarded and globals are read from registry. This is done in suche a way that as with "config file", there is no way back to non-registry config during the lifetime of a process: The file_list_changed mechanism does not look at files anymore once config backend is set to registry. This is modelled after the behaviour of the "config file" option. Note that only the global section is read by lp_load(). The shares are handled by the registry shares mechanism, thus allowing for a smaller memory footprint since share definitions are read on demand. This new parameter is intended as a substitute of the previously installed special semantics of "include = registry" which allows for messed up mixed configurations. This parameter (which has not yet been released) will vanish next. Michael (This used to be commit 77b33cf34c2aec6673dfab3962733a60a60d126a) --- source3/param/loadparm.c | 82 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index d226ebe20a..4ec3c107e8 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -81,6 +81,11 @@ extern userdom_struct current_user_info; static int regdb_last_seqnum = 0; static bool include_registry_globals = False; +#define CONFIG_BACKEND_FILE 0 +#define CONFIG_BACKEND_REGISTRY 1 + +static int config_backend = CONFIG_BACKEND_FILE; + /* some helpful bits */ #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid) #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid) @@ -104,6 +109,7 @@ struct _param_opt_struct { * This structure describes global (ie., server-wide) parameters. */ typedef struct { + int ConfigBackend; char *smb_ports; char *dos_charset; char *unix_charset; @@ -842,6 +848,14 @@ static const struct enum_list enum_map_to_guest[] = { {-1, NULL} }; +/* Config backend options */ + +static const struct enum_list enum_config_backend[] = { + {CONFIG_BACKEND_FILE, "file"}, + {CONFIG_BACKEND_REGISTRY, "registry"}, + {-1, NULL} +}; + /* Note: We do not initialise the defaults union - it is not allowed in ANSI C * * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit @@ -880,6 +894,8 @@ static struct parm_struct parm_table[] = { {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD}, + {"config backend", P_ENUM, P_GLOBAL, &Globals.ConfigBackend, NULL, enum_config_backend, FLAG_ADVANCED}, + {N_("Security Options"), P_SEP, P_SEPARATOR}, {"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD}, @@ -1529,6 +1545,8 @@ static void init_globals(bool first_time_only) Globals.bLoadPrinters = True; Globals.PrintcapCacheTime = 750; /* 12.5 minutes */ + Globals.ConfigBackend = CONFIG_BACKEND_FILE; + /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */ /* Discovered by 2 days of pain by Don McCall @ HP :-). */ Globals.max_xmit = 0x4104; @@ -2048,6 +2066,7 @@ FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time) FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime) FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares) FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions) +FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend); FN_LOCAL_STRING(lp_preexec, szPreExec) FN_LOCAL_STRING(lp_postexec, szPostExec) @@ -3655,7 +3674,7 @@ bool lp_file_list_changed(void) DEBUG(6, ("lp_file_list_changed()\n")); - if (include_registry_globals) { + if (config_backend == CONFIG_BACKEND_REGISTRY) { reg_tdb = lp_regdb_open(); if (reg_tdb && (regdb_last_seqnum != tdb_get_seqnum(reg_tdb->tdb))) { @@ -3663,6 +3682,15 @@ bool lp_file_list_changed(void) regdb_last_seqnum, tdb_get_seqnum(reg_tdb->tdb))); TALLOC_FREE(reg_tdb); return true; + } else { + /* + * Don't check files when config_backend is registry. + * Remove this to obtain checking of files even with + * registry config backend. That would enable switching + * off registry configuration by changing smb.conf even + * without restarting smbd. + */ + return false; } } @@ -3698,6 +3726,7 @@ bool lp_file_list_changed(void) return (False); } + /*************************************************************************** Run standard_sub_basic on netbios name... needed because global_myname is not accessed through any lp_ macro. @@ -5656,15 +5685,6 @@ bool lp_load(const char *pszFname, bool bRetval; param_opt_struct *data, *pdata; - n2 = alloc_sub_basic(get_current_username(), - current_user_info.domain, - pszFname); - if (!n2) { - smb_panic("lp_load: out of memory"); - } - - add_to_file_list(pszFname, n2); - bRetval = False; DEBUG(3, ("lp_load: refreshing parameters\n")); @@ -5693,17 +5713,41 @@ bool lp_load(const char *pszFname, Globals.param_opt = NULL; } - /* We get sections first, so have to start 'behind' to make up */ - iServiceIndex = -1; - bRetval = pm_process(n2, do_section, do_parameter); - SAFE_FREE(n2); + if (config_backend == CONFIG_BACKEND_FILE) { + n2 = alloc_sub_basic(get_current_username(), + current_user_info.domain, + pszFname); + if (!n2) { + smb_panic("lp_load: out of memory"); + } - /* finish up the last section */ - DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval))); - if (bRetval) { - if (iServiceIndex >= 0) { - bRetval = service_ok(iServiceIndex); + add_to_file_list(pszFname, n2); + + /* We get sections first, so have to start 'behind' to make up */ + iServiceIndex = -1; + bRetval = pm_process(n2, do_section, do_parameter); + SAFE_FREE(n2); + + /* finish up the last section */ + DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval))); + if (bRetval) { + if (iServiceIndex >= 0) { + bRetval = service_ok(iServiceIndex); + } } + + if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) { + config_backend = CONFIG_BACKEND_REGISTRY; + /* start over */ + return lp_load(pszFname, global_only, save_defaults, + add_ipc, initialize_globals); + } + } else if (config_backend == CONFIG_BACKEND_REGISTRY) { + bRetval = process_registry_globals(do_parameter); + } else { + DEBUG(0, ("Illegal config backend given: %d\n", + config_backend)); + bRetval = false; } lp_add_auto_services(lp_auto_services()); -- cgit From b92c3e281c66127dbd2b16b7c71e2cba4e0c1de9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 16:40:59 +0100 Subject: Add handling of [homes] and [printers] via registry shares. Now homes and printers shares can be accessed through the registry meachanism on demand in pure registry configurations with "config backend = registry" without the need to have a special handler for these two. Michael (This used to be commit eec3248ef90fbfe6e048394c875173b164a8b439) --- source3/smbd/service.c | 84 +++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 2588a66b8b..ed8061e2f7 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -219,44 +219,6 @@ bool set_current_service(connection_struct *conn, uint16 flags, bool do_chdir) return(True); } -/**************************************************************************** - Add a home service. Returns the new service number or -1 if fail. -****************************************************************************/ - -int add_home_service(const char *service, const char *username, const char *homedir) -{ - int iHomeService; - - if (!service || !homedir) - return -1; - - if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) - return -1; - - /* - * If this is a winbindd provided username, remove - * the domain component before adding the service. - * Log a warning if the "path=" parameter does not - * include any macros. - */ - - { - const char *p = strchr(service,*lp_winbind_separator()); - - /* We only want the 'user' part of the string */ - if (p) { - service = p + 1; - } - } - - if (!lp_add_home(service, iHomeService, username, homedir)) { - return -1; - } - - return lp_servicenumber(service); - -} - static int load_registry_service(const char *servicename) { struct registry_key *key; @@ -348,6 +310,47 @@ void load_registry_shares(void) return; } +/**************************************************************************** + Add a home service. Returns the new service number or -1 if fail. +****************************************************************************/ + +int add_home_service(const char *service, const char *username, const char *homedir) +{ + int iHomeService; + + if (!service || !homedir) + return -1; + + if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) { + if ((iHomeService = load_registry_service(HOMES_NAME)) < 0) { + return -1; + } + } + + /* + * If this is a winbindd provided username, remove + * the domain component before adding the service. + * Log a warning if the "path=" parameter does not + * include any macros. + */ + + { + const char *p = strchr(service,*lp_winbind_separator()); + + /* We only want the 'user' part of the string */ + if (p) { + service = p + 1; + } + } + + if (!lp_add_home(service, iHomeService, username, homedir)) { + return -1; + } + + return lp_servicenumber(service); + +} + /** * Find a service entry. * @@ -386,7 +389,10 @@ int find_service(fstring service) if (iService < 0) { int iPrinterService; - if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) >= 0) { + if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) { + iPrinterService = load_registry_service(PRINTERS_NAME); + } + if (iPrinterService) { DEBUG(3,("checking whether %s is a valid printer name...\n", service)); if (pcap_printername_ok(service)) { DEBUG(3,("%s is a valid printer name\n", service)); -- cgit From 1abc94e95b1cdeff0d85840b4dfc6e5cea3a71da Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 16:58:29 +0100 Subject: Initialise Globals.ConfigBackend from global var config_backend. and use lp_config_backend() instead of config_backend. Michael (This used to be commit 9f69efe954cde6c6cce4283ba35a553ca980c347) --- source3/param/loadparm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 4ec3c107e8..4afef23103 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1545,7 +1545,7 @@ static void init_globals(bool first_time_only) Globals.bLoadPrinters = True; Globals.PrintcapCacheTime = 750; /* 12.5 minutes */ - Globals.ConfigBackend = CONFIG_BACKEND_FILE; + Globals.ConfigBackend = config_backend; /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */ /* Discovered by 2 days of pain by Don McCall @ HP :-). */ @@ -3674,7 +3674,7 @@ bool lp_file_list_changed(void) DEBUG(6, ("lp_file_list_changed()\n")); - if (config_backend == CONFIG_BACKEND_REGISTRY) { + if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) { reg_tdb = lp_regdb_open(); if (reg_tdb && (regdb_last_seqnum != tdb_get_seqnum(reg_tdb->tdb))) { @@ -5713,7 +5713,7 @@ bool lp_load(const char *pszFname, Globals.param_opt = NULL; } - if (config_backend == CONFIG_BACKEND_FILE) { + if (lp_config_backend() == CONFIG_BACKEND_FILE) { n2 = alloc_sub_basic(get_current_username(), current_user_info.domain, pszFname); @@ -5737,16 +5737,22 @@ bool lp_load(const char *pszFname, } if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) { + /* + * We need to use this extra global variable here to + * survive restart: init_globals usese this as a default + * for ConfigBackend. Otherwise, init_globals would + * send us into an endless loop here. + */ config_backend = CONFIG_BACKEND_REGISTRY; /* start over */ return lp_load(pszFname, global_only, save_defaults, add_ipc, initialize_globals); } - } else if (config_backend == CONFIG_BACKEND_REGISTRY) { + } else if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) { bRetval = process_registry_globals(do_parameter); } else { DEBUG(0, ("Illegal config backend given: %d\n", - config_backend)); + lp_config_backend())); bRetval = false; } -- cgit From d3be7a7bdd8b1ddbbcd39dd55d62467dc6c1a73b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 17:03:21 +0100 Subject: Add utility function lp_config_backend_is_registry(). So external callers can determine if we are running on registry config without knowing the internals. Michael (This used to be commit d8a7c3ec8e2bd548509178f138d00a3b57119d10) --- source3/param/loadparm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 4afef23103..90b015b5a2 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -3663,6 +3663,14 @@ bool lp_include_registry_globals(void) return include_registry_globals; } +/** + * Utility function for outsiders to check if we're running on registry. + */ +bool lp_config_backend_is_registry(void) +{ + return (lp_config_backend() == CONFIG_BACKEND_REGISTRY); +} + /******************************************************************* Check if a config file has changed date. ********************************************************************/ -- cgit From 7bfceba4bc49f5f5c8d2836dfd76e1ec15459631 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 17:05:38 +0100 Subject: Use lp_config_backend_is_registry() instead of lp_include_registry_globals(). Michael (This used to be commit c5a7d421c512a6221b0300549d7b5de0368d252e) --- source3/lib/netapi/serverinfo.c | 2 +- source3/libnet/libnet_join.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 67680ba55a..6cd074615b 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -167,7 +167,7 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_INVALID_PARAM; } - if (!lp_include_registry_globals()) { + if (!lp_config_backend_is_registry()) { return WERR_NOT_SUPPORTED; } diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index af7f9a6a21..a9978ba4b8 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1041,7 +1041,7 @@ static WERROR libnet_join_pre_processing(TALLOC_CTX *mem_ctx, return WERR_INVALID_PARAM; } - if (r->in.modify_config && !lp_include_registry_globals()) { + if (r->in.modify_config && !lp_config_backend_is_registry()) { return WERR_NOT_SUPPORTED; } @@ -1350,7 +1350,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx, static WERROR libnet_unjoin_pre_processing(TALLOC_CTX *mem_ctx, struct libnet_UnjoinCtx *r) { - if (r->in.modify_config && !lp_include_registry_globals()) { + if (r->in.modify_config && !lp_config_backend_is_registry()) { return WERR_NOT_SUPPORTED; } -- cgit From 762ca95be758d00f0dacf05d38e650af89f0bfba Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 17:09:07 +0100 Subject: Remove special semantics of "include = registry" from loadparm.c This is now replaced by "config backend = registry". Michael (This used to be commit 56801810253ae870437f694947f58c27661cef9b) --- source3/param/loadparm.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 90b015b5a2..4fc8b89ec1 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -70,16 +70,7 @@ extern userdom_struct current_user_info; #define HOMES_NAME "homes" #endif -/* the special value for the include parameter - * to be interpreted not as a file name but to - * trigger loading of the global smb.conf options - * from registry. */ -#ifndef INCLUDE_REGISTRY_NAME -#define INCLUDE_REGISTRY_NAME "registry" -#endif - static int regdb_last_seqnum = 0; -static bool include_registry_globals = False; #define CONFIG_BACKEND_FILE 0 #define CONFIG_BACKEND_REGISTRY 1 @@ -3443,8 +3434,6 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) char * valstr; struct registry_value *value = NULL; - include_registry_globals = True; - ZERO_STRUCT(data); reg_tdb = lp_regdb_open(); @@ -3557,8 +3546,6 @@ static bool process_registry_globals(bool (*pfunc)(const char *, const char *)) smb_panic("Failed to create talloc context!"); } - include_registry_globals = True; - if (!registry_init_regdb()) { DEBUG(1, ("Error initializing the registry.\n")); goto done; @@ -3658,11 +3645,6 @@ static void add_to_file_list(const char *fname, const char *subfname) } } -bool lp_include_registry_globals(void) -{ - return include_registry_globals; -} - /** * Utility function for outsiders to check if we're running on registry. */ @@ -3804,17 +3786,6 @@ static bool handle_include(int snum, const char *pszParmValue, char **ptr) { char *fname; - if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) { - if (bInGlobalSection) { - return process_registry_globals(do_parameter); - } - else { - DEBUG(1, ("\"include = registry\" only effective " - "in %s section\n", GLOBAL_NAME)); - return false; - } - } - fname = alloc_sub_basic(get_current_username(), current_user_info.domain, pszParmValue); -- cgit From 422fbd0bbd5516a2175e922f500cf72ce08de4b4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 17:15:08 +0100 Subject: Add my (C) to loadparm.c. I think now that I have changed some substantial logic, I should confess.... :-) Michael (This used to be commit 704ac0ba49134d14dc00769b1cf2d9f55657bdfb) --- source3/param/loadparm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 4fc8b89ec1..0d3fbbf77c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -9,6 +9,7 @@ Copyright (C) Alexander Bokovoy 2002 Copyright (C) Stefan (metze) Metzmacher 2002 Copyright (C) Jim McDonough 2003 + Copyright (C) Michael Adam 2008 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 -- cgit From 8c41366a98ea96224adc2c108b940075431944fd Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 17:31:44 +0100 Subject: Add "config backend" to the parameters forbidden in registry config. Make registry based configs more fool-proof. Michael (This used to be commit 2ea55c03b25eb5e98be3449e12004a7246319acd) --- source3/lib/util_reg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/util_reg.c b/source3/lib/util_reg.c index 956f0475a5..2d7d70c63f 100644 --- a/source3/lib/util_reg.c +++ b/source3/lib/util_reg.c @@ -130,6 +130,7 @@ bool registry_smbconf_valname_forbidden(const char *valname) "include", "lock directory", "lock dir", + "config backend", NULL }; const char **forbidden = NULL; -- cgit From b0950557f90129b5cd51faf74dbf5d58a8f4d6b9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 20:25:57 +0100 Subject: Fix a missing prototype warning (This used to be commit 871cee04f26da97756804b38acfd366b6011dc9e) --- source3/lib/tdb/common/tdb_private.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/tdb/common/tdb_private.h b/source3/lib/tdb/common/tdb_private.h index 63a6d04e72..dd69903015 100644 --- a/source3/lib/tdb/common/tdb_private.h +++ b/source3/lib/tdb/common/tdb_private.h @@ -178,6 +178,7 @@ struct tdb_context { int tdb_munmap(struct tdb_context *tdb); void tdb_mmap(struct tdb_context *tdb); int tdb_lock(struct tdb_context *tdb, int list, int ltype); +int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype); int tdb_unlock(struct tdb_context *tdb, int list, int ltype); int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len); int tdb_transaction_lock(struct tdb_context *tdb, int ltype); -- cgit From c308d76305d0a598ce03c516ff0c3b3a8875c89c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 20:29:41 +0100 Subject: Fix some C++ warnings (This used to be commit 625241c4773ae5c80dd0cb0c07a86aff633c1ede) --- source3/lib/tdb/common/transaction.c | 7 +++++-- source3/modules/vfs_shadow_copy2.c | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c index ea0e3a93f3..c3e7a4e2c0 100644 --- a/source3/lib/tdb/common/transaction.c +++ b/source3/lib/tdb/common/transaction.c @@ -219,9 +219,12 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, uint8_t **new_blocks; /* expand the blocks array */ if (tdb->transaction->blocks == NULL) { - new_blocks = malloc((blk+1)*sizeof(uint8_t *)); + new_blocks = (uint8_t **)malloc( + (blk+1)*sizeof(uint8_t *)); } else { - new_blocks = realloc(tdb->transaction->blocks, (blk+1)*sizeof(uint8_t *)); + new_blocks = (uint8_t **)realloc( + tdb->transaction->blocks, + (blk+1)*sizeof(uint8_t *)); } if (new_blocks == NULL) { tdb->ecode = TDB_ERR_OOM; diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 54fc672b9c..ddbc5aab18 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -345,7 +345,7 @@ static int shadow_copy2_open(vfs_handle_struct *handle, static SMB_STRUCT_DIR *shadow_copy2_opendir(vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attr) { - SHADOW2_NEXT(OPENDIR, (handle, name, mask, attr), void*, NULL); + SHADOW2_NEXT(OPENDIR, (handle, name, mask, attr), SMB_STRUCT_DIR *, NULL); } static int shadow_copy2_stat(vfs_handle_struct *handle, @@ -413,7 +413,7 @@ static int shadow_copy2_mknod(vfs_handle_struct *handle, static char *shadow_copy2_realpath(vfs_handle_struct *handle, const char *fname, char *resolved_path) { - SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), void*, NULL); + SHADOW2_NEXT(REALPATH, (handle, name, resolved_path), char *, NULL); } static NTSTATUS shadow_copy2_get_nt_acl(vfs_handle_struct *handle, -- cgit From 9158169c97295de8a0cb31c841d20727b1755851 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 20:31:02 +0100 Subject: Fix an uninitialized variable warning (This used to be commit dcb7fb2c0d8e4b798b36e8caf480d198f3e08d00) --- source3/modules/vfs_xattr_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 3a72831b5b..29864a8f94 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -134,7 +134,7 @@ static struct db_record *xattr_tdb_lock_attrs(TALLOC_CTX *mem_ctx, static NTSTATUS xattr_tdb_save_attrs(struct db_record *rec, const struct tdb_xattrs *attribs) { - TDB_DATA data; + TDB_DATA data = tdb_null; NTSTATUS status; status = xattr_tdb_push_attrs(talloc_tos(), attribs, &data); -- cgit From 088183896a6e46cc7e5a5ff94e2e94b948119a8a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 20:34:45 +0100 Subject: default to tdbsam instead of smbpasswd (This used to be commit ab8ff39fd51929aae2f4088ca5b1d67e5cb7099e) --- source3/param/loadparm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 0d3fbbf77c..a6529a6cb8 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1625,7 +1625,7 @@ static void init_globals(bool first_time_only) a large number of sites (tridge) */ Globals.bHostnameLookups = False; - string_set(&Globals.szPassdbBackend, "smbpasswd"); + string_set(&Globals.szPassdbBackend, "tdbsam"); string_set(&Globals.szLdapSuffix, ""); string_set(&Globals.szLdapMachineSuffix, ""); string_set(&Globals.szLdapUserSuffix, ""); -- cgit From 7084854bd94c84250becc7e4e13035fde2d7a728 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 21:04:52 +0100 Subject: Next try to fix the max dead record calculation (This used to be commit 4f95c58040f46f343f55f9a5db2655a5e3b62c00) --- source3/lib/tdb/common/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c index 94140a4baa..2a438971d4 100644 --- a/source3/lib/tdb/common/open.c +++ b/source3/lib/tdb/common/open.c @@ -179,7 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - tdb->max_dead_records = (open_flags & TDB_VOLATILE) ? 5 : 0; + tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0; if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", -- cgit From 5b37e815b429f0a8c114e36892385d8b0d86ea6a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 21:18:26 +0100 Subject: Don't try ftruncate when the tdb is opened read-only Tridge, Jeremy, please check! Thanks, Volker (This used to be commit e4f46d527411c54e8f26c05033b744c751810c32) --- source3/lib/tdb/common/open.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/tdb/common/open.c b/source3/lib/tdb/common/open.c index 2a438971d4..b19e4cea29 100644 --- a/source3/lib/tdb/common/open.c +++ b/source3/lib/tdb/common/open.c @@ -227,6 +227,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* we need to zero database if we are the only one with it open */ if ((tdb_flags & TDB_CLEAR_IF_FIRST) && + (!tdb->read_only) && (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) { open_flags |= O_CREAT; if (ftruncate(tdb->fd, 0) == -1) { -- cgit From 60c3ec3fca08b7d36df760cd6093adb5a807afa0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Jan 2008 21:26:16 +0100 Subject: Revert "default to tdbsam instead of smbpasswd" This reverts commit ab8ff39fd51929aae2f4088ca5b1d67e5cb7099e. (This used to be commit 5838a9f556f151dc7c1773dcdc598b8ba79fca44) --- source3/param/loadparm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index a6529a6cb8..0d3fbbf77c 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1625,7 +1625,7 @@ static void init_globals(bool first_time_only) a large number of sites (tridge) */ Globals.bHostnameLookups = False; - string_set(&Globals.szPassdbBackend, "tdbsam"); + string_set(&Globals.szPassdbBackend, "smbpasswd"); string_set(&Globals.szLdapSuffix, ""); string_set(&Globals.szLdapMachineSuffix, ""); string_set(&Globals.szLdapUserSuffix, ""); -- cgit From bd8abea49fed09e131ab5162821b0ed05c1ab1b0 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 13:21:46 -0800 Subject: Fix IPv6 bug #5204, which caused krb5 DNS lookups for a name '['. Jeremy. (This used to be commit f2aa921505e49f894bfed4e5e2f9fc01918b1bb0) --- source3/lib/util_sock.c | 27 +++++++++++++++++-- source3/libads/kerberos.c | 69 ++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 81 insertions(+), 15 deletions(-) diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 945506ea77..10428113ae 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -475,6 +475,29 @@ bool is_address_any(const struct sockaddr_storage *psa) return false; } +/**************************************************************************** + Get a port number in host byte order from a sockaddr_storage. +****************************************************************************/ + +uint16_t get_sockaddr_port(const struct sockaddr_storage *pss) +{ + uint16_t port = 0; + + if (pss->ss_family != AF_INET) { +#if defined(HAVE_IPV6) + /* IPv6 */ + const struct sockaddr_in6 *sa6 = + (const struct sockaddr_in6 *)pss; + port = ntohs(sa6->sin6_port); +#endif + } else { + const struct sockaddr_in *sa = + (const struct sockaddr_in *)pss; + port = ntohs(sa->sin_port); + } + return port; +} + /**************************************************************************** Print out an IPv4 or IPv6 address from a struct sockaddr_storage. ****************************************************************************/ @@ -518,7 +541,7 @@ char *print_canonical_sockaddr(TALLOC_CTX *ctx, char *dest = NULL; int ret; - ret = getnameinfo((const struct sockaddr *)pss, + ret = sys_getnameinfo((const struct sockaddr *)pss, sizeof(struct sockaddr_storage), addr, sizeof(addr), NULL, 0, @@ -1847,7 +1870,7 @@ const char *get_peer_name(int fd, bool force_lookup) } /* Look up the remote host name. */ - ret = getnameinfo((struct sockaddr *)&ss, + ret = sys_getnameinfo((struct sockaddr *)&ss, length, name_buf, sizeof(name_buf), diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index e9222e8401..f7e947b1e7 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -25,6 +25,8 @@ #ifdef HAVE_KRB5 +#define DEFAULT_KRB5_PORT 88 + #define LIBADS_CCACHE_NAME "MEMORY:libads" /* @@ -665,6 +667,51 @@ int kerberos_kinit_password(const char *principal, NULL); } +/************************************************************************ +************************************************************************/ + +static char *print_kdc_line(char *mem_ctx, + const char *prev_line, + const struct sockaddr_storage *pss) +{ + char *kdc_str = NULL; + + if (pss->ss_family == AF_INET) { + kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", + prev_line, + print_canonical_sockaddr(mem_ctx, pss)); + } else { + char addr[INET6_ADDRSTRLEN]; + uint16_t port = get_sockaddr_port(pss); + + if (port != 0 && port != DEFAULT_KRB5_PORT) { + /* Currently for IPv6 we can't specify a non-default + krb5 port with an address, as this requires a ':'. + Resolve to a name. */ + char hostname[MAX_DNS_NAME_LENGTH]; + if (sys_getnameinfo((const struct sockaddr *)pss, + sizeof(*pss), + hostname, sizeof(hostname), + NULL, 0, + NI_NAMEREQD) == 0) { + /* Success, use host:port */ + kdc_str = talloc_asprintf(mem_ctx, + "%s\tkdc = %s:%u\n", + prev_line, + hostname, + (unsigned int)port); + return kdc_str; + } + } + kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", + prev_line, + print_sockaddr(addr, + sizeof(addr), + pss)); + } + return kdc_str; +} + /************************************************************************ Create a string list of available kdc's, possibly searching by sitename. Does DNS queries. @@ -677,12 +724,10 @@ static char *get_kdc_ip_string(char *mem_ctx, { int i; struct ip_service *ip_srv_site = NULL; - struct ip_service *ip_srv_nonsite; + struct ip_service *ip_srv_nonsite = NULL; int count_site = 0; int count_nonsite; - char *kdc_str = talloc_asprintf(mem_ctx, "\tkdc = %s\n", - print_canonical_sockaddr(mem_ctx, - pss)); + char *kdc_str = print_kdc_line(mem_ctx, "", pss); if (kdc_str == NULL) { return NULL; @@ -700,10 +745,9 @@ static char *get_kdc_ip_string(char *mem_ctx, } /* Append to the string - inefficient * but not done often. */ - kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", - kdc_str, - print_canonical_sockaddr(mem_ctx, - &ip_srv_site[i].ss)); + kdc_str = print_kdc_line(mem_ctx, + kdc_str, + &ip_srv_site[i].ss); if (!kdc_str) { SAFE_FREE(ip_srv_site); return NULL; @@ -738,10 +782,9 @@ static char *get_kdc_ip_string(char *mem_ctx, } /* Append to the string - inefficient but not done often. */ - kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", + kdc_str = print_kdc_line(mem_ctx, kdc_str, - print_canonical_sockaddr(mem_ctx, - &ip_srv_nonsite[i].ss)); + &ip_srv_nonsite[i].ss); if (!kdc_str) { SAFE_FREE(ip_srv_site); SAFE_FREE(ip_srv_nonsite); @@ -873,8 +916,8 @@ bool create_local_private_krb5_conf_for_domain(const char *realm, } DEBUG(5,("create_local_private_krb5_conf_for_domain: wrote " - "file %s with realm %s KDC = %s\n", - fname, realm_upper, print_canonical_sockaddr(dname, pss) )); + "file %s with realm %s KDC list = %s\n", + fname, realm_upper, kdc_ip_string)); /* Set the environment variable to this file. */ setenv("KRB5_CONFIG", fname, 1); -- cgit From 70426bdd307be2bbaa2ec6f111440bae69216933 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 13:28:24 -0800 Subject: Tidy up code and debug for non-default krb5 IPv6 port. Jeremy. (This used to be commit 79b7972de4c2a8c71e37642ddf7e5bbed53dd58a) --- source3/libads/kerberos.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index f7e947b1e7..b99525047f 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -689,25 +689,31 @@ static char *print_kdc_line(char *mem_ctx, krb5 port with an address, as this requires a ':'. Resolve to a name. */ char hostname[MAX_DNS_NAME_LENGTH]; - if (sys_getnameinfo((const struct sockaddr *)pss, + int ret = sys_getnameinfo((const struct sockaddr *)pss, sizeof(*pss), hostname, sizeof(hostname), NULL, 0, - NI_NAMEREQD) == 0) { - /* Success, use host:port */ - kdc_str = talloc_asprintf(mem_ctx, + NI_NAMEREQD); + if (ret) { + DEBUG(0,("print_kdc_line: can't resolve name " + "for kdc with non-default port %s. " + "Error %s\n.", + print_canonical_sockaddr(mem_ctx, pss), + gai_strerror(ret))); + } + /* Success, use host:port */ + kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s:%u\n", - prev_line, + prev_line, hostname, (unsigned int)port); - return kdc_str; - } - } - kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", + } else { + kdc_str = talloc_asprintf(mem_ctx, "%s\tkdc = %s\n", prev_line, print_sockaddr(addr, sizeof(addr), pss)); + } } return kdc_str; } -- cgit From 3020ec12a39276eaf3978323f4048b8a2e430bea Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 17:22:31 -0800 Subject: Fix the mess that ab just made of the new VFS code. NEEDS MORE TESTING ! Jeremy. (This used to be commit bcc94aed6f03211866aa85753a90fece87846ba9) --- examples/VFS/skel_opaque.c | 28 ++++++++++++++++++++++- examples/VFS/skel_transparent.c | 28 ++++++++++++++++++++++- source3/include/vfs.h | 50 ++++++++++++++++++++--------------------- source3/include/vfs_macros.h | 38 +++++++++++++++---------------- source3/modules/vfs_default.c | 31 +++++++++++++++---------- 5 files changed, 116 insertions(+), 59 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 5b196af5eb..1c2fc45011 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -580,6 +580,26 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc return vfswrap_aio_suspend(NULL, fsp, aiocb, n, ts); } +static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + return vfswrap_aio_force(NULL, fsp); +} + +static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +{ + return vfswrap_set_offline(NULL, path, sbuf, offline); +} + +static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) +{ + return vfswrap_set_offline(NULL, path); +} + +static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) +{ + return vfswrap_is_remotestorage(NULL, path); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -676,7 +696,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_OPAQUE}, - + /* EA operations. */ {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_OPAQUE}, @@ -699,6 +719,12 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_OPAQUE}, + + /* offline operations */ + {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_OPAQUE}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 55407be10c..0a934976c4 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -539,6 +539,26 @@ static int skel_aio_suspend(struct vfs_handle_struct *handle, struct files_struc return SMB_VFS_NEXT_AIO_SUSPEND(handle, fsp, aiocb, n, ts); } +static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +{ + return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); +} + +static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +{ + return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf, offline); +} + +static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) +{ + return SMB_VFS_NEXT_SET_OFFLINE(handle, path); +} + +static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) +{ + return SMB_VFS_NEXT_IS_REMOTESTORAGE(handle, path); +} + /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -633,7 +653,7 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_sys_acl_free_text), SMB_VFS_OP_SYS_ACL_FREE_TEXT, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_sys_acl_free_acl), SMB_VFS_OP_SYS_ACL_FREE_ACL, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_sys_acl_free_qualifier), SMB_VFS_OP_SYS_ACL_FREE_QUALIFIER, SMB_VFS_LAYER_TRANSPARENT}, - + /* EA operations. */ {SMB_VFS_OP(skel_getxattr), SMB_VFS_OP_GETXATTR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_lgetxattr), SMB_VFS_OP_LGETXATTR, SMB_VFS_LAYER_TRANSPARENT}, @@ -656,6 +676,12 @@ static vfs_op_tuple skel_op_tuples[] = { {SMB_VFS_OP(skel_aio_error), SMB_VFS_OP_AIO_ERROR, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_aio_fsync), SMB_VFS_OP_AIO_FSYNC, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_aio_suspend), SMB_VFS_OP_AIO_SUSPEND, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_TRANSPARENT}, + + /* offline operations */ + {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_TRANSPARENT}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/source3/include/vfs.h b/source3/include/vfs.h index be3cd91520..b0da7e81a5 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -70,7 +70,6 @@ * timestamp resolition. JRA. */ /* Changed to version21 to add chflags operation -- jpeach */ /* Changed to version22 to add lchown operation -- jra */ -/* Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ /* Leave at 22 - not yet released. But change set_nt_acl to return an NTSTATUS. jra. */ /* Leave at 22 - not yet released. Add file_id_create operation. --metze */ /* Leave at 22 - not yet released. Change all BOOL parameters (int) to bool. jra. */ @@ -104,8 +103,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ - - +/* Leave at 22 - not yet released. Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ #define SMB_VFS_INTERFACE_VERSION 22 @@ -266,7 +264,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_IS_REMOTESTORAGE, /* This should always be last enum value */ - + SMB_VFS_OP_LAST } vfs_op_type; @@ -276,7 +274,7 @@ typedef enum _vfs_op_type { struct vfs_ops { struct vfs_fn_pointers { /* Disk operations */ - + int (*connect_fn)(struct vfs_handle_struct *handle, const char *service, const char *user); void (*disconnect)(struct vfs_handle_struct *handle); SMB_BIG_UINT (*disk_free)(struct vfs_handle_struct *handle, const char *path, bool small_query, SMB_BIG_UINT *bsize, @@ -285,9 +283,9 @@ struct vfs_ops { int (*set_quota)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt); int (*get_shadow_copy_data)(struct vfs_handle_struct *handle, struct files_struct *fsp, SHADOW_COPY_DATA *shadow_copy_data, bool labels); int (*statvfs)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf); - + /* Directory operations */ - + SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes); SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp); void (*seekdir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp, long offset); @@ -296,9 +294,9 @@ struct vfs_ops { int (*mkdir)(struct vfs_handle_struct *handle, const char *path, mode_t mode); int (*rmdir)(struct vfs_handle_struct *handle, const char *path); int (*closedir)(struct vfs_handle_struct *handle, SMB_STRUCT_DIR *dir); - + /* File operations */ - + int (*open)(struct vfs_handle_struct *handle, const char *fname, files_struct *fsp, int flags, mode_t mode); int (*close_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, int fd); ssize_t (*read)(struct vfs_handle_struct *handle, struct files_struct *fsp, void *data, size_t n); @@ -343,7 +341,7 @@ struct vfs_ops { struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode); /* NT ACL operations. */ - + NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, uint32 security_info, @@ -361,12 +359,12 @@ struct vfs_ops { const char *name, uint32 security_info_sent, struct security_descriptor *psd); - + /* POSIX ACL operations. */ - + int (*chmod_acl)(struct vfs_handle_struct *handle, const char *name, mode_t mode); int (*fchmod_acl)(struct vfs_handle_struct *handle, struct files_struct *fsp, mode_t mode); - + int (*sys_acl_get_entry)(struct vfs_handle_struct *handle, SMB_ACL_T theacl, int entry_id, SMB_ACL_ENTRY_T *entry_p); int (*sys_acl_get_tag_type)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T *tag_type_p); int (*sys_acl_get_permset)(struct vfs_handle_struct *handle, SMB_ACL_ENTRY_T entry_d, SMB_ACL_PERMSET_T *permset_p); @@ -413,11 +411,11 @@ struct vfs_ops { int (*aio_fsync)(struct vfs_handle_struct *handle, struct files_struct *fsp, int op, SMB_STRUCT_AIOCB *aiocb); int (*aio_suspend)(struct vfs_handle_struct *handle, struct files_struct *fsp, const SMB_STRUCT_AIOCB * const aiocb[], int n, const struct timespec *timeout); bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); - + /* offline operations */ - int (*is_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); - int (*set_offline)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); - bool (*is_remotestorage)(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path); + int (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); + int (*set_offline)(struct vfs_handle_struct *handle, const char *path); + bool (*is_remotestorage)(struct vfs_handle_struct *handle, const char *path); } ops; @@ -540,7 +538,7 @@ struct vfs_ops { struct vfs_handle_struct *aio_fsync; struct vfs_handle_struct *aio_suspend; struct vfs_handle_struct *aio_force; - + /* offline operations */ struct vfs_handle_struct *is_offline; struct vfs_handle_struct *set_offline; @@ -550,22 +548,22 @@ struct vfs_ops { /* Possible VFS operation layers (per-operation) - + These values are used by VFS subsystem when building vfs_ops for connection from multiple VFS modules. Internally, Samba differentiates only opaque and transparent layers at this process. Other types are used for providing better diagnosing facilities. - + Most modules will provide transparent layers. Opaque layer is for modules which implement actual file system calls (like DB-based VFS). For example, default POSIX VFS which is built in into Samba is an opaque VFS module. - + Other layer types (audit, splitter, scanner) were designed to provide different degree of transparency and for diagnosing VFS module behaviour. - + Each module can implement several layers at the same time provided that only one layer is used per each operation. - + */ typedef enum _vfs_op_layer { @@ -584,7 +582,7 @@ typedef enum _vfs_op_layer { /* VFS operation description. Each VFS module registers an array of vfs_op_tuple to VFS subsystem, - which describes all operations this module is willing to intercept. + which describes all operations this module is willing to intercept. VFS subsystem initializes then the conn->vfs_ops and conn->vfs_opaque_ops structs using this information. */ @@ -609,12 +607,12 @@ typedef struct vfs_handle_struct { typedef struct vfs_statvfs_struct { /* For undefined recommended transfer size return -1 in that field */ uint32 OptimalTransferSize; /* bsize on some os, iosize on other os */ - uint32 BlockSize; + uint32 BlockSize; /* The next three fields are in terms of the block size. (above). If block size is unknown, 4096 would be a - reasonable block size for a server to report. + reasonable block size for a server to report. Note that returning the blocks/blocksavail removes need to make a second call (to QFSInfo level 0x103 to get this info. UserBlockAvail is typically less than or equal to BlocksAvail, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index dbba781377..39f245fa35 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -1,18 +1,18 @@ -/* +/* Unix SMB/CIFS implementation. VFS wrapper macros Copyright (C) Stefan (metze) Metzmacher 2003 - + 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 the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -26,7 +26,7 @@ (Fixes should go also into the vfs_opaque_* and vfs_next_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_CONNECT(conn, service, user) ((conn)->vfs.ops.connect_fn((conn)->vfs.handles.connect_hnd, (service), (user))) #define SMB_VFS_DISCONNECT(conn) ((conn)->vfs.ops.disconnect((conn)->vfs.handles.disconnect)) #define SMB_VFS_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs.ops.disk_free((conn)->vfs.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -44,7 +44,7 @@ #define SMB_VFS_MKDIR(conn, path, mode) ((conn)->vfs.ops.mkdir((conn)->vfs.handles.mkdir,(path), (mode))) #define SMB_VFS_RMDIR(conn, path) ((conn)->vfs.ops.rmdir((conn)->vfs.handles.rmdir, (path))) #define SMB_VFS_CLOSEDIR(conn, dir) ((conn)->vfs.ops.closedir((conn)->vfs.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs.ops.open)((conn)->vfs.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_CLOSE(fsp, fd) ((fsp)->conn->vfs.ops.close_fn((fsp)->conn->vfs.handles.close_hnd, (fsp), (fd))) @@ -141,9 +141,9 @@ #define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(conn),(path))) -#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path))) +#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(path))) /******************************************************************* Don't access conn->vfs_opaque.ops directly!!! @@ -151,7 +151,7 @@ (Fixes should also go into the vfs_* and vfs_next_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_OPAQUE_CONNECT(conn, service, user) ((conn)->vfs_opaque.ops.connect_fn((conn)->vfs_opaque.handles.connect_hnd, (service), (user))) #define SMB_VFS_OPAQUE_DISCONNECT(conn) ((conn)->vfs_opaque.ops.disconnect((conn)->vfs_opaque.handles.disconnect)) #define SMB_VFS_OPAQUE_DISK_FREE(conn, path, small_query, bsize, dfree ,dsize) ((conn)->vfs_opaque.ops.disk_free((conn)->vfs_opaque.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -169,7 +169,7 @@ #define SMB_VFS_OPAQUE_MKDIR(conn, path, mode) ((conn)->vfs_opaque.ops.mkdir((conn)->vfs_opaque.handles.mkdir,(path), (mode))) #define SMB_VFS_OPAQUE_RMDIR(conn, path) ((conn)->vfs_opaque.ops.rmdir((conn)->vfs_opaque.handles.rmdir, (path))) #define SMB_VFS_OPAQUE_CLOSEDIR(conn, dir) ((conn)->vfs_opaque.ops.closedir((conn)->vfs_opaque.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_OPAQUE_OPEN(conn, fname, fsp, flags, mode) (((conn)->vfs_opaque.ops.open)((conn)->vfs_opaque.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_OPAQUE_CLOSE(fsp, fd) ((fsp)->conn->vfs_opaque.ops.close_fn((fsp)->conn->vfs_opaque.handles.close_hnd, (fsp), (fd))) @@ -266,9 +266,9 @@ #define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(conn),(path))) -#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path))) +#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(path))) /******************************************************************* Don't access handle->vfs_next.ops.* directly!!! @@ -276,7 +276,7 @@ (Fixes should go also into the vfs_* and vfs_opaque_* macros!) ********************************************************************/ -/* Disk operations */ +/* Disk operations */ #define SMB_VFS_NEXT_CONNECT(handle, service, user) ((handle)->vfs_next.ops.connect_fn((handle)->vfs_next.handles.connect_hnd, (service), (user))) #define SMB_VFS_NEXT_DISCONNECT(handle) ((handle)->vfs_next.ops.disconnect((handle)->vfs_next.handles.disconnect)) #define SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize, dfree ,dsize) ((handle)->vfs_next.ops.disk_free((handle)->vfs_next.handles.disk_free, (path), (small_query), (bsize), (dfree), (dsize))) @@ -295,7 +295,7 @@ #define SMB_VFS_NEXT_MKDIR(handle, path, mode) ((handle)->vfs_next.ops.mkdir((handle)->vfs_next.handles.mkdir,(path), (mode))) #define SMB_VFS_NEXT_RMDIR(handle, path) ((handle)->vfs_next.ops.rmdir((handle)->vfs_next.handles.rmdir, (path))) #define SMB_VFS_NEXT_CLOSEDIR(handle, dir) ((handle)->vfs_next.ops.closedir((handle)->vfs_next.handles.closedir, dir)) - + /* File operations */ #define SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode) (((handle)->vfs_next.ops.open)((handle)->vfs_next.handles.open, (fname), (fsp), (flags), (mode))) #define SMB_VFS_NEXT_CLOSE(handle, fsp, fd) ((handle)->vfs_next.ops.close_fn((handle)->vfs_next.handles.close_hnd, (fsp), (fd))) @@ -392,8 +392,8 @@ #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_NEXT_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_next.ops.is_offline((conn)->vfs_next.handles.is_offline,(conn),(path),(sbuf),(offline))) -#define SMB_VFS_NEXT_SET_OFFLINE(conn,path) ((conn)->vfs_next.ops.set_offline((conn)->vfs_next.handles.set_offline,(conn),(path))) -#define SMB_VFS_NEXT_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_next.ops.is_remotestorage((conn)->vfs_next.handles.is_remotestorage,(conn),(path))) +#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf,offline) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path))) +#define SMB_VFS_NEXT_IS_REMOTESTORAGE(handle,path) ((handle)->vfs_next.ops.is_remotestorage((handle)->vfs_next.handles.is_remotestorage,(path))) #endif /* _VFS_MACROS_H */ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 3e78c69a5e..d4ba4dc611 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1225,35 +1225,42 @@ static int vfswrap_aio_suspend(struct vfs_handle_struct *handle, struct files_st return sys_aio_suspend(aiocb, n, timeout); } -static int vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) +static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_struct *fsp) { - return False; + return false; } -static int vfswrap_is_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static int vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) { if (ISDOT(path) || ISDOTDOT(path)) { - return 1; + *offline = false; + return 0; } - - if (!lp_dmapi_support(SNUM(conn)) || !dmapi_have_session()) { + + if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) { +#if defined(ENOTSUP) + errno = ENOTSUP; +#endif return -1; } - + *offline = (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; return 0; } -static int vfswrap_set_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) +static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path) { /* We don't know how to set offline bit by default, needs to be overriden in the vfs modules */ +#if defined(ENOTSUP) + errno = ENOTSUP; +#endif return -1; } -static bool vfswrap_is_remotestorage(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) +static bool vfswrap_is_remotestorage(struct vfs_handle_struct *handle, const char *path) { /* We don't know how to detect that volume is remote storage. VFS modules should redefine it. */ - return False; + return false; } @@ -1476,14 +1483,14 @@ static vfs_op_tuple vfs_default_ops[] = { {SMB_VFS_OP(vfswrap_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_OPAQUE}, - + {SMB_VFS_OP(vfswrap_is_offline),SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_OPAQUE}, - + /* Finish VFS operations definition */ {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, -- cgit From f44713df4d636203354c55d9a9bc2538073cf0af Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Jan 2008 17:33:19 -0800 Subject: Fix bug found by Derrell - windows returns an read return offset of zero if return size is zero. Should fix testread libsmbclient code. Jeremy. (This used to be commit df3c4648399f8d62ff6fe0013be8b89abc18f0f0) --- source3/libsmb/clireadwrite.c | 49 ++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 6b39a885f0..af13ed8f73 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -134,6 +134,8 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ return -1; } + /* size2 is the number of bytes the server returned. + * Might be zero. */ size2 = SVAL(cli->inbuf, smb_vwv5); size2 |= (((unsigned int)(SVAL(cli->inbuf, smb_vwv7))) << 16); @@ -145,27 +147,32 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_ return -1; } - if (!direct_reads) { - /* Copy data into buffer */ - p = smb_base(cli->inbuf) + SVAL(cli->inbuf,smb_vwv6); - memcpy(buf + total, p, size2); - } else { - /* Ensure the remaining data matches the return size. */ - ssize_t toread = smb_len_large(cli->inbuf) - SVAL(cli->inbuf,smb_vwv6); - - /* Ensure the size is correct. */ - if (toread != size2) { - DEBUG(5,("direct read logic fail toread (%d) != size2 (%u)\n", - (int)toread, (unsigned int)size2 )); - return -1; - } - - /* Read data directly into buffer */ - toread = cli_receive_smb_data(cli,buf+total,size2); - if (toread != size2) { - DEBUG(5,("direct read read failure toread (%d) != size2 (%u)\n", - (int)toread, (unsigned int)size2 )); - return -1; + if (size2) { + /* smb_vwv6 is the offset in the packet of the returned + * data bytes. Only valid if size2 != 0. */ + + if (!direct_reads) { + /* Copy data into buffer */ + p = smb_base(cli->inbuf) + SVAL(cli->inbuf,smb_vwv6); + memcpy(buf + total, p, size2); + } else { + /* Ensure the remaining data matches the return size. */ + ssize_t toread = smb_len_large(cli->inbuf) - SVAL(cli->inbuf,smb_vwv6); + + /* Ensure the size is correct. */ + if (toread != size2) { + DEBUG(5,("direct read logic fail toread (%d) != size2 (%u)\n", + (int)toread, (unsigned int)size2 )); + return -1; + } + + /* Read data directly into buffer */ + toread = cli_receive_smb_data(cli,buf+total,size2); + if (toread != size2) { + DEBUG(5,("direct read read failure toread (%d) != size2 (%u)\n", + (int)toread, (unsigned int)size2 )); + return -1; + } } } -- cgit From 6de904b836f4fdf5b0b027a09554afe3c13e05ca Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 17 Jan 2008 07:34:33 +0300 Subject: Fix more VFS API mixup with offline files I'm sorry for this mess. :-( (This used to be commit e1f5a8f10795831d3c7902d9803c9571c8ac811a) --- source3/modules/vfs_tsmsm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index fe791b24bf..c2d826f818 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -137,7 +137,6 @@ static int tsmsm_connect(struct vfs_handle_struct *handle, } static int tsmsm_is_offline(struct vfs_handle_struct *handle, - struct connection_struct *conn, const char *path, SMB_STRUCT_STAT *stbuf, bool *offline) { @@ -171,7 +170,7 @@ static int tsmsm_is_offline(struct vfs_handle_struct *handle, ret = -1; DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) - %s\n", path, strerror(errno))); - *offline = True; + *offline = true; goto done; } @@ -210,7 +209,7 @@ static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struc sbuf.st_blocks, sbuf.st_size, tsmd->online_ratio)); return !(512 * (off_t)sbuf.st_blocks >= sbuf.st_size * tsmd->online_ratio); } - return False; + return false; } static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, @@ -277,7 +276,7 @@ static ssize_t tsmsm_pwrite(struct vfs_handle_struct *handle, struct files_struc return result; } -static int tsmsm_set_offline(struct vfs_handle_struct *handle, struct connection_struct *conn, +static int tsmsm_set_offline(struct vfs_handle_struct *handle, const char *path) { struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; int result = 0; @@ -297,7 +296,7 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle, struct connection return result; } -static bool tsmsm_is_remotestorage(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path) { +static bool tsmsm_is_remotestorage(struct vfs_handle_struct *handle, const char *path) { return True; } -- cgit From 026a66abecea3e3a54cdbfb97129d5e65608e5df Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 17 Jan 2008 14:57:35 +0300 Subject: Rework of VFS is_offline() function to only return boolean offline/online result for a file. This makes sense as upper levels are only taking returned result of 0 (no error) into consideration when deciding whether to mark file offline/online as returned from is_offline. That means that we simply can move the decision down to VFS module and clean up upper levels so that they always see only file status. If there is an error when trying to identify file status, then VFS module could decide what to return (offline or online) by itself -- after all, it ought to have system-specific knowledge anyway. (This used to be commit 75cc08661473cce62756fa062071bb2bc1fb39ec) --- examples/VFS/skel_opaque.c | 4 ++-- examples/VFS/skel_transparent.c | 4 ++-- source3/include/vfs.h | 2 +- source3/include/vfs_macros.h | 6 +++--- source3/modules/vfs_default.c | 10 ++++------ source3/modules/vfs_tsmsm.c | 16 +++++++--------- source3/smbd/dosmode.c | 5 ++--- 7 files changed, 21 insertions(+), 26 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 1c2fc45011..42154c47a6 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -585,9 +585,9 @@ static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct return vfswrap_aio_force(NULL, fsp); } -static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return vfswrap_set_offline(NULL, path, sbuf, offline); + return vfswrap_is_offline(NULL, path, sbuf); } static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 0a934976c4..997783819c 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -544,9 +544,9 @@ static bool skel_aio_force(struct vfs_handle_struct *handle, struct files_struct return SMB_VFS_NEXT_AIO_FORCE(handle, fsp); } -static int skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static bool skel_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { - return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf, offline); + return SMB_VFS_NEXT_IS_OFFLINE(handle, path, sbuf); } static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index b0da7e81a5..da5494927e 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -413,7 +413,7 @@ struct vfs_ops { bool (*aio_force)(struct vfs_handle_struct *handle, struct files_struct *fsp); /* offline operations */ - int (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline); + bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); int (*set_offline)(struct vfs_handle_struct *handle, const char *path); bool (*is_remotestorage)(struct vfs_handle_struct *handle, const char *path); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 39f245fa35..f7c7e7d623 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -141,7 +141,7 @@ #define SMB_VFS_AIO_FORCE(fsp) ((fsp)->conn->vfs.ops.aio_force((fsp)->conn->vfs.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf))) #define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path))) #define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(path))) @@ -266,7 +266,7 @@ #define SMB_VFS_OPAQUE_AIO_FORCE(fsp) ((fsp)->conn->vfs_opaque.ops.aio_force((fsp)->conn->vfs_opaque.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf,offline) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf))) #define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path))) #define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(path))) @@ -392,7 +392,7 @@ #define SMB_VFS_NEXT_AIO_FORCE(handle,fsp) ((handle)->vfs_next.ops.aio_force((handle)->vfs_next.handles.aio_force,(fsp))) /* Offline operations */ -#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf,offline) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf),(offline))) +#define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf))) #define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path))) #define SMB_VFS_NEXT_IS_REMOTESTORAGE(handle,path) ((handle)->vfs_next.ops.is_remotestorage((handle)->vfs_next.handles.is_remotestorage,(path))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index d4ba4dc611..755bcdeefa 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1230,22 +1230,20 @@ static bool vfswrap_aio_force(struct vfs_handle_struct *handle, struct files_str return false; } -static int vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf, bool *offline) +static bool vfswrap_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf) { if (ISDOT(path) || ISDOTDOT(path)) { - *offline = false; - return 0; + return false; } if (!lp_dmapi_support(SNUM(handle->conn)) || !dmapi_have_session()) { #if defined(ENOTSUP) errno = ENOTSUP; #endif - return -1; + return false; } - *offline = (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; - return 0; + return (dmapi_file_flags(path) & FILE_ATTRIBUTE_OFFLINE) != 0; } static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *path) diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index c2d826f818..c737032907 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -136,24 +136,23 @@ static int tsmsm_connect(struct vfs_handle_struct *handle, return SMB_VFS_NEXT_CONNECT(handle, service, user); } -static int tsmsm_is_offline(struct vfs_handle_struct *handle, +static bool tsmsm_is_offline(struct vfs_handle_struct *handle, const char *path, - SMB_STRUCT_STAT *stbuf, - bool *offline) { + SMB_STRUCT_STAT *stbuf) { struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; void *dmhandle = NULL; size_t dmhandle_len = 0; size_t rlen; dm_attrname_t dmname; int ret; + bool offline; /* if the file has more than FILE_IS_ONLINE_RATIO of blocks available, then assume it is not offline (it may not be 100%, as it could be sparse) */ if (512 * (off_t)stbuf->st_blocks >= stbuf->st_size * tsmd->online_ratio) { - *offline = false; DEBUG(10,("%s not offline: st_blocks=%ld st_size=%ld online_ratio=%.2f\n", path, stbuf->st_blocks, stbuf->st_size, tsmd->online_ratio)); - return 0; + return false; } /* using POSIX capabilities does not work here. It's a slow path, so @@ -167,10 +166,9 @@ static int tsmsm_is_offline(struct vfs_handle_struct *handle, /* go the slow DMAPI route */ if (dm_path_to_handle((char*)path, &dmhandle, &dmhandle_len) != 0) { - ret = -1; DEBUG(2,("dm_path_to_handle failed - assuming offline (%s) - %s\n", path, strerror(errno))); - *offline = true; + offline = true; goto done; } @@ -181,7 +179,7 @@ static int tsmsm_is_offline(struct vfs_handle_struct *handle, DM_NO_TOKEN, &dmname, 0, NULL, &rlen); /* its offline if the IBMObj attribute exists */ - *offline = (ret == 0 || (ret == -1 && errno == E2BIG)); + offline = (ret == 0 || (ret == -1 && errno == E2BIG)); DEBUG(10,("dm_get_dmattr %s ret=%d (%s)\n", path, ret, strerror(errno))); @@ -191,7 +189,7 @@ static int tsmsm_is_offline(struct vfs_handle_struct *handle, done: unbecome_root(); - return ret; + return offline; } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 2021621dfa..eb18f65fca 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -350,7 +350,6 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf) { uint32 result = 0; bool offline; - int ret; DEBUG(8,("dos_mode: %s\n", path)); @@ -381,8 +380,8 @@ uint32 dos_mode(connection_struct *conn, const char *path,SMB_STRUCT_STAT *sbuf) } - ret = SMB_VFS_IS_OFFLINE(conn, path, sbuf, &offline); - if (S_ISREG(sbuf->st_mode) && (ret == 0) && offline) { + offline = SMB_VFS_IS_OFFLINE(conn, path, sbuf); + if (S_ISREG(sbuf->st_mode) && offline) { result |= FILE_ATTRIBUTE_OFFLINE; } -- cgit From 03387a0f5886d449eda359a5acecd830f3bd35bc Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Thu, 17 Jan 2008 16:51:14 +0300 Subject: Remove is_remotestorage() call from VFS. We already have statvfs() there to handle FS capabilities. As discussed with Volker, it is better to calculate FS capabilities at connection time. We already do this with help of VFS statvfs() call which allows to fill-in system-specific attributes including FS capabilities. So just re-use it if you want to represent additional capabilities in your modules. The only caution is that you need to call underlying statvfs() call to actually get system-specific capabilities (and other fields) added. Then add module-specific ones. (This used to be commit e342ca0d931f9a5c8ec9e472dc9c63f1fe012b3a) --- examples/VFS/skel_opaque.c | 6 ------ examples/VFS/skel_transparent.c | 1 - source3/include/vfs.h | 4 ---- source3/include/vfs_macros.h | 3 --- source3/modules/vfs_default.c | 9 --------- source3/modules/vfs_tsmsm.c | 18 ++++++++++++------ source3/smbd/trans2.c | 10 ++++------ 7 files changed, 16 insertions(+), 35 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 42154c47a6..4a6e6be42f 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -595,11 +595,6 @@ static int skel_set_offline(struct vfs_handle_struct *handle, const char *path) return vfswrap_set_offline(NULL, path); } -static bool skel_is_remotestorage(struct vfs_handle_struct *handle, const char *path) -{ - return vfswrap_is_remotestorage(NULL, path); -} - /* VFS operations structure */ static vfs_op_tuple skel_op_tuples[] = { @@ -724,7 +719,6 @@ static vfs_op_tuple skel_op_tuples[] = { /* offline operations */ {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_OPAQUE}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 997783819c..f4cb9b15ba 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -681,7 +681,6 @@ static vfs_op_tuple skel_op_tuples[] = { /* offline operations */ {SMB_VFS_OP(skel_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(skel_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(skel_is_remotestorage), SMB_VFS_OP_IS_REMOTESTORAGE, SMB_VFS_LAYER_TRANSPARENT}, {NULL, SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} }; diff --git a/source3/include/vfs.h b/source3/include/vfs.h index da5494927e..d03cf3477d 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -261,7 +261,6 @@ typedef enum _vfs_op_type { /* offline operations */ SMB_VFS_OP_IS_OFFLINE, SMB_VFS_OP_SET_OFFLINE, - SMB_VFS_OP_IS_REMOTESTORAGE, /* This should always be last enum value */ @@ -415,8 +414,6 @@ struct vfs_ops { /* offline operations */ bool (*is_offline)(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *sbuf); int (*set_offline)(struct vfs_handle_struct *handle, const char *path); - bool (*is_remotestorage)(struct vfs_handle_struct *handle, const char *path); - } ops; struct vfs_handles_pointers { @@ -542,7 +539,6 @@ struct vfs_ops { /* offline operations */ struct vfs_handle_struct *is_offline; struct vfs_handle_struct *set_offline; - struct vfs_handle_struct *is_remotestorage; } handles; }; diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index f7c7e7d623..dd30f977dc 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -143,7 +143,6 @@ /* Offline operations */ #define SMB_VFS_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs.ops.is_offline((conn)->vfs.handles.is_offline,(path),(sbuf))) #define SMB_VFS_SET_OFFLINE(conn,path) ((conn)->vfs.ops.set_offline((conn)->vfs.handles.set_offline,(path))) -#define SMB_VFS_IS_REMOTESTORAGE(conn,path) ((conn)->vfs.ops.is_remotestorage((conn)->vfs.handles.is_remotestorage,(path))) /******************************************************************* Don't access conn->vfs_opaque.ops directly!!! @@ -268,7 +267,6 @@ /* Offline operations */ #define SMB_VFS_OPAQUE_IS_OFFLINE(conn,path,sbuf) ((conn)->vfs_opaque.ops.is_offline((conn)->vfs_opaque.handles.is_offline,(path),(sbuf))) #define SMB_VFS_OPAQUE_SET_OFFLINE(conn,path) ((conn)->vfs_opaque.ops.set_offline((conn)->vfs_opaque.handles.set_offline,(path))) -#define SMB_VFS_OPAQUE_IS_REMOTESTORAGE(conn,path) ((conn)->vfs_opaque.ops.is_remotestorage((conn)->vfs_opaque.handles.is_remotestorage,(path))) /******************************************************************* Don't access handle->vfs_next.ops.* directly!!! @@ -394,6 +392,5 @@ /* Offline operations */ #define SMB_VFS_NEXT_IS_OFFLINE(handle,path,sbuf) ((handle)->vfs_next.ops.is_offline((handle)->vfs_next.handles.is_offline,(path),(sbuf))) #define SMB_VFS_NEXT_SET_OFFLINE(handle,path) ((handle)->vfs_next.ops.set_offline((handle)->vfs_next.handles.set_offline,(path))) -#define SMB_VFS_NEXT_IS_REMOTESTORAGE(handle,path) ((handle)->vfs_next.ops.is_remotestorage((handle)->vfs_next.handles.is_remotestorage,(path))) #endif /* _VFS_MACROS_H */ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 755bcdeefa..31234f23ec 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1255,13 +1255,6 @@ static int vfswrap_set_offline(struct vfs_handle_struct *handle, const char *pat return -1; } -static bool vfswrap_is_remotestorage(struct vfs_handle_struct *handle, const char *path) -{ - /* We don't know how to detect that volume is remote storage. VFS modules should redefine it. */ - return false; -} - - static vfs_op_tuple vfs_default_ops[] = { /* Disk operations */ @@ -1486,8 +1479,6 @@ static vfs_op_tuple vfs_default_ops[] = { SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_set_offline),SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(vfswrap_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE, - SMB_VFS_LAYER_OPAQUE}, /* Finish VFS operations definition */ diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index c737032907..2805488e8b 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -294,8 +294,14 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle, return result; } -static bool tsmsm_is_remotestorage(struct vfs_handle_struct *handle, const char *path) { - return True; +static bool tsmsm_statvfs(struct vfs_handle_struct *handle, const char *path, vfs_statvfs_struct *statbuf) +{ + bool result; + + result = SMB_VFS_NEXT_STATVFS(handle, path, statbuf); + statbuf->FsCapabilities | = FILE_SUPPORTS_REMOTE_STORAGE | FILE_SUPPORTS_REPARSE_POINTS; + + return result; } static vfs_op_tuple vfs_tsmsm_ops[] = { @@ -304,6 +310,8 @@ static vfs_op_tuple vfs_tsmsm_ops[] = { {SMB_VFS_OP(tsmsm_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(tsmsm_statvfs), SMB_VFS_OP_STATVFS, + SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(tsmsm_aio_force), SMB_VFS_OP_AIO_FORCE, SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(tsmsm_aio_return), SMB_VFS_OP_AIO_RETURN, @@ -314,11 +322,9 @@ static vfs_op_tuple vfs_tsmsm_ops[] = { SMB_VFS_LAYER_TRANSPARENT}, {SMB_VFS_OP(tsmsm_sendfile), SMB_VFS_OP_SENDFILE, SMB_VFS_LAYER_TRANSPARENT}, - {SMB_VFS_OP(tsmsm_is_offline),SMB_VFS_OP_IS_OFFLINE, - SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(tsmsm_set_offline),SMB_VFS_OP_SET_OFFLINE, + {SMB_VFS_OP(tsmsm_is_offline), SMB_VFS_OP_IS_OFFLINE, SMB_VFS_LAYER_OPAQUE}, - {SMB_VFS_OP(tsmsm_is_remotestorage),SMB_VFS_OP_IS_REMOTESTORAGE, + {SMB_VFS_OP(tsmsm_set_offline), SMB_VFS_OP_SET_OFFLINE, SMB_VFS_LAYER_OPAQUE}, /* Finish VFS operations definition */ diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 5729ab5349..23d6f12996 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -2495,12 +2495,10 @@ cBytesSector=%u, cUnitTotal=%u, cUnitAvail=%d\n", (unsigned int)st.st_dev, (unsi if(lp_nt_acl_support(SNUM(conn))) { additional_flags |= FILE_PERSISTENT_ACLS; } - - if(SMB_VFS_IS_REMOTESTORAGE(conn, lp_pathname(SNUM(conn)))) { - additional_flags |= FILE_SUPPORTS_REMOTE_STORAGE; - additional_flags |= FILE_SUPPORTS_REPARSE_POINTS; - } - + + /* Capabilities are filled in at connection time through STATVFS call */ + additional_flags |= conn->fs_capabilities; + SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH| FILE_SUPPORTS_OBJECT_IDS|FILE_UNICODE_ON_DISK| additional_flags); /* FS ATTRIBUTES */ -- cgit From dba2400192e7d3afb9d1c48f52eeccd0c2f660e9 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 17 Jan 2008 09:26:36 -0500 Subject: Add some additional libsmbclient test programs. testwrite: create or truncate a file and write to it. teststat3: compare the results from smbc_stat() and smbc_fstat() Derrell (This used to be commit 5a4a7aec761c3388b741b9b47fa6358fc71a66ce) --- examples/libsmbclient/Makefile | 12 +++++- examples/libsmbclient/teststat3.c | 78 +++++++++++++++++++++++++++++++++++++++ examples/libsmbclient/testwrite.c | 69 ++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 examples/libsmbclient/teststat3.c create mode 100644 examples/libsmbclient/testwrite.c diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 26b80575fb..9657957c4e 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -22,9 +22,11 @@ TESTS= testsmbc \ testbrowse2 \ teststat \ teststat2 \ + teststat3 \ testchmod \ testutime \ - testread + testread \ + testwrite # tree \ @@ -62,6 +64,10 @@ teststat2: teststat2.o @echo Linking teststat2 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt +teststat3: teststat3.o + @echo Linking teststat3 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt + testchmod: testchmod.o @echo Linking testchmod $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt @@ -74,6 +80,10 @@ testread: testread.o @echo Linking testread $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt +testwrite: testwrite.o + @echo Linking testwrite + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt + smbsh: make -C smbwrapper diff --git a/examples/libsmbclient/teststat3.c b/examples/libsmbclient/teststat3.c new file mode 100644 index 0000000000..26348b335c --- /dev/null +++ b/examples/libsmbclient/teststat3.c @@ -0,0 +1,78 @@ +#include +#include +#include +#include +#include +#include "get_auth_data_fn.h" + +/* + * This test is intended to ensure that the timestamps returned by + * libsmbclient using smbc_stat() are the same as those returned by + * smbc_fstat(). + */ + + +int main(int argc, char* argv[]) +{ + int fd; + struct stat st1; + struct stat st2; + char mtime[32]; + char ctime[32]; + char atime[32]; + char * pUrl = argv[1]; + + if(argc != 2) + { + printf("usage: %s \n", argv[0]); + return 1; + } + + + smbc_init(get_auth_data_fn, 0); + + if (smbc_stat(pUrl, &st1) < 0) + { + perror("smbc_stat"); + return 1; + } + + if ((fd = smbc_open(pUrl, O_RDONLY, 0)) < 0) + { + perror("smbc_open"); + return 1; + } + + if (smbc_fstat(fd, &st2) < 0) + { + perror("smbc_fstat"); + return 1; + } + + smbc_close(fd); + +#define COMPARE(name, field) \ + if (st1.field != st2.field) \ + { \ + printf("Field " name " MISMATCH: st1=%lu, st2=%lu\n", \ + (unsigned long) st1.field, \ + (unsigned long) st2.field); \ + } + + COMPARE("st_dev", st_dev); + COMPARE("st_ino", st_ino); + COMPARE("st_mode", st_mode); + COMPARE("st_nlink", st_nlink); + COMPARE("st_uid", st_uid); + COMPARE("st_gid", st_gid); + COMPARE("st_rdev", st_rdev); + COMPARE("st_size", st_size); + COMPARE("st_blksize", st_blksize); + COMPARE("st_blocks", st_blocks); + COMPARE("st_atime", st_atime); + COMPARE("st_mtime", st_mtime); + COMPARE("st_ctime", st_ctime); + + return 0; +} + diff --git a/examples/libsmbclient/testwrite.c b/examples/libsmbclient/testwrite.c new file mode 100644 index 0000000000..780f0e95da --- /dev/null +++ b/examples/libsmbclient/testwrite.c @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include +#include +#include +#include "get_auth_data_fn.h" + + +int main(int argc, char * argv[]) +{ + int i; + int fd; + int ret; + int debug = 0; + int mode = 0666; + int savedErrno; + char buffer[2048]; + char path[2048]; + char * p; + time_t t0; + time_t t1; + struct stat st; + + smbc_init(get_auth_data_fn, debug); + + printf("CAUTION: This program will overwrite a file. " + "Press ENTER to continue."); + fgets(buffer, sizeof(buffer), stdin); + + + for (;;) + { + fprintf(stdout, "\nPath: "); + *path = '\0'; + fgets(path, sizeof(path) - 1, stdin); + if (strlen(path) == 0) + { + return 0; + } + + p = path + strlen(path) - 1; + if (*p == '\n') + { + *p = '\0'; + } + + if ((fd = smbc_open(path, O_WRONLY | O_CREAT | O_TRUNC, 0)) < 0) + { + perror("smbc_open"); + continue; + } + + strcpy(buffer, "Hello world\n"); + + ret = smbc_write(fd, buffer, strlen(buffer)); + savedErrno = errno; + smbc_close(fd); + + if (ret < 0) + { + errno = savedErrno; + perror("write"); + } + } + + return 0; +} -- cgit From 096e40c9169b2121a82c42d3cf31cbfb869603ce Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 17 Jan 2008 09:29:13 -0500 Subject: Fix stat results to be consistent between smbc_stat and smbc_fstat. We create a kludged inode based on the checksum of the path. We therefore need to use the same (full) path when calculating it in both smbc_stat() and smbc_fstat(). If struct stat has an rdev field, set it to zero. Derrell (This used to be commit b4282fbd6d27d868b2d5c04bb72d2d7421822da1) --- source3/libsmb/libsmbclient.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index fb04d143a5..077970647d 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -2263,6 +2263,9 @@ smbc_setup_stat(SMBCCTX *context, #endif #ifdef HAVE_STAT_ST_BLOCKS st->st_blocks = (size+511)/512; +#endif +#ifdef HAVE_STRUCT_STAT_ST_RDEV + st->st_rdev = 0; #endif st->st_uid = getuid(); st->st_gid = getgid(); @@ -2367,7 +2370,7 @@ smbc_stat_ctx(SMBCCTX *context, st->st_ino = ino; - smbc_setup_stat(context, st, path, size, mode); + smbc_setup_stat(context, st, (char *) fname, size, mode); set_atimespec(st, access_time_ts); set_ctimespec(st, change_time_ts); -- cgit From 5e86ac9e6d2eb7ff0f6f8461dcfc230e2d87c42c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Jan 2008 13:00:12 +0100 Subject: idl: Update DFS IDL from Samba 4. (This used to be commit a6677b2e186212f723b24775293682ce5b94952e) --- source3/librpc/gen_ndr/cli_dfs.c | 19 ++ source3/librpc/gen_ndr/cli_dfs.h | 8 + source3/librpc/gen_ndr/dfs.h | 33 ++- source3/librpc/gen_ndr/ndr_dfs.c | 436 ++++++++++++++++++++++++++++++++++++++- source3/librpc/gen_ndr/ndr_dfs.h | 2 + source3/librpc/gen_ndr/srv_dfs.c | 4 + source3/librpc/idl/dfs.idl | 34 ++- 7 files changed, 526 insertions(+), 10 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_dfs.c b/source3/librpc/gen_ndr/cli_dfs.c index 9078ce7bba..fc00128f3f 100644 --- a/source3/librpc/gen_ndr/cli_dfs.c +++ b/source3/librpc/gen_ndr/cli_dfs.c @@ -789,12 +789,20 @@ NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *servername, + const char **server_fullname, + uint8_t *is_root, + uint32_t *ttl, WERROR *werror) { struct dfs_GetDcAddress r; NTSTATUS status; /* In parameters */ + r.in.servername = servername; + r.in.server_fullname = server_fullname; + r.in.is_root = is_root; + r.in.ttl = ttl; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, &r); @@ -820,6 +828,9 @@ NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, } /* Return variables */ + *server_fullname = *r.out.server_fullname; + *is_root = *r.out.is_root; + *ttl = *r.out.ttl; /* Return result */ if (werror) { @@ -831,12 +842,20 @@ NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *servername, + const char *server_fullname, + uint32_t flags, + uint32_t ttl, WERROR *werror) { struct dfs_SetDcAddress r; NTSTATUS status; /* In parameters */ + r.in.servername = servername; + r.in.server_fullname = server_fullname; + r.in.flags = flags; + r.in.ttl = ttl; if (DEBUGLEVEL >= 10) { NDR_PRINT_IN_DEBUG(dfs_SetDcAddress, &r); diff --git a/source3/librpc/gen_ndr/cli_dfs.h b/source3/librpc/gen_ndr/cli_dfs.h index cdd0978bb4..d23bb90470 100644 --- a/source3/librpc/gen_ndr/cli_dfs.h +++ b/source3/librpc/gen_ndr/cli_dfs.h @@ -101,9 +101,17 @@ NTSTATUS rpccli_dfs_AddStdRootForced(struct rpc_pipe_client *cli, WERROR *werror); NTSTATUS rpccli_dfs_GetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *servername, + const char **server_fullname, + uint8_t *is_root, + uint32_t *ttl, WERROR *werror); NTSTATUS rpccli_dfs_SetDcAddress(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *servername, + const char *server_fullname, + uint32_t flags, + uint32_t ttl, WERROR *werror); NTSTATUS rpccli_dfs_FlushFtTable(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/librpc/gen_ndr/dfs.h b/source3/librpc/gen_ndr/dfs.h index 89f243b7dd..38e7f93950 100644 --- a/source3/librpc/gen_ndr/dfs.h +++ b/source3/librpc/gen_ndr/dfs.h @@ -32,8 +32,8 @@ struct dfs_Info1 { /* bitmap dfs_VolumeState */ #define DFS_VOLUME_STATE_OK ( 0x1 ) #define DFS_VOLUME_STATE_INCONSISTENT ( 0x2 ) -#define DFS_VOLUME_STATE_OFFLINE ( 0x4 ) -#define DFS_VOLUME_STATE_ONLINE ( 0x8 ) +#define DFS_VOLUME_STATE_OFFLINE ( 0x3 ) +#define DFS_VOLUME_STATE_ONLINE ( 0x4 ) #define DFS_VOLUME_STATE_STANDALONE ( DFS_VOLUME_FLAVOR_STANDALONE ) #define DFS_VOLUME_STATE_AD_BLOB ( DFS_VOLUME_FLAVOR_AD_BLOB ) @@ -238,6 +238,16 @@ struct dfs_EnumArray4 { struct dfs_Info4 *s;/* [unique,size_is(count)] */ }; +struct dfs_EnumArray5 { + uint32_t count; + struct dfs_Info5 *s;/* [unique,size_is(count)] */ +}; + +struct dfs_EnumArray6 { + uint32_t count; + struct dfs_Info6 *s;/* [unique,size_is(count)] */ +}; + struct dfs_EnumArray200 { uint32_t count; struct dfs_Info200 *s;/* [unique,size_is(count)] */ @@ -253,6 +263,8 @@ union dfs_EnumInfo { struct dfs_EnumArray2 *info2;/* [unique,case(2)] */ struct dfs_EnumArray3 *info3;/* [unique,case(3)] */ struct dfs_EnumArray4 *info4;/* [unique,case(4)] */ + struct dfs_EnumArray5 *info5;/* [unique,case(5)] */ + struct dfs_EnumArray6 *info6;/* [unique,case(6)] */ struct dfs_EnumArray200 *info200;/* [unique,case(200)] */ struct dfs_EnumArray300 *info300;/* [unique,case(300)] */ }; @@ -485,6 +497,16 @@ struct dfs_AddStdRootForced { struct dfs_GetDcAddress { struct { + const char *servername;/* [charset(UTF16)] */ + const char **server_fullname;/* [ref,charset(UTF16)] */ + uint8_t *is_root;/* [ref] */ + uint32_t *ttl;/* [ref] */ + } in; + + struct { + const char **server_fullname;/* [ref,charset(UTF16)] */ + uint8_t *is_root;/* [ref] */ + uint32_t *ttl;/* [ref] */ WERROR result; } out; @@ -492,6 +514,13 @@ struct dfs_GetDcAddress { struct dfs_SetDcAddress { + struct { + const char *servername;/* [charset(UTF16)] */ + const char *server_fullname;/* [charset(UTF16)] */ + uint32_t flags; + uint32_t ttl; + } in; + struct { WERROR result; } out; diff --git a/source3/librpc/gen_ndr/ndr_dfs.c b/source3/librpc/gen_ndr/ndr_dfs.c index 4b26487a0d..dee32485be 100644 --- a/source3/librpc/gen_ndr/ndr_dfs.c +++ b/source3/librpc/gen_ndr/ndr_dfs.c @@ -2544,6 +2544,180 @@ _PUBLIC_ void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, ndr->depth--; } +static enum ndr_err_code ndr_push_dfs_EnumArray5(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray5 *r) +{ + uint32_t cntr_s_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->s)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->s) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_push_dfs_Info5(ndr, NDR_SCALARS, &r->s[cntr_s_1])); + } + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_push_dfs_Info5(ndr, NDR_BUFFERS, &r->s[cntr_s_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dfs_EnumArray5(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray5 *r) +{ + uint32_t _ptr_s; + uint32_t cntr_s_1; + TALLOC_CTX *_mem_save_s_0; + TALLOC_CTX *_mem_save_s_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_s)); + if (_ptr_s) { + NDR_PULL_ALLOC(ndr, r->s); + } else { + r->s = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->s) { + _mem_save_s_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->s, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->s)); + NDR_PULL_ALLOC_N(ndr, r->s, ndr_get_array_size(ndr, &r->s)); + _mem_save_s_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->s, 0); + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_pull_dfs_Info5(ndr, NDR_SCALARS, &r->s[cntr_s_1])); + } + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_pull_dfs_Info5(ndr, NDR_BUFFERS, &r->s[cntr_s_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_0, 0); + } + if (r->s) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->s, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r) +{ + uint32_t cntr_s_1; + ndr_print_struct(ndr, name, "dfs_EnumArray5"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "s", r->s); + ndr->depth++; + if (r->s) { + ndr->print(ndr, "%s: ARRAY(%d)", "s", r->count); + ndr->depth++; + for (cntr_s_1=0;cntr_s_1count;cntr_s_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_s_1); + if (idx_1) { + ndr_print_dfs_Info5(ndr, "s", &r->s[cntr_s_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_dfs_EnumArray6(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray6 *r) +{ + uint32_t cntr_s_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->s)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->s) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_push_dfs_Info6(ndr, NDR_SCALARS, &r->s[cntr_s_1])); + } + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_push_dfs_Info6(ndr, NDR_BUFFERS, &r->s[cntr_s_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_dfs_EnumArray6(struct ndr_pull *ndr, int ndr_flags, struct dfs_EnumArray6 *r) +{ + uint32_t _ptr_s; + uint32_t cntr_s_1; + TALLOC_CTX *_mem_save_s_0; + TALLOC_CTX *_mem_save_s_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_s)); + if (_ptr_s) { + NDR_PULL_ALLOC(ndr, r->s); + } else { + r->s = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->s) { + _mem_save_s_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->s, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->s)); + NDR_PULL_ALLOC_N(ndr, r->s, ndr_get_array_size(ndr, &r->s)); + _mem_save_s_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->s, 0); + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_pull_dfs_Info6(ndr, NDR_SCALARS, &r->s[cntr_s_1])); + } + for (cntr_s_1 = 0; cntr_s_1 < r->count; cntr_s_1++) { + NDR_CHECK(ndr_pull_dfs_Info6(ndr, NDR_BUFFERS, &r->s[cntr_s_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_s_0, 0); + } + if (r->s) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->s, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r) +{ + uint32_t cntr_s_1; + ndr_print_struct(ndr, name, "dfs_EnumArray6"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "s", r->s); + ndr->depth++; + if (r->s) { + ndr->print(ndr, "%s: ARRAY(%d)", "s", r->count); + ndr->depth++; + for (cntr_s_1=0;cntr_s_1count;cntr_s_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_s_1); + if (idx_1) { + ndr_print_dfs_Info6(ndr, "s", &r->s[cntr_s_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + static enum ndr_err_code ndr_push_dfs_EnumArray200(struct ndr_push *ndr, int ndr_flags, const struct dfs_EnumArray200 *r) { uint32_t cntr_s_1; @@ -2740,6 +2914,14 @@ static enum ndr_err_code ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_fla NDR_CHECK(ndr_push_unique_ptr(ndr, r->info4)); break; + case 5: + NDR_CHECK(ndr_push_unique_ptr(ndr, r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_unique_ptr(ndr, r->info6)); + break; + case 200: NDR_CHECK(ndr_push_unique_ptr(ndr, r->info200)); break; @@ -2779,6 +2961,18 @@ static enum ndr_err_code ndr_push_dfs_EnumInfo(struct ndr_push *ndr, int ndr_fla } break; + case 5: + if (r->info5) { + NDR_CHECK(ndr_push_dfs_EnumArray5(ndr, NDR_SCALARS|NDR_BUFFERS, r->info5)); + } + break; + + case 6: + if (r->info6) { + NDR_CHECK(ndr_push_dfs_EnumArray6(ndr, NDR_SCALARS|NDR_BUFFERS, r->info6)); + } + break; + case 200: if (r->info200) { NDR_CHECK(ndr_push_dfs_EnumArray200(ndr, NDR_SCALARS|NDR_BUFFERS, r->info200)); @@ -2806,6 +3000,8 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla TALLOC_CTX *_mem_save_info2_0; TALLOC_CTX *_mem_save_info3_0; TALLOC_CTX *_mem_save_info4_0; + TALLOC_CTX *_mem_save_info5_0; + TALLOC_CTX *_mem_save_info6_0; TALLOC_CTX *_mem_save_info200_0; TALLOC_CTX *_mem_save_info300_0; level = ndr_pull_get_switch_value(ndr, r); @@ -2855,6 +3051,26 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla } break; } + case 5: { + uint32_t _ptr_info5; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info5)); + if (_ptr_info5) { + NDR_PULL_ALLOC(ndr, r->info5); + } else { + r->info5 = NULL; + } + break; } + + case 6: { + uint32_t _ptr_info6; + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info6)); + if (_ptr_info6) { + NDR_PULL_ALLOC(ndr, r->info6); + } else { + r->info6 = NULL; + } + break; } + case 200: { uint32_t _ptr_info200; NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info200)); @@ -2917,6 +3133,24 @@ static enum ndr_err_code ndr_pull_dfs_EnumInfo(struct ndr_pull *ndr, int ndr_fla } break; + case 5: + if (r->info5) { + _mem_save_info5_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->info5, 0); + NDR_CHECK(ndr_pull_dfs_EnumArray5(ndr, NDR_SCALARS|NDR_BUFFERS, r->info5)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info5_0, 0); + } + break; + + case 6: + if (r->info6) { + _mem_save_info6_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->info6, 0); + NDR_CHECK(ndr_pull_dfs_EnumArray6(ndr, NDR_SCALARS|NDR_BUFFERS, r->info6)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info6_0, 0); + } + break; + case 200: if (r->info200) { _mem_save_info200_0 = NDR_PULL_GET_MEM_CTX(ndr); @@ -2984,6 +3218,24 @@ _PUBLIC_ void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, co ndr->depth--; break; + case 5: + ndr_print_ptr(ndr, "info5", r->info5); + ndr->depth++; + if (r->info5) { + ndr_print_dfs_EnumArray5(ndr, "info5", r->info5); + } + ndr->depth--; + break; + + case 6: + ndr_print_ptr(ndr, "info6", r->info6); + ndr->depth++; + if (r->info6) { + ndr_print_dfs_EnumArray6(ndr, "info6", r->info6); + } + ndr->depth--; + break; + case 200: ndr_print_ptr(ndr, "info200", r->info200); ndr->depth++; @@ -4715,8 +4967,50 @@ _PUBLIC_ void ndr_print_dfs_AddStdRootForced(struct ndr_print *ndr, const char * static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int flags, const struct dfs_GetDcAddress *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.servername, ndr_charset_length(r->in.servername, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->in.server_fullname == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->in.server_fullname == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->in.server_fullname, ndr_charset_length(*r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->in.is_root == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->in.is_root)); + if (r->in.ttl == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.ttl)); } if (flags & NDR_OUT) { + if (r->out.server_fullname == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.server_fullname == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(*r->out.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.server_fullname, ndr_charset_length(*r->out.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->out.is_root == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->out.is_root)); + if (r->out.ttl == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.ttl)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -4724,9 +5018,84 @@ static enum ndr_err_code ndr_push_dfs_GetDcAddress(struct ndr_push *ndr, int fla static enum ndr_err_code ndr_pull_dfs_GetDcAddress(struct ndr_pull *ndr, int flags, struct dfs_GetDcAddress *r) { + uint32_t _ptr_server_fullname; + TALLOC_CTX *_mem_save_server_fullname_0; + TALLOC_CTX *_mem_save_is_root_0; + TALLOC_CTX *_mem_save_ttl_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.servername)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.servername)); + if (ndr_get_array_length(ndr, &r->in.servername) > ndr_get_array_size(ndr, &r->in.servername)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.servername), ndr_get_array_length(ndr, &r->in.servername)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.servername, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t), CH_UTF16)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.server_fullname); + } + _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_fullname, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname)); + NDR_CHECK(ndr_pull_array_size(ndr, r->in.server_fullname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->in.server_fullname)); + if (ndr_get_array_length(ndr, r->in.server_fullname) > ndr_get_array_size(ndr, r->in.server_fullname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->in.server_fullname), ndr_get_array_length(ndr, r->in.server_fullname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_get_array_length(ndr, r->in.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.is_root); + } + _mem_save_is_root_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.is_root, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->in.is_root)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_is_root_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.ttl); + } + _mem_save_ttl_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.ttl, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.ttl)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ttl_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.server_fullname); + *r->out.server_fullname = *r->in.server_fullname; + NDR_PULL_ALLOC(ndr, r->out.is_root); + *r->out.is_root = *r->in.is_root; + NDR_PULL_ALLOC(ndr, r->out.ttl); + *r->out.ttl = *r->in.ttl; } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.server_fullname); + } + _mem_save_server_fullname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.server_fullname, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_server_fullname)); + NDR_CHECK(ndr_pull_array_size(ndr, r->out.server_fullname)); + NDR_CHECK(ndr_pull_array_length(ndr, r->out.server_fullname)); + if (ndr_get_array_length(ndr, r->out.server_fullname) > ndr_get_array_size(ndr, r->out.server_fullname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.server_fullname), ndr_get_array_length(ndr, r->out.server_fullname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.server_fullname, ndr_get_array_length(ndr, r->out.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_fullname_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.is_root); + } + _mem_save_is_root_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.is_root, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->out.is_root)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_is_root_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.ttl); + } + _mem_save_ttl_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ttl, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.ttl)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ttl_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -4742,11 +5111,42 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "dfs_GetDcAddress"); ndr->depth++; + ndr_print_string(ndr, "servername", r->in.servername); + ndr_print_ptr(ndr, "server_fullname", r->in.server_fullname); + ndr->depth++; + ndr_print_ptr(ndr, "server_fullname", *r->in.server_fullname); + ndr->depth++; + ndr_print_string(ndr, "server_fullname", *r->in.server_fullname); + ndr->depth--; + ndr->depth--; + ndr_print_ptr(ndr, "is_root", r->in.is_root); + ndr->depth++; + ndr_print_uint8(ndr, "is_root", *r->in.is_root); + ndr->depth--; + ndr_print_ptr(ndr, "ttl", r->in.ttl); + ndr->depth++; + ndr_print_uint32(ndr, "ttl", *r->in.ttl); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "dfs_GetDcAddress"); ndr->depth++; + ndr_print_ptr(ndr, "server_fullname", r->out.server_fullname); + ndr->depth++; + ndr_print_ptr(ndr, "server_fullname", *r->out.server_fullname); + ndr->depth++; + ndr_print_string(ndr, "server_fullname", *r->out.server_fullname); + ndr->depth--; + ndr->depth--; + ndr_print_ptr(ndr, "is_root", r->out.is_root); + ndr->depth++; + ndr_print_uint8(ndr, "is_root", *r->out.is_root); + ndr->depth--; + ndr_print_ptr(ndr, "ttl", r->out.ttl); + ndr->depth++; + ndr_print_uint32(ndr, "ttl", *r->out.ttl); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -4756,6 +5156,16 @@ _PUBLIC_ void ndr_print_dfs_GetDcAddress(struct ndr_print *ndr, const char *name static enum ndr_err_code ndr_push_dfs_SetDcAddress(struct ndr_push *ndr, int flags, const struct dfs_SetDcAddress *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.servername, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.servername, ndr_charset_length(r->in.servername, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_fullname, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_fullname, ndr_charset_length(r->in.server_fullname, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ttl)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); @@ -4766,6 +5176,22 @@ static enum ndr_err_code ndr_push_dfs_SetDcAddress(struct ndr_push *ndr, int fla static enum ndr_err_code ndr_pull_dfs_SetDcAddress(struct ndr_pull *ndr, int flags, struct dfs_SetDcAddress *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.servername)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.servername)); + if (ndr_get_array_length(ndr, &r->in.servername) > ndr_get_array_size(ndr, &r->in.servername)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.servername), ndr_get_array_length(ndr, &r->in.servername)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.servername, ndr_get_array_length(ndr, &r->in.servername), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_fullname)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_fullname)); + if (ndr_get_array_length(ndr, &r->in.server_fullname) > ndr_get_array_size(ndr, &r->in.server_fullname)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_fullname), ndr_get_array_length(ndr, &r->in.server_fullname)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_fullname), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_fullname, ndr_get_array_length(ndr, &r->in.server_fullname), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ttl)); } if (flags & NDR_OUT) { NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); @@ -4783,6 +5209,10 @@ _PUBLIC_ void ndr_print_dfs_SetDcAddress(struct ndr_print *ndr, const char *name if (flags & NDR_IN) { ndr_print_struct(ndr, "in", "dfs_SetDcAddress"); ndr->depth++; + ndr_print_string(ndr, "servername", r->in.servername); + ndr_print_string(ndr, "server_fullname", r->in.server_fullname); + ndr_print_uint32(ndr, "flags", r->in.flags); + ndr_print_uint32(ndr, "ttl", r->in.ttl); ndr->depth--; } if (flags & NDR_OUT) { @@ -5325,10 +5755,12 @@ static const struct ndr_interface_call netdfs_calls[] = { static const char * const netdfs_endpoint_strings[] = { "ncacn_np:[\\pipe\\netdfs]", + "ncacn_ip_tcp:", + "ncalrpc:", }; static const struct ndr_interface_string_array netdfs_endpoints = { - .count = 1, + .count = 3, .names = netdfs_endpoint_strings }; @@ -5337,7 +5769,7 @@ static const char * const netdfs_authservice_strings[] = { }; static const struct ndr_interface_string_array netdfs_authservices = { - .count = 1, + .count = 3, .names = netdfs_authservice_strings }; diff --git a/source3/librpc/gen_ndr/ndr_dfs.h b/source3/librpc/gen_ndr/ndr_dfs.h index e4b00f322a..a7c66f9693 100644 --- a/source3/librpc/gen_ndr/ndr_dfs.h +++ b/source3/librpc/gen_ndr/ndr_dfs.h @@ -95,6 +95,8 @@ void ndr_print_dfs_EnumArray1(struct ndr_print *ndr, const char *name, const str void ndr_print_dfs_EnumArray2(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray2 *r); void ndr_print_dfs_EnumArray3(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray3 *r); void ndr_print_dfs_EnumArray4(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray4 *r); +void ndr_print_dfs_EnumArray5(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray5 *r); +void ndr_print_dfs_EnumArray6(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray6 *r); void ndr_print_dfs_EnumArray200(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray200 *r); void ndr_print_dfs_EnumArray300(struct ndr_print *ndr, const char *name, const struct dfs_EnumArray300 *r); void ndr_print_dfs_EnumInfo(struct ndr_print *ndr, const char *name, const union dfs_EnumInfo *r); diff --git a/source3/librpc/gen_ndr/srv_dfs.c b/source3/librpc/gen_ndr/srv_dfs.c index 384c2ba940..ad6e0af059 100644 --- a/source3/librpc/gen_ndr/srv_dfs.c +++ b/source3/librpc/gen_ndr/srv_dfs.c @@ -1233,6 +1233,10 @@ static bool api_dfs_GetDcAddress(pipes_struct *p) NDR_PRINT_IN_DEBUG(dfs_GetDcAddress, r); } + ZERO_STRUCT(r->out); + r->out.server_fullname = r->in.server_fullname; + r->out.is_root = r->in.is_root; + r->out.ttl = r->in.ttl; r->out.result = _dfs_GetDcAddress(p, r); if (p->rng_fault_state) { diff --git a/source3/librpc/idl/dfs.idl b/source3/librpc/idl/dfs.idl index 2b519b15d5..d4c05f9936 100644 --- a/source3/librpc/idl/dfs.idl +++ b/source3/librpc/idl/dfs.idl @@ -5,7 +5,8 @@ [ uuid("4fc742e0-4a10-11cf-8273-00aa004ae673"), version(3.0), pointer_default(unique), - helpstring("Settings for Microsoft Distributed File System") + helpstring("Settings for Microsoft Distributed File System"), + endpoint("ncacn_np:[\\pipe\\netdfs]", "ncacn_ip_tcp:", "ncalrpc:") ] interface netdfs { /******************/ @@ -49,12 +50,11 @@ [string,charset(UTF16)] uint16 *path; } dfs_Info1; - /* first 4 bits unverified yet */ typedef [public,bitmap32bit] bitmap { DFS_VOLUME_STATE_OK = 0x1, DFS_VOLUME_STATE_INCONSISTENT = 0x2, - DFS_VOLUME_STATE_OFFLINE = 0x4, - DFS_VOLUME_STATE_ONLINE = 0x8, + DFS_VOLUME_STATE_OFFLINE = 0x3, + DFS_VOLUME_STATE_ONLINE = 0x4, DFS_VOLUME_STATE_STANDALONE = DFS_VOLUME_FLAVOR_STANDALONE, DFS_VOLUME_STATE_AD_BLOB = DFS_VOLUME_FLAVOR_AD_BLOB } dfs_VolumeState; @@ -261,6 +261,16 @@ [size_is(count)] dfs_Info4 *s; } dfs_EnumArray4; + typedef struct { + uint32 count; + [size_is(count)] dfs_Info5 *s; + } dfs_EnumArray5; + + typedef struct { + uint32 count; + [size_is(count)] dfs_Info6 *s; + } dfs_EnumArray6; + typedef struct { uint32 count; [size_is(count)] dfs_Info200 *s; @@ -277,6 +287,8 @@ [case(2)] dfs_EnumArray2 *info2; [case(3)] dfs_EnumArray3 *info3; [case(4)] dfs_EnumArray4 *info4; + [case(5)] dfs_EnumArray5 *info5; + [case(6)] dfs_EnumArray6 *info6; [case(200)] dfs_EnumArray200 *info200; [case(300)] dfs_EnumArray300 *info300; } dfs_EnumInfo; @@ -363,10 +375,20 @@ ); /* Function 0x10 */ - WERROR dfs_GetDcAddress(); + WERROR dfs_GetDcAddress( + [in] [string,charset(UTF16)] uint16 servername[], + [in,out,ref] [string,charset(UTF16)] uint16 **server_fullname, + [in,out,ref] boolean8 *is_root, + [in,out,ref] uint32 *ttl + ); /* Function 0x11 */ - WERROR dfs_SetDcAddress(); + WERROR dfs_SetDcAddress( + [in] [string,charset(UTF16)] uint16 servername[], + [in] [string,charset(UTF16)] uint16 server_fullname[], + [in] uint32 flags, + [in] uint32 ttl + ); /* Function 0x12 */ WERROR dfs_FlushFtTable( -- cgit From af3ff75e1f9cc459c1ad4ce22dce8149d01b3eaa Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Jan 2008 13:16:27 +0100 Subject: idl: Update initshutdown and echo IDL from Samba 4. (This used to be commit 35d71a40b385a62b8c85ed68e64b6d38d80aeb3c) --- source3/librpc/gen_ndr/initshutdown.h | 4 ++-- source3/librpc/gen_ndr/ndr_echo.c | 18 +++++++++--------- source3/librpc/gen_ndr/ndr_echo.h | 2 +- source3/librpc/idl/echo.idl | 8 ++++---- source3/librpc/idl/initshutdown.idl | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/source3/librpc/gen_ndr/initshutdown.h b/source3/librpc/gen_ndr/initshutdown.h index 665d435919..acfe98846f 100644 --- a/source3/librpc/gen_ndr/initshutdown.h +++ b/source3/librpc/gen_ndr/initshutdown.h @@ -11,8 +11,8 @@ struct initshutdown_String_sub { }; struct initshutdown_String { - uint16_t name_len;/* [value(strlen_m(r->name->name)*2)] */ - uint16_t name_size;/* [value(strlen_m_term(r->name->name)*2)] */ + uint16_t name_len;/* [value(strlen_m(name->name)*2)] */ + uint16_t name_size;/* [value(strlen_m_term(name->name)*2)] */ struct initshutdown_String_sub *name;/* [unique] */ }/* [public] */; diff --git a/source3/librpc/gen_ndr/ndr_echo.c b/source3/librpc/gen_ndr/ndr_echo.c index 01b1d10fac..29a10220e5 100644 --- a/source3/librpc/gen_ndr/ndr_echo.c +++ b/source3/librpc/gen_ndr/ndr_echo.c @@ -93,7 +93,7 @@ _PUBLIC_ void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, cons ndr->depth--; } -static enum ndr_err_code ndr_push_echo_info4(struct ndr_push *ndr, int ndr_flags, const struct echo_info4 *r) +static enum ndr_err_code ndr_push_STRUCT_echo_info4(struct ndr_push *ndr, int ndr_flags, const struct echo_info4 *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 8)); @@ -104,7 +104,7 @@ static enum ndr_err_code ndr_push_echo_info4(struct ndr_push *ndr, int ndr_flags return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_echo_info4(struct ndr_pull *ndr, int ndr_flags, struct echo_info4 *r) +static enum ndr_err_code ndr_pull_STRUCT_echo_info4(struct ndr_pull *ndr, int ndr_flags, struct echo_info4 *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 8)); @@ -115,7 +115,7 @@ static enum ndr_err_code ndr_pull_echo_info4(struct ndr_pull *ndr, int ndr_flags return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r) +_PUBLIC_ void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r) { ndr_print_struct(ndr, name, "echo_info4"); ndr->depth++; @@ -194,7 +194,7 @@ static enum ndr_err_code ndr_push_echo_info7(struct ndr_push *ndr, int ndr_flags if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 8)); NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->v1)); - NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4)); + NDR_CHECK(ndr_push_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4)); } if (ndr_flags & NDR_BUFFERS) { } @@ -206,7 +206,7 @@ static enum ndr_err_code ndr_pull_echo_info7(struct ndr_pull *ndr, int ndr_flags if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_pull_align(ndr, 8)); NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->v1)); - NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4)); + NDR_CHECK(ndr_pull_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4)); } if (ndr_flags & NDR_BUFFERS) { } @@ -218,7 +218,7 @@ _PUBLIC_ void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, cons ndr_print_struct(ndr, name, "echo_info7"); ndr->depth++; ndr_print_uint8(ndr, "v1", r->v1); - ndr_print_echo_info4(ndr, "info4", &r->info4); + ndr_print_STRUCT_echo_info4(ndr, "info4", &r->info4); ndr->depth--; } @@ -241,7 +241,7 @@ static enum ndr_err_code ndr_push_echo_Info(struct ndr_push *ndr, int ndr_flags, break; case 4: - NDR_CHECK(ndr_push_echo_info4(ndr, NDR_SCALARS, &r->info4)); + NDR_CHECK(ndr_push_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4)); break; case 5: @@ -315,7 +315,7 @@ static enum ndr_err_code ndr_pull_echo_Info(struct ndr_pull *ndr, int ndr_flags, break; } case 4: { - NDR_CHECK(ndr_pull_echo_info4(ndr, NDR_SCALARS, &r->info4)); + NDR_CHECK(ndr_pull_STRUCT_echo_info4(ndr, NDR_SCALARS, &r->info4)); break; } case 5: { @@ -383,7 +383,7 @@ _PUBLIC_ void ndr_print_echo_Info(struct ndr_print *ndr, const char *name, const break; case 4: - ndr_print_echo_info4(ndr, "info4", &r->info4); + ndr_print_STRUCT_echo_info4(ndr, "info4", &r->info4); break; case 5: diff --git a/source3/librpc/gen_ndr/ndr_echo.h b/source3/librpc/gen_ndr/ndr_echo.h index 65989ccd1c..7af1c7446b 100644 --- a/source3/librpc/gen_ndr/ndr_echo.h +++ b/source3/librpc/gen_ndr/ndr_echo.h @@ -35,7 +35,7 @@ extern const struct ndr_interface_table ndr_table_rpcecho; void ndr_print_echo_info1(struct ndr_print *ndr, const char *name, const struct echo_info1 *r); void ndr_print_echo_info2(struct ndr_print *ndr, const char *name, const struct echo_info2 *r); void ndr_print_echo_info3(struct ndr_print *ndr, const char *name, const struct echo_info3 *r); -void ndr_print_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r); +void ndr_print_STRUCT_echo_info4(struct ndr_print *ndr, const char *name, const struct echo_info4 *r); void ndr_print_echo_info5(struct ndr_print *ndr, const char *name, const struct echo_info5 *r); void ndr_print_echo_info6(struct ndr_print *ndr, const char *name, const struct echo_info6 *r); void ndr_print_echo_info7(struct ndr_print *ndr, const char *name, const struct echo_info7 *r); diff --git a/source3/librpc/idl/echo.idl b/source3/librpc/idl/echo.idl index fa030be761..5ea37f1ac1 100644 --- a/source3/librpc/idl/echo.idl +++ b/source3/librpc/idl/echo.idl @@ -50,9 +50,9 @@ interface rpcecho uint32 v; } echo_info3; - typedef struct { + struct echo_info4 { hyper v; - } echo_info4; + }; typedef struct { uint8 v1; @@ -66,14 +66,14 @@ interface rpcecho typedef struct { uint8 v1; - echo_info4 info4; + struct echo_info4 info4; } echo_info7; typedef [switch_type(uint16)] union { [case(1)] echo_info1 info1; [case(2)] echo_info2 info2; [case(3)] echo_info3 info3; - [case(4)] echo_info4 info4; + [case(4)] struct echo_info4 info4; [case(5)] echo_info5 info5; [case(6)] echo_info6 info6; [case(7)] echo_info7 info7; diff --git a/source3/librpc/idl/initshutdown.idl b/source3/librpc/idl/initshutdown.idl index 50d49637c2..868e48e28a 100644 --- a/source3/librpc/idl/initshutdown.idl +++ b/source3/librpc/idl/initshutdown.idl @@ -18,8 +18,8 @@ } initshutdown_String_sub; typedef [public] struct { - [value(strlen_m(r->name->name)*2)] uint16 name_len; - [value(strlen_m_term(r->name->name)*2)] uint16 name_size; + [value(strlen_m(name->name)*2)] uint16 name_len; + [value(strlen_m_term(name->name)*2)] uint16 name_size; initshutdown_String_sub *name; } initshutdown_String; -- cgit From 35fe98e5a17911c1d1b5384e4662fede3aac9c08 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Jan 2008 13:34:18 +0100 Subject: idl: Remove use of [ref], which is the default. (This used to be commit c22d47b3d58de45c2b686badb9fe6a6cd5a6b047) --- source3/librpc/idl/eventlog.idl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source3/librpc/idl/eventlog.idl b/source3/librpc/idl/eventlog.idl index e088137ccf..7c57044d87 100644 --- a/source3/librpc/idl/eventlog.idl +++ b/source3/librpc/idl/eventlog.idl @@ -80,7 +80,7 @@ import "lsa.idl", "security.idl"; /* Function: 0x04 */ NTSTATUS eventlog_GetNumRecords( [in] policy_handle *handle, - [out,ref] uint32 *number + [out] uint32 *number ); /******************/ @@ -118,8 +118,8 @@ import "lsa.idl", "security.idl"; [in] uint32 offset, [in] uint32 number_of_bytes, [out,size_is(number_of_bytes)] uint8 *data, - [out,ref] uint32 *sent_size, - [out,ref] uint32 *real_size + [out] uint32 *sent_size, + [out] uint32 *real_size ); /*****************/ -- cgit From 04a2512b10393015048780b0630c012fac84e32c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Jan 2008 13:56:47 +0100 Subject: idl: Update IDL for eventlog, misc, netlogon and security from Samba 4. (This used to be commit 48288869d314d8c91d07282b5536b231d95db159) --- source3/librpc/gen_ndr/ndr_netlogon.c | 8 ++++---- source3/librpc/gen_ndr/ndr_xattr.c | 1 + source3/librpc/gen_ndr/netlogon.h | 4 ++-- source3/librpc/idl/eventlog.idl | 1 + source3/librpc/idl/misc.idl | 3 ++- source3/librpc/idl/netlogon.idl | 4 ++-- source3/librpc/idl/security.idl | 9 ++++++++- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 081c87fb12..0512f4db65 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -2042,10 +2042,10 @@ static enum ndr_err_code ndr_push_netr_PasswordHistory(struct ndr_push *ndr, int if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_length)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_size)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->nt_length)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->nt_flags)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_length)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_size)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lm_length)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->lm_flags)); NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->nt_history, r->nt_length)); NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->lm_history, r->lm_length)); @@ -2080,10 +2080,10 @@ _PUBLIC_ void ndr_print_netr_PasswordHistory(struct ndr_print *ndr, const char * ndr_print_struct(ndr, name, "netr_PasswordHistory"); ndr->depth++; ndr_print_uint16(ndr, "nt_length", r->nt_length); - ndr_print_uint16(ndr, "nt_size", r->nt_size); + ndr_print_uint16(ndr, "nt_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->nt_length:r->nt_size); ndr_print_uint32(ndr, "nt_flags", r->nt_flags); ndr_print_uint16(ndr, "lm_length", r->lm_length); - ndr_print_uint16(ndr, "lm_size", r->lm_size); + ndr_print_uint16(ndr, "lm_size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->lm_length:r->lm_size); ndr_print_uint32(ndr, "lm_flags", r->lm_flags); ndr_print_array_uint8(ndr, "nt_history", r->nt_history, r->nt_length); ndr_print_array_uint8(ndr, "lm_history", r->lm_history, r->lm_length); diff --git a/source3/librpc/gen_ndr/ndr_xattr.c b/source3/librpc/gen_ndr/ndr_xattr.c index 29a31a12b2..425ad814bf 100644 --- a/source3/librpc/gen_ndr/ndr_xattr.c +++ b/source3/librpc/gen_ndr/ndr_xattr.c @@ -100,3 +100,4 @@ _PUBLIC_ void ndr_print_tdb_xattrs(struct ndr_print *ndr, const char *name, cons ndr->depth--; ndr->depth--; } + diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index e33818257d..4b97470b6a 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -215,10 +215,10 @@ struct netr_USER_KEY16 { struct netr_PasswordHistory { uint16_t nt_length; - uint16_t nt_size; + uint16_t nt_size;/* [value(nt_length)] */ uint32_t nt_flags; uint16_t lm_length; - uint16_t lm_size; + uint16_t lm_size;/* [value(lm_length)] */ uint32_t lm_flags; uint8_t *nt_history; uint8_t *lm_history; diff --git a/source3/librpc/idl/eventlog.idl b/source3/librpc/idl/eventlog.idl index 7c57044d87..3defd99400 100644 --- a/source3/librpc/idl/eventlog.idl +++ b/source3/librpc/idl/eventlog.idl @@ -3,6 +3,7 @@ /* eventlog interface definition */ + import "lsa.idl", "security.idl"; [ uuid("82273fdc-e32a-18c3-3f78-827929dc23ea"), diff --git a/source3/librpc/idl/misc.idl b/source3/librpc/idl/misc.idl index ae098d09ac..00f9fb6bed 100644 --- a/source3/librpc/idl/misc.idl +++ b/source3/librpc/idl/misc.idl @@ -45,7 +45,8 @@ interface misc typedef [public,v1_enum] enum { SAMR_REJECT_OTHER = 0, SAMR_REJECT_TOO_SHORT = 1, - SAMR_REJECT_COMPLEXITY = 2 + SAMR_REJECT_IN_HISTORY = 2, + SAMR_REJECT_COMPLEXITY = 5 } samr_RejectReason; diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 72feb2f9ed..395976c074 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -330,10 +330,10 @@ interface netlogon typedef struct { uint16 nt_length; - uint16 nt_size; + [value(nt_length)] uint16 nt_size; uint32 nt_flags; uint16 lm_length; - uint16 lm_size; + [value(lm_length)] uint16 lm_size; uint32 lm_flags; uint8 nt_history[nt_length]; uint8 lm_history[lm_length]; diff --git a/source3/librpc/idl/security.idl b/source3/librpc/idl/security.idl index 8a0d36a696..929c6cc18a 100644 --- a/source3/librpc/idl/security.idl +++ b/source3/librpc/idl/security.idl @@ -121,6 +121,8 @@ interface security const string SID_NULL = "S-1-0-0"; /* the world domain */ + const string NAME_WORLD = "WORLD"; + const string SID_WORLD_DOMAIN = "S-1-1"; const string SID_WORLD = "S-1-1-0"; @@ -130,6 +132,8 @@ interface security const string SID_CREATOR_GROUP = "S-1-3-1"; /* SECURITY_NT_AUTHORITY */ + const string NAME_NT_AUTHORITY = "NT AUTHORITY"; + const string SID_NT_AUTHORITY = "S-1-5"; const string SID_NT_DIALUP = "S-1-5-1"; const string SID_NT_NETWORK = "S-1-5-2"; @@ -150,6 +154,8 @@ interface security const string SID_NT_NETWORK_SERVICE = "S-1-5-20"; /* SECURITY_BUILTIN_DOMAIN_RID */ + const string NAME_BUILTIN = "BUILTIN"; + const string SID_BUILTIN = "S-1-5-32"; const string SID_BUILTIN_ADMINISTRATORS = "S-1-5-32-544"; const string SID_BUILTIN_USERS = "S-1-5-32-545"; @@ -169,6 +175,7 @@ interface security const int DOMAIN_RID_GUEST = 501; const int DOMAIN_RID_ADMINS = 512; const int DOMAIN_RID_USERS = 513; + const int DOMAIN_RID_DOMAIN_MEMBERS = 515; const int DOMAIN_RID_DCS = 516; const int DOMAIN_RID_CERT_ADMINS = 517; const int DOMAIN_RID_SCHEMA_ADMINS = 518; @@ -239,7 +246,7 @@ interface security SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT = 8 } security_ace_type; - typedef bitmap { + typedef [bitmap32bit] bitmap { SEC_ACE_OBJECT_TYPE_PRESENT = 0x00000001, SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x00000002 } security_ace_object_flags; -- cgit From 6e1d36f8c613cc95c37993b10e2a0389a3878d9a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 23:18:07 +0100 Subject: Reformatting: Strip trailing white spaces from reg_frontent_hilvl.c. Michael (This used to be commit 36085d9004592e48b66b681f85346db15e6d9b3a) --- source3/registry/reg_frontend_hilvl.c | 40 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/source3/registry/reg_frontend_hilvl.c b/source3/registry/reg_frontend_hilvl.c index 73fcf87e17..08d094cf83 100644 --- a/source3/registry/reg_frontend_hilvl.c +++ b/source3/registry/reg_frontend_hilvl.c @@ -1,25 +1,25 @@ -/* +/* * Unix SMB/CIFS implementation. * Virtual Windows Registry Layer * Copyright (C) Gerald Carter 2002-2005 - * Copyright (C) Michael Adam 2006 + * Copyright (C) Michael Adam 2006-2008 * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -/* - * Implementation of registry frontend view functions. +/* + * Implementation of registry frontend view functions. * Functions moved from reg_frontend.c to minimize linker deps. */ @@ -44,12 +44,12 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx ) size_t sd_size; /* basic access for Everyone */ - + init_sec_access(&mask, REG_KEY_READ ); init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0); - + /* Full Access 'BUILTIN\Administrators' */ - + init_sec_access(&mask, REG_KEY_ALL ); init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0); @@ -58,9 +58,8 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx ) init_sec_access(&mask, REG_KEY_ALL ); init_sec_ace(&ace[i++], &global_sid_System, SEC_ACE_TYPE_ACCESS_ALLOWED, mask, 0); - /* create the security descriptor */ - + if ( !(acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) ) return NULL; @@ -73,20 +72,19 @@ static SEC_DESC* construct_registry_sd( TALLOC_CTX *ctx ) /*********************************************************************** High level wrapper function for storing registry subkeys ***********************************************************************/ - + bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys ) { if ( key->hook && key->hook->ops && key->hook->ops->store_subkeys ) return key->hook->ops->store_subkeys( key->name, subkeys ); - - return False; + return False; } /*********************************************************************** High level wrapper function for storing registry values ***********************************************************************/ - + bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { if ( check_dynamic_reg_values( key ) ) @@ -106,7 +104,7 @@ bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr ) { int result = -1; - + if ( key->hook && key->hook->ops && key->hook->ops->fetch_subkeys ) result = key->hook->ops->fetch_subkeys( key->name, subkey_ctr ); @@ -120,23 +118,23 @@ int fetch_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkey_ctr ) int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { int result = -1; - + if ( key->hook && key->hook->ops && key->hook->ops->fetch_values ) result = key->hook->ops->fetch_values( key->name, val ); - + /* if the backend lookup returned no data, try the dynamic overlay */ - + if ( result == 0 ) { result = fetch_dynamic_reg_values( key, val ); return ( result != -1 ) ? result : 0; } - + return result; } /*********************************************************************** - High level access check for passing the required access mask to the + High level access check for passing the required access mask to the underlying registry backend ***********************************************************************/ -- cgit From 8c2d440c1ffc8f2b5baf0c2519e7f26e4bfa4aeb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jan 2008 23:19:38 +0100 Subject: Use the proper boolean constants in reg_frontend_hilvl.c Michael (This used to be commit 5c0a1d5d45948fdc483d6f9de31cea39e12722c6) --- source3/registry/reg_frontend_hilvl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/registry/reg_frontend_hilvl.c b/source3/registry/reg_frontend_hilvl.c index 08d094cf83..cd02eeef74 100644 --- a/source3/registry/reg_frontend_hilvl.c +++ b/source3/registry/reg_frontend_hilvl.c @@ -78,7 +78,7 @@ bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys ) if ( key->hook && key->hook->ops && key->hook->ops->store_subkeys ) return key->hook->ops->store_subkeys( key->name, subkeys ); - return False; + return false; } /*********************************************************************** @@ -88,12 +88,12 @@ bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys ) bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { if ( check_dynamic_reg_values( key ) ) - return False; + return false; if ( key->hook && key->hook->ops && key->hook->ops->store_values ) return key->hook->ops->store_values( key->name, val ); - return False; + return false; } /*********************************************************************** @@ -159,21 +159,21 @@ bool regkey_access_check( REGISTRY_KEY *key, uint32 requested, uint32 *granted, */ if (!(mem_ctx = talloc_init("regkey_access_check"))) { - return False; + return false; } err = regkey_get_secdesc(mem_ctx, key, &sec_desc); if (!W_ERROR_IS_OK(err)) { TALLOC_FREE(mem_ctx); - return False; + return false; } se_map_generic( &requested, ®_generic_map ); if (!se_access_check(sec_desc, token, requested, granted, &status)) { TALLOC_FREE(mem_ctx); - return False; + return false; } TALLOC_FREE(mem_ctx); -- cgit From 1a15320dcdf72884a4250d535e46315bcf1aa9ee Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 00:16:58 +0100 Subject: Make utility function reg_deletekey_recursive_internal() static. Michael (This used to be commit 3e661273229bcf021276cc0b71350acf8d8fed7c) --- source3/registry/reg_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index d1657c8cf6..cef14e2ca1 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -715,10 +715,10 @@ WERROR reg_open_path(TALLOC_CTX *mem_ctx, const char *orig_path, * Note that reg_deletekey returns ACCESS_DENIED when called on a * key that has subkeys. */ -WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, - struct registry_key *parent, - const char *path, - bool del_key) +static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, + struct registry_key *parent, + const char *path, + bool del_key) { TALLOC_CTX *mem_ctx = NULL; WERROR werr = WERR_OK; -- cgit From b6eaf05479fb757da5e8a717c02a6f6c44c42ab5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 00:57:53 +0100 Subject: Add some sectioning comments to reg_api.c Michael (This used to be commit d3c9c273740b42e5da101f53d4df3aee70cdacf7) --- source3/registry/reg_api.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index cef14e2ca1..744e5eb6e3 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -24,6 +24,11 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY + +/********************************************************************** + * Helper functions + **********************************************************************/ + static WERROR fill_value_cache(struct registry_key *key) { if (key->values != NULL) { @@ -186,6 +191,11 @@ WERROR reg_openhive(TALLOC_CTX *mem_ctx, const char *hive, pkey); } + +/********************************************************************** + * The API functions + **********************************************************************/ + WERROR reg_openkey(TALLOC_CTX *mem_ctx, struct registry_key *parent, const char *name, uint32 desired_access, struct registry_key **pkey) @@ -627,6 +637,11 @@ WERROR reg_deletevalue(struct registry_key *key, const char *name) return WERR_OK; } + +/********************************************************************** + * Higher level utility functions + **********************************************************************/ + WERROR reg_deleteallvalues(struct registry_key *key) { WERROR err; -- cgit From 00f3df3c131ac6054e1a8d0565cd87ab8a49265b Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 01:47:00 +0100 Subject: Convert sync_eventlog_params() to use reg_api instead of reg_frontend. This is a step towards untangling the registry. All places should use reg_api.c, reg_frontend should actually more appropriately be named reg_backend_dispatcher and hidden from callers. :-) Michael (This used to be commit 92e95fe58500dc8bf89bb43c1d65559702363767) --- source3/rpc_server/srv_eventlog_nt.c | 46 ++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c index 3c9c835bad..0ea34e54ad 100644 --- a/source3/rpc_server/srv_eventlog_nt.c +++ b/source3/rpc_server/srv_eventlog_nt.c @@ -423,12 +423,12 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info ) char *path = NULL; uint32 uiMaxSize; uint32 uiRetention; - REGISTRY_KEY *keyinfo; - REGISTRY_VALUE *val; - REGVAL_CTR *values; + struct registry_key *key; + struct registry_value *value; WERROR wresult; char *elogname = info->logname; TALLOC_CTX *ctx = talloc_tos(); + bool ret = false; DEBUG( 4, ( "sync_eventlog_params with %s\n", elogname ) ); @@ -451,36 +451,42 @@ static bool sync_eventlog_params( EVENTLOG_INFO *info ) return false; } - wresult = regkey_open_internal( NULL, &keyinfo, path, - get_root_nt_token( ), REG_KEY_READ ); + wresult = reg_open_path(ctx, path, REG_KEY_READ, get_root_nt_token(), + &key); if ( !W_ERROR_IS_OK( wresult ) ) { DEBUG( 4, ( "sync_eventlog_params: Failed to open key [%s] (%s)\n", path, dos_errstr( wresult ) ) ); - return False; + return false; } - if ( !( values = TALLOC_ZERO_P( keyinfo, REGVAL_CTR ) ) ) { - TALLOC_FREE( keyinfo ); - DEBUG( 0, ( "control_eventlog_hook: talloc() failed!\n" ) ); - - return False; + wresult = reg_queryvalue(key, key, "Retention", &value); + if (!W_ERROR_IS_OK(wresult)) { + DEBUG(4, ("Failed to query value \"Retention\": %s\n", + dos_errstr(wresult))); + ret = false; + goto done; } - fetch_reg_values( keyinfo, values ); - - if ( ( val = regval_ctr_getvalue( values, "Retention" ) ) != NULL ) - uiRetention = IVAL( regval_data_p( val ), 0 ); + uiRetention = value->v.dword; - if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL ) - uiMaxSize = IVAL( regval_data_p( val ), 0 ); - - TALLOC_FREE( keyinfo ); + wresult = reg_queryvalue(key, key, "MaxSize", &value); + if (!W_ERROR_IS_OK(wresult)) { + DEBUG(4, ("Failed to query value \"MaxSize\": %s\n", + dos_errstr(wresult))); + ret = false; + goto done; + } + uiMaxSize = value->v.dword; tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize ); tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention ); - return True; + ret = true; + +done: + TALLOC_FREE(ctx); + return true; } /******************************************************************** -- cgit From 99b195a6aa39bdf3f327fe1c7b1295032c3c3caa Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 10:19:12 +0100 Subject: Move reg_create_path() and reg_delete_path() to reg_api.c Michael (This used to be commit 4d82cc586c089a16d1d2db214f5e198062890b58) --- source3/registry/reg_api.c | 95 +++++++++++++++++++++++++++++++++++++++++ source3/registry/reg_frontend.c | 95 ----------------------------------------- 2 files changed, 95 insertions(+), 95 deletions(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 744e5eb6e3..83c5f1a634 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -794,3 +794,98 @@ WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, { return reg_deletekey_recursive_internal(ctx, parent, path, false); } + +/* + * Utility function to create a registry key without opening the hive + * before. Assumes the hive already exists. + */ + +WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path, + uint32 desired_access, + const struct nt_user_token *token, + enum winreg_CreateAction *paction, + struct registry_key **pkey) +{ + struct registry_key *hive; + char *path, *p; + WERROR err; + + if (!(path = SMB_STRDUP(orig_path))) { + return WERR_NOMEM; + } + + p = strchr(path, '\\'); + + if ((p == NULL) || (p[1] == '\0')) { + /* + * No key behind the hive, just return the hive + */ + + err = reg_openhive(mem_ctx, path, desired_access, token, + &hive); + if (!W_ERROR_IS_OK(err)) { + SAFE_FREE(path); + return err; + } + SAFE_FREE(path); + *pkey = hive; + *paction = REG_OPENED_EXISTING_KEY; + return WERR_OK; + } + + *p = '\0'; + + err = reg_openhive(mem_ctx, path, + (strchr(p+1, '\\') != NULL) ? + SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY, + token, &hive); + if (!W_ERROR_IS_OK(err)) { + SAFE_FREE(path); + return err; + } + + err = reg_createkey(mem_ctx, hive, p+1, desired_access, pkey, paction); + SAFE_FREE(path); + TALLOC_FREE(hive); + return err; +} + +/* + * Utility function to create a registry key without opening the hive + * before. Will not delete a hive. + */ + +WERROR reg_delete_path(const struct nt_user_token *token, + const char *orig_path) +{ + struct registry_key *hive; + char *path, *p; + WERROR err; + + if (!(path = SMB_STRDUP(orig_path))) { + return WERR_NOMEM; + } + + p = strchr(path, '\\'); + + if ((p == NULL) || (p[1] == '\0')) { + SAFE_FREE(path); + return WERR_INVALID_PARAM; + } + + *p = '\0'; + + err = reg_openhive(NULL, path, + (strchr(p+1, '\\') != NULL) ? + SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY, + token, &hive); + if (!W_ERROR_IS_OK(err)) { + SAFE_FREE(path); + return err; + } + + err = reg_deletekey(hive, p+1); + SAFE_FREE(path); + TALLOC_FREE(hive); + return err; +} diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 40d9192b08..9e84d3a8c4 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -105,98 +105,3 @@ WERROR regkey_open_internal( TALLOC_CTX *ctx, REGISTRY_KEY **regkey, TALLOC_FREE(key); return WERR_OK; } - -/* - * Utility function to create a registry key without opening the hive - * before. Assumes the hive already exists. - */ - -WERROR reg_create_path(TALLOC_CTX *mem_ctx, const char *orig_path, - uint32 desired_access, - const struct nt_user_token *token, - enum winreg_CreateAction *paction, - struct registry_key **pkey) -{ - struct registry_key *hive; - char *path, *p; - WERROR err; - - if (!(path = SMB_STRDUP(orig_path))) { - return WERR_NOMEM; - } - - p = strchr(path, '\\'); - - if ((p == NULL) || (p[1] == '\0')) { - /* - * No key behind the hive, just return the hive - */ - - err = reg_openhive(mem_ctx, path, desired_access, token, - &hive); - if (!W_ERROR_IS_OK(err)) { - SAFE_FREE(path); - return err; - } - SAFE_FREE(path); - *pkey = hive; - *paction = REG_OPENED_EXISTING_KEY; - return WERR_OK; - } - - *p = '\0'; - - err = reg_openhive(mem_ctx, path, - (strchr(p+1, '\\') != NULL) ? - SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY, - token, &hive); - if (!W_ERROR_IS_OK(err)) { - SAFE_FREE(path); - return err; - } - - err = reg_createkey(mem_ctx, hive, p+1, desired_access, pkey, paction); - SAFE_FREE(path); - TALLOC_FREE(hive); - return err; -} - -/* - * Utility function to create a registry key without opening the hive - * before. Will not delete a hive. - */ - -WERROR reg_delete_path(const struct nt_user_token *token, - const char *orig_path) -{ - struct registry_key *hive; - char *path, *p; - WERROR err; - - if (!(path = SMB_STRDUP(orig_path))) { - return WERR_NOMEM; - } - - p = strchr(path, '\\'); - - if ((p == NULL) || (p[1] == '\0')) { - SAFE_FREE(path); - return WERR_INVALID_PARAM; - } - - *p = '\0'; - - err = reg_openhive(NULL, path, - (strchr(p+1, '\\') != NULL) ? - SEC_RIGHTS_ENUM_SUBKEYS : SEC_RIGHTS_CREATE_SUBKEY, - token, &hive); - if (!W_ERROR_IS_OK(err)) { - SAFE_FREE(path); - return err; - } - - err = reg_deletekey(hive, p+1); - SAFE_FREE(path); - TALLOC_FREE(hive); - return err; -} -- cgit From fcb47f5ea91d497a3921cf5617e30da50638deab Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 10:30:56 +0100 Subject: Comment out unused reg_create_path() and reg_delete_path(). These functions are unused. Comment them out for now. Michael (This used to be commit 0cb8399d7c6f228b38c918f8c6c77fd31c346f89) --- source3/registry/reg_api.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 83c5f1a634..ee138b284d 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -795,7 +795,10 @@ WERROR reg_deletesubkeys_recursive(TALLOC_CTX *ctx, return reg_deletekey_recursive_internal(ctx, parent, path, false); } -/* +#if 0 +/* these two functions are unused. */ + +/** * Utility function to create a registry key without opening the hive * before. Assumes the hive already exists. */ @@ -889,3 +892,4 @@ WERROR reg_delete_path(const struct nt_user_token *token, TALLOC_FREE(hive); return err; } +#endif /* #if 0 */ -- cgit From da4ecfc0faed73599412b10d081c86fb748ec0d4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 11:02:15 +0100 Subject: Add reg_api functions reg_getkeysecurity() and reg_setkeysecurity(). These are wrappers around the lower level functions regkey_get_secdesc() and regkey_set_secdesc(). Next step towards hiding reg_frontend from the surface. Michael (This used to be commit 7251a24b489a008243091279d96157cacec35b62) --- source3/registry/reg_api.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index ee138b284d..4ba5073cb0 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -637,6 +637,17 @@ WERROR reg_deletevalue(struct registry_key *key, const char *name) return WERR_OK; } +WERROR reg_getkeysecurity(TALLOC_CTX *mem_ctx, struct registry_key *key, + struct security_descriptor **psecdesc) +{ + return regkey_get_secdesc(mem_ctx, key->key, psecdesc); +} + +WERROR reg_setkeysecurity(struct registry_key *key, + struct security_descriptor *psecdesc) +{ + return regkey_set_secdesc(key->key, psecdesc); +} /********************************************************************** * Higher level utility functions -- cgit From 7bfdcbcfdca7c554060808d9b526f6f2fd7472fa Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 11:06:32 +0100 Subject: Use reg_[gs]etkeysecurity() instead of regkey_[gs]et_secdes(). Rationale: Use reg_api instead of backend functions. Michael (This used to be commit f986a708be15dd9b9fc28b9862f64f2d0f94accc) --- source3/rpc_server/srv_winreg_nt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index 74ee94cf75..939bf723d2 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -1115,7 +1115,7 @@ WERROR _winreg_GetKeySecurity(pipes_struct *p, struct winreg_GetKeySecurity *r) if ( !(key->key->access_granted & STD_RIGHT_READ_CONTROL_ACCESS) ) return WERR_ACCESS_DENIED; - err = regkey_get_secdesc(p->mem_ctx, key->key, &secdesc); + err = reg_getkeysecurity(p->mem_ctx, key, &secdesc); if (!W_ERROR_IS_OK(err)) { return err; } @@ -1161,7 +1161,7 @@ WERROR _winreg_SetKeySecurity(pipes_struct *p, struct winreg_SetKeySecurity *r) return err; } - return regkey_set_secdesc(key->key, secdesc); + return reg_setkeysecurity(key, secdesc); } /******************************************************************* -- cgit From 138f7ec45165cd842112627c52891e973a3ff21e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 11:07:28 +0100 Subject: Add a comment header comparing winreg.idl and reg_api.c. Michael (This used to be commit 15163926a8ae1116a0f0986f35fc16bcf9ce6ce2) --- source3/registry/reg_api.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 4ba5073cb0..085f52b33d 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -19,6 +19,48 @@ /* Attempt to wrap the existing API in a more winreg.idl-like way */ +/* + * Here is a list of winreg.idl functions and corresponding implementations + * provided here: + * + * 0x00 winreg_OpenHKCR + * 0x01 winreg_OpenHKCU + * 0x02 winreg_OpenHKLM + * 0x03 winreg_OpenHKPD + * 0x04 winreg_OpenHKU + * 0x05 winreg_CloseKey + * 0x06 winreg_CreateKey reg_createkey + * 0x07 winreg_DeleteKey reg_deletekey + * 0x08 winreg_DeleteValue reg_deletevalue + * 0x09 winreg_EnumKey reg_enumkey + * 0x0a winreg_EnumValue reg_enumvalue + * 0x0b winreg_FlushKey + * 0x0c winreg_GetKeySecurity reg_getkeysecurity + * 0x0d winreg_LoadKey + * 0x0e winreg_NotifyChangeKeyValue + * 0x0f winreg_OpenKey reg_openkey + * 0x10 winreg_QueryInfoKey reg_queryinfokey + * 0x11 winreg_QueryValue reg_queryvalue + * 0x12 winreg_ReplaceKey + * 0x13 winreg_RestoreKey + * 0x14 winreg_SaveKey + * 0x15 winreg_SetKeySecurity reg_setkeysecurity + * 0x16 winreg_SetValue reg_setvalue + * 0x17 winreg_UnLoadKey + * 0x18 winreg_InitiateSystemShutdown + * 0x19 winreg_AbortSystemShutdown + * 0x1a winreg_GetVersion + * 0x1b winreg_OpenHKCC + * 0x1c winreg_OpenHKDD + * 0x1d winreg_QueryMultipleValues + * 0x1e winreg_InitiateSystemShutdownEx + * 0x1f winreg_SaveKeyEx + * 0x20 winreg_OpenHKPT + * 0x21 winreg_OpenHKPN + * 0x22 winreg_QueryMultipleValues2 + * + */ + #include "includes.h" #undef DBGC_CLASS -- cgit From 7f8e4bc68ea727ab999c3f60927adbc8acc5a651 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 11:09:08 +0100 Subject: Add my (C) to reg_api.c - Michael (This used to be commit 81d6a1fbed5e685376637af8e8bcd70ab2701aa0) --- source3/registry/reg_api.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 085f52b33d..a4c88e2e88 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -2,6 +2,7 @@ * Unix SMB/CIFS implementation. * Virtual Windows Registry Layer * Copyright (C) Volker Lendecke 2006 + * Copyright (C) Michael Adam 2007-2008 * * 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 -- cgit From 32a8e740785147256c008730a69ae6d60a294884 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 11:22:01 +0100 Subject: Add a reg_getversion() function to reg_api and use it in srv_winreg_nt.c. Michael (This used to be commit 903223b160eef6ba6ff19a8bfef19e5fe7008631) --- source3/registry/reg_api.c | 12 +++++++++++- source3/rpc_server/srv_winreg_nt.c | 4 +--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index a4c88e2e88..18435ff033 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -50,7 +50,7 @@ * 0x17 winreg_UnLoadKey * 0x18 winreg_InitiateSystemShutdown * 0x19 winreg_AbortSystemShutdown - * 0x1a winreg_GetVersion + * 0x1a winreg_GetVersion reg_getversion * 0x1b winreg_OpenHKCC * 0x1c winreg_OpenHKDD * 0x1d winreg_QueryMultipleValues @@ -692,6 +692,16 @@ WERROR reg_setkeysecurity(struct registry_key *key, return regkey_set_secdesc(key->key, psecdesc); } +WERROR reg_getversion(uint32_t *version) +{ + if (version == NULL) { + return WERR_INVALID_PARAM; + } + + *version = 0x00000005; /* Windows 2000 registry API version */ + return WERR_OK; +} + /********************************************************************** * Higher level utility functions **********************************************************************/ diff --git a/source3/rpc_server/srv_winreg_nt.c b/source3/rpc_server/srv_winreg_nt.c index 939bf723d2..92c178042f 100644 --- a/source3/rpc_server/srv_winreg_nt.c +++ b/source3/rpc_server/srv_winreg_nt.c @@ -370,9 +370,7 @@ WERROR _winreg_GetVersion(pipes_struct *p, struct winreg_GetVersion *r) if ( !regkey ) return WERR_BADFID; - *r->out.version = 0x00000005; /* Windows 2000 registry API version */ - - return WERR_OK; + return reg_getversion(r->out.version); } -- cgit From d3373be7da601e09b94ed99b69f57332ccff8df6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 09:41:58 +0100 Subject: Import recent netlogon and samr IDL from samba4. Guenther (This used to be commit f24dfaa8466b28416a7fdd941990948210a400c7) --- source3/librpc/idl/netlogon.idl | 296 ++++++++++++++++++++++++++++------------ source3/librpc/idl/samr.idl | 270 +++++++++++++++++++++++++++++------- 2 files changed, 430 insertions(+), 136 deletions(-) diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 395976c074..dcbb647ba0 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -4,10 +4,9 @@ who contributed! */ -#include "idl_types.h" - -import "lsa.idl", "samr.idl", "security.idl"; +import "lsa.idl", "samr.idl", "security.idl", "nbt.idl"; +#include "idl_types.h" [ uuid("12345678-1234-abcd-ef00-01234567cffb"), @@ -63,7 +62,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *server_name, [in] [string,charset(UTF16)] uint16 account_name[], [in] [string,charset(UTF16)] uint16 workstation[], - [out,ref] netr_UasLogoffInfo *info + [out] netr_UasLogoffInfo info ); @@ -247,8 +246,8 @@ interface netlogon [in] uint16 logon_level, [in] [switch_is(logon_level)] netr_LogonLevel logon, [in] uint16 validation_level, - [out,ref] [switch_is(validation_level)] netr_Validation *validation, - [out,ref] uint8 *authoritative + [out] [switch_is(validation_level)] netr_Validation validation, + [out] uint8 authoritative ); @@ -269,7 +268,7 @@ interface netlogon /*****************/ /* Function 0x04 */ - NTSTATUS netr_ServerReqChallenge( + [public] NTSTATUS netr_ServerReqChallenge( [in,string,charset(UTF16)] uint16 *server_name, [in,string,charset(UTF16)] uint16 computer_name[], [in,out,ref] netr_Credential *credentials @@ -300,7 +299,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 computer_name[], [in] netr_Authenticator credential, [in] samr_Password new_password, - [out,ref] netr_Authenticator *return_authenticator + [out] netr_Authenticator return_authenticator ); @@ -342,10 +341,10 @@ interface netlogon typedef struct { netr_USER_KEY16 lmpassword; netr_USER_KEY16 ntpassword; - netr_PasswordHistory lmhistory; + netr_PasswordHistory history; } netr_USER_KEYS2; - typedef struct { + typedef struct { /* TODO: make this a union! */ netr_USER_KEYS2 keys2; } netr_USER_KEY_UNION; @@ -681,9 +680,9 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in] netr_SamDatabaseID database_id, - [in,out,ref] udlong *sequence_num, + [in,out] udlong sequence_num, [in] uint32 preferredmaximumlength, [out] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -696,9 +695,9 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in] netr_SamDatabaseID database_id, - [in,out,ref] uint32 *sync_context, + [in,out] uint32 sync_context, [in] uint32 preferredmaximumlength, [out] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -723,15 +722,15 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in] netr_UAS_INFO_0 uas, [in] uint32 count, [in] uint32 level, [in] uint32 buffersize, - [out,ref,subcontext(4)] netr_AccountBuffer *buffer, - [out,ref] uint32 *count_returned, - [out,ref] uint32 *total_entries, - [out,ref] netr_UAS_INFO_0 *recordid + [out,subcontext(4)] netr_AccountBuffer buffer, + [out] uint32 count_returned, + [out] uint32 total_entries, + [out] netr_UAS_INFO_0 recordid ); @@ -742,25 +741,25 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in] uint32 reference, [in] uint32 level, [in] uint32 buffersize, - [out,ref,subcontext(4)] netr_AccountBuffer *buffer, - [out,ref] uint32 *count_returned, - [out,ref] uint32 *total_entries, - [out,ref] uint32 *next_reference, - [in,out,ref] netr_UAS_INFO_0 *recordid + [out,subcontext(4)] netr_AccountBuffer buffer, + [out] uint32 count_returned, + [out] uint32 total_entries, + [out] uint32 next_reference, + [in,out] netr_UAS_INFO_0 recordid ); /*****************/ /* Function 0x0B */ - NTSTATUS netr_GetDcName( + WERROR netr_GetDcName( [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 *domainname, - [out,ref] [string,charset(UTF16)] uint16 **dcname + [out] [string,charset(UTF16)] uint16 *dcname ); /*****************/ @@ -806,7 +805,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] netr_LogonControlCode function_code, [in] uint32 level, - [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *info + [out,switch_is(level)] netr_CONTROL_QUERY_INFORMATION info ); @@ -816,7 +815,7 @@ interface netlogon WERROR netr_GetAnyDCName( [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 *domainname, - [out,ref] [string,charset(UTF16)] uint16 **dcname + [out] [string,charset(UTF16)] uint16 *dcname ); @@ -835,7 +834,7 @@ interface netlogon [in] uint32 function_code, [in] uint32 level, [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION data, - [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + [out][switch_is(level)] netr_CONTROL_QUERY_INFORMATION query ); @@ -866,10 +865,10 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in] netr_SamDatabaseID database_id, [in] uint16 restart_state, - [in,out,ref] uint32 *sync_context, + [in,out] uint32 sync_context, [in] uint32 preferredmaximumlength, [out] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -884,7 +883,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out,ref] netr_Authenticator *return_authenticator, + [in,out] netr_Authenticator return_authenticator, [in][size_is(change_log_entry_size)] uint8 *change_log_entry, [in] uint32 change_log_entry_size, [out] netr_DELTA_ENUM_ARRAY *delta_enum_array @@ -899,23 +898,76 @@ interface netlogon [in] uint32 function_code, [in] uint32 level, [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION data, - [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query + [out][switch_is(level)] netr_CONTROL_QUERY_INFORMATION query ); /*****************/ /* Function 0x13 */ - WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ; + typedef struct { + uint32 length; + [size_is(length)] uint8 *data; + } netr_Blob; + + WERROR netr_NetrEnumerateTrustedDomains( + [in] [string,charset(UTF16)] uint16 *server_name, + [out,ref] netr_Blob *trusted_domains_blob + ); /*****************/ - /* Function 0x14 */ + /* Function 0x14 */ + + /* two unkown bits still: DS_IP_VERSION_AGNOSTIC and + * DS_TRY_NEXTCLOSEST_SITE - Guenther */ + + typedef [bitmap32bit] bitmap { + DS_FORCE_REDISCOVERY = 0x00000001, + DS_DIRECTORY_SERVICE_REQUIRED = 0x00000010, + DS_DIRECTORY_SERVICE_PREFERRED = 0x00000020, + DS_GC_SERVER_REQUIRED = 0x00000040, + DS_PDC_REQUIRED = 0x00000080, + DS_BACKGROUND_ONLY = 0x00000100, + DS_IP_REQUIRED = 0x00000200, + DS_KDC_REQUIRED = 0x00000400, + DS_TIMESERV_REQUIRED = 0x00000800, + DS_WRITABLE_REQUIRED = 0x00001000, + DS_GOOD_TIMESERV_PREFERRED = 0x00002000, + DS_AVOID_SELF = 0x00004000, + DS_ONLY_LDAP_NEEDED = 0x00008000, + DS_IS_FLAT_NAME = 0x00010000, + DS_IS_DNS_NAME = 0x00020000, + DS_RETURN_DNS_NAME = 0x40000000, + DS_RETURN_FLAT_NAME = 0x80000000 + } netr_DsRGetDCName_flags; + + typedef [v1_enum] enum { + DS_ADDRESS_TYPE_INET = 1, + DS_ADDRESS_TYPE_NETBIOS = 2 + } netr_DsRGetDCNameInfo_AddressType; + + typedef [bitmap32bit] bitmap { + DS_SERVER_PDC = NBT_SERVER_PDC, + DS_SERVER_GC = NBT_SERVER_GC, + DS_SERVER_LDAP = NBT_SERVER_LDAP, + DS_SERVER_DS = NBT_SERVER_DS, + DS_SERVER_KDC = NBT_SERVER_KDC, + DS_SERVER_TIMESERV = NBT_SERVER_TIMESERV, + DS_SERVER_CLOSEST = NBT_SERVER_CLOSEST, + DS_SERVER_WRITABLE = NBT_SERVER_WRITABLE, + DS_SERVER_GOOD_TIMESERV = NBT_SERVER_GOOD_TIMESERV, + DS_SERVER_NDNC = 0x00000400, + DS_DNS_CONTROLLER = 0x20000000, + DS_DNS_DOMAIN = 0x40000000, + DS_DNS_FOREST = 0x80000000 + } netr_DsR_DcFlags; + typedef struct { [string,charset(UTF16)] uint16 *dc_unc; [string,charset(UTF16)] uint16 *dc_address; - int32 dc_address_type; + netr_DsRGetDCNameInfo_AddressType dc_address_type; GUID domain_guid; [string,charset(UTF16)] uint16 *domain_name; [string,charset(UTF16)] uint16 *forest_name; - uint32 dc_flags; + netr_DsR_DcFlags dc_flags; [string,charset(UTF16)] uint16 *dc_site_name; [string,charset(UTF16)] uint16 *client_site_name; } netr_DsRGetDCNameInfo; @@ -925,7 +977,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *domain_name, [in] GUID *domain_guid, [in] GUID *site_guid, - [in] uint32 flags, + [in] netr_DsRGetDCName_flags flags, [out] netr_DsRGetDCNameInfo *info ); @@ -951,7 +1003,7 @@ interface netlogon /****************/ /* Function 0x1a */ - NTSTATUS netr_ServerAuthenticate3( + [public] NTSTATUS netr_ServerAuthenticate3( [in] [string,charset(UTF16)] uint16 *server_name, [in] [string,charset(UTF16)] uint16 account_name[], [in] netr_SchannelType secure_channel_type, @@ -969,7 +1021,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *domain_name, [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, - [in] uint32 flags, + [in] netr_DsRGetDCName_flags flags, [out] netr_DsRGetDCNameInfo *info ); @@ -977,17 +1029,12 @@ interface netlogon /* Function 0x1c */ WERROR netr_DsRGetSiteName( [in] [string,charset(UTF16)] uint16 *computer_name, - [out,ref] [string,charset(UTF16)] uint16 **site + [out] [string,charset(UTF16)] uint16 *site ); /****************/ /* Function 0x1d */ - typedef struct { - uint32 length; - [size_is(length)] uint8 *data; - } netr_Blob; - typedef [flag(NDR_PAHEX)] struct { uint16 length; uint16 size; @@ -1043,7 +1090,7 @@ interface netlogon [in,out,ref] netr_Authenticator *return_authenticator, [in] uint32 level, [in,switch_is(level)] netr_DomainQuery query, - [out,ref,switch_is(level)] netr_DomainInfo *info + [out,switch_is(level)] netr_DomainInfo info ); typedef [flag(NDR_PAHEX)] struct { @@ -1060,12 +1107,20 @@ interface netlogon [in] [string,charset(UTF16)] uint16 computer_name[], [in] netr_Authenticator credential, [in] netr_CryptPassword new_password, - [out,ref] netr_Authenticator *return_authenticator + [out] netr_Authenticator return_authenticator ); /****************/ /* Function 0x1f */ - WERROR netr_NETRSERVERPASSWORDGET(); + WERROR netr_ServerPasswordGet( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 account_name[], + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 computer_name[], + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [out,ref] samr_Password *password + ); /****************/ /* Function 0x20 */ @@ -1073,18 +1128,33 @@ interface netlogon /****************/ /* Function 0x21 */ - WERROR netr_DSRADDRESSTOSITENAMESW(); + typedef struct { + uint32 count; + [size_is(count)] lsa_String *sitename; + } netr_DsRAddressToSitenamesWCtr; + + typedef struct { + [size_is(size)] uint8 *buffer; + uint32 size; + } netr_DsRAddress; + + WERROR netr_DsRAddressToSitenamesW( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [range(0,32000)] uint32 count, + [in] [size_is(count)] [ref] netr_DsRAddress *addresses, + [out] [ref] netr_DsRAddressToSitenamesWCtr **ctr + ); /****************/ /* Function 0x22 */ WERROR netr_DsRGetDCNameEx2( [in] [string,charset(UTF16)] uint16 *server_unc, [in] [string,charset(UTF16)] uint16 *client_account, - [in] uint32 mask, + [in] samr_AcctFlags mask, [in] [string,charset(UTF16)] uint16 *domain_name, [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, - [in] uint32 flags, + [in] netr_DsRGetDCName_flags flags, [out] netr_DsRGetDCNameInfo *info ); @@ -1094,32 +1164,6 @@ interface netlogon /****************/ /* Function 0x24 */ - WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX(); - - /****************/ - /* Function 0x25 */ - WERROR netr_DSRADDRESSTOSITENAMESEXW(); - - /****************/ - /* Function 0x26 */ - WERROR netr_DSRGETDCSITECOVERAGEW(); - - /****************/ - /* Function 0x27 */ - NTSTATUS netr_LogonSamLogonEx( - [in] [string,charset(UTF16)] uint16 *server_name, - [in] [string,charset(UTF16)] uint16 *computer_name, - [in] uint16 logon_level, - [in] [switch_is(logon_level)] netr_LogonLevel logon, - [in] uint16 validation_level, - [out,ref] [switch_is(validation_level)] netr_Validation *validation, - [out,ref] uint8 *authoritative, - [in,out,ref] uint32 *flags - ); - - /****************/ - /* Function 0x28 */ - typedef [bitmap32bit] bitmap { NETR_TRUST_FLAG_IN_FOREST = 0x00000001, NETR_TRUST_FLAG_OUTBOUND = 0x00000002, @@ -1157,11 +1201,65 @@ interface netlogon GUID guid; } netr_DomainTrust; + typedef struct { + uint32 count; + [size_is(count)] netr_DomainTrust *array; + } netr_DomainTrustList; + + WERROR netr_NetrEnumerateTrustedDomainsEx( + [in] [string,charset(UTF16)] uint16 *server_name, + [out,ref] netr_DomainTrustList *dom_trust_list + ); + + /****************/ + /* Function 0x25 */ + typedef struct { + uint32 count; + [size_is(count)] lsa_String *sitename; + [size_is(count)] lsa_String *subnetname; + } netr_DsRAddressToSitenamesExWCtr; + + WERROR netr_DsRAddressToSitenamesExW( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [range(0,32000)] uint32 count, + [in] [size_is(count)] [ref] netr_DsRAddress *addresses, + [out] [ref] netr_DsRAddressToSitenamesExWCtr **ctr + ); + + /****************/ + /* Function 0x26 */ + + typedef struct { + uint32 num_sites; + [size_is(num_sites)] [unique] lsa_String *sites; + } DcSitesCtr; + + WERROR netr_DsrGetDcSiteCoverageW( + [in] [string,charset(UTF16)] uint16 *server_name, + [out] DcSitesCtr *ctr + ); + + /****************/ + /* Function 0x27 */ + NTSTATUS netr_LogonSamLogonEx( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *computer_name, + [in] uint16 logon_level, + [in] [switch_is(logon_level)] netr_LogonLevel logon, + [in] uint16 validation_level, + [out] [switch_is(validation_level)] netr_Validation validation, + [out] uint8 authoritative, + [in,out] uint32 flags + ); + + /****************/ + /* Function 0x28 */ + WERROR netr_DsrEnumerateDomainTrusts( [in] [string,charset(UTF16)] uint16 *server_name, [in] netr_TrustFlags trust_flags, - [out,ref] uint32 *count, - [out,ref,size_is(count)] netr_DomainTrust **trusts + [out] uint32 count, + [out,size_is(count)] netr_DomainTrust *trusts ); @@ -1171,15 +1269,39 @@ interface netlogon /****************/ /* Function 0x2a */ - WERROR netr_NETRSERVERTRUSTPASSWORDSGET(); + NTSTATUS netr_ServerTrustPasswordsGet( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 account_name[], + [in] netr_SchannelType secure_channel_type, + [in] [string,charset(UTF16)] uint16 computer_name[], + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [out,ref] samr_Password *password, + [out,ref] samr_Password *password2 + ); /****************/ /* Function 0x2b */ - WERROR netr_DSRGETFORESTTRUSTINFORMATION(); + + const int DS_GFTI_UPDATE_TDO = 0x1; + + WERROR netr_DsRGetForestTrustInformation( + [in] [string,charset(UTF16)] uint16 *server_name, + [in] [string,charset(UTF16)] uint16 *trusted_domain_name, + [in] uint32 flags, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); /****************/ /* Function 0x2c */ - WERROR netr_NETRGETFORESTTRUSTINFORMATION(); + WERROR netr_GetForestTrustInformation( + [in] [string,charset(UTF16)] uint16 *server_name, + [in,ref] [string,charset(UTF16)] uint16 *trusted_domain_name, + [in,ref] netr_Authenticator *credential, + [out,ref] netr_Authenticator *return_authenticator, + [in] uint32 flags, + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); /****************/ /* Function 0x2d */ @@ -1193,9 +1315,9 @@ interface netlogon [in] uint16 logon_level, [in] [switch_is(logon_level)] netr_LogonLevel logon, [in] uint16 validation_level, - [out,ref] [switch_is(validation_level)] netr_Validation *validation, - [out,ref] uint8 *authoritative, - [in,out,ref] uint32 *flags + [out] [switch_is(validation_level)] netr_Validation validation, + [out] uint8 authoritative, + [in,out] uint32 flags ); /****************/ diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index afeca3edd6..b6d2b9f941 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -3,6 +3,7 @@ /* samr interface definition */ +import "misc.idl", "lsa.idl", "security.idl"; /* Thanks to Todd Sabin for some information from his samr.idl in acltools @@ -12,8 +13,7 @@ version(1.0), endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"), pointer_default(unique), - pointer_default_top(unique), - depends(misc,lsa,security) + pointer_default_top(unique) ] interface samr { typedef bitmap security_secinfo security_secinfo; @@ -41,19 +41,72 @@ ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */ } samr_AcctFlags; + typedef [bitmap32bit] bitmap { + SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001, + SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002, + SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004, + SAMR_ACCESS_CREATE_DOMAIN = 0x00000008, + SAMR_ACCESS_ENUM_DOMAINS = 0x00000010, + SAMR_ACCESS_OPEN_DOMAIN = 0x00000020 + } samr_ConnectAccessMask; + + typedef [bitmap32bit] bitmap { + USER_ACCESS_GET_NAME_ETC = 0x00000001, + USER_ACCESS_GET_LOCALE = 0x00000002, + USER_ACCESS_SET_LOC_COM = 0x00000004, + USER_ACCESS_GET_LOGONINFO = 0x00000008, + USER_ACCESS_GET_ATTRIBUTES = 0x00000010, + USER_ACCESS_SET_ATTRIBUTES = 0x00000020, + USER_ACCESS_CHANGE_PASSWORD = 0x00000040, + USER_ACCESS_SET_PASSWORD = 0x00000080, + USER_ACCESS_GET_GROUPS = 0x00000100, + USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200, + USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400 + } samr_UserAccessMask; + + typedef [bitmap32bit] bitmap { + DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001, + DOMAIN_ACCESS_SET_INFO_1 = 0x00000002, + DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004, + DOMAIN_ACCESS_SET_INFO_2 = 0x00000008, + DOMAIN_ACCESS_CREATE_USER = 0x00000010, + DOMAIN_ACCESS_CREATE_GROUP = 0x00000020, + DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040, + DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080, + DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100, + DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200, + DOMAIN_ACCESS_SET_INFO_3 = 0x00000400 + } samr_DomainAccessMask; + + typedef [bitmap32bit] bitmap { + GROUP_ACCESS_LOOKUP_INFO = 0x00000001, + GROUP_ACCESS_SET_INFO = 0x00000002, + GROUP_ACCESS_ADD_MEMBER = 0x00000004, + GROUP_ACCESS_REMOVE_MEMBER = 0x00000008, + GROUP_ACCESS_GET_MEMBERS = 0x00000010 + } samr_GroupAccessMask; + + typedef [bitmap32bit] bitmap { + ALIAS_ACCESS_ADD_MEMBER = 0x00000001, + ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002, + ALIAS_ACCESS_GET_MEMBERS = 0x00000004, + ALIAS_ACCESS_LOOKUP_INFO = 0x00000008, + ALIAS_ACCESS_SET_INFO = 0x00000010 + } samr_AliasAccessMask; + /******************/ /* Function: 0x00 */ NTSTATUS samr_Connect ( /* notice the lack of [string] */ [in] uint16 *system_name, - [in] uint32 access_mask, + [in] samr_ConnectAccessMask access_mask, [out,ref] policy_handle *connect_handle ); /******************/ /* Function: 0x01 */ - NTSTATUS samr_Close ( + [public] NTSTATUS samr_Close ( [in,out,ref] policy_handle *handle ); @@ -118,9 +171,9 @@ /************************/ /* Function 0x07 */ - NTSTATUS samr_OpenDomain( + [public] NTSTATUS samr_OpenDomain( [in,ref] policy_handle *connect_handle, - [in] uint32 access_mask, + [in] samr_DomainAccessMask access_mask, [in,ref] dom_sid2 *sid, [out,ref] policy_handle *domain_handle ); @@ -129,10 +182,10 @@ /* Function 0x08 */ /* server roles */ typedef [v1_enum] enum { - ROLE_STANDALONE = 0, - ROLE_DOMAIN_MEMBER = 1, - ROLE_DOMAIN_BDC = 2, - ROLE_DOMAIN_PDC = 3 + SAMR_ROLE_STANDALONE = 0, + SAMR_ROLE_DOMAIN_MEMBER = 1, + SAMR_ROLE_DOMAIN_BDC = 2, + SAMR_ROLE_DOMAIN_PDC = 3 } samr_Role; /* password properties flags */ @@ -256,7 +309,7 @@ NTSTATUS samr_CreateDomainGroup( [in,ref] policy_handle *domain_handle, [in,ref] lsa_String *name, - [in] uint32 access_mask, + [in] samr_GroupAccessMask access_mask, [out,ref] policy_handle *group_handle, [out,ref] uint32 *rid ); @@ -277,7 +330,7 @@ NTSTATUS samr_CreateUser( [in,ref] policy_handle *domain_handle, [in,ref] lsa_String *account_name, - [in] uint32 access_mask, + [in] samr_UserAccessMask access_mask, [out,ref] policy_handle *user_handle, [out,ref] uint32 *rid ); @@ -305,7 +358,7 @@ NTSTATUS samr_CreateDomAlias( [in,ref] policy_handle *domain_handle, [in,ref] lsa_String *alias_name, - [in] uint32 access_mask, + [in] samr_AliasAccessMask access_mask, [out,ref] policy_handle *alias_handle, [out,ref] uint32 *rid ); @@ -337,7 +390,7 @@ /************************/ /* Function 0x11 */ - NTSTATUS samr_LookupNames( + [public] NTSTATUS samr_LookupNames( [in,ref] policy_handle *domain_handle, [in,range(0,1000)] uint32 num_names, [in,size_is(1000),length_is(num_names)] lsa_String names[], @@ -360,7 +413,7 @@ /* Function 0x13 */ NTSTATUS samr_OpenGroup( [in,ref] policy_handle *domain_handle, - [in] uint32 access_mask, + [in] samr_GroupAccessMask access_mask, [in] uint32 rid, [out,ref] policy_handle *group_handle ); @@ -480,7 +533,7 @@ /* Function 0x1b */ NTSTATUS samr_OpenAlias ( [in,ref] policy_handle *domain_handle, - [in] uint32 access_mask, + [in] samr_AliasAccessMask access_mask, [in] uint32 rid, [out,ref] policy_handle *alias_handle ); @@ -550,9 +603,9 @@ /************************/ /* Function 0x22 */ - NTSTATUS samr_OpenUser( + [public] NTSTATUS samr_OpenUser( [in,ref] policy_handle *domain_handle, - [in] uint32 access_mask, + [in] samr_UserAccessMask access_mask, [in] uint32 rid, [out,ref] policy_handle *user_handle ); @@ -684,20 +737,36 @@ /* this defines the bits used for fields_present in info21 */ typedef [bitmap32bit] bitmap { - SAMR_FIELD_ACCOUNT_NAME = 0x00000001, - SAMR_FIELD_FULL_NAME = 0x00000002, - SAMR_FIELD_DESCRIPTION = 0x00000010, - SAMR_FIELD_COMMENT = 0x00000020, - SAMR_FIELD_LOGON_SCRIPT = 0x00000100, - SAMR_FIELD_PROFILE_PATH = 0x00000200, - SAMR_FIELD_WORKSTATIONS = 0x00000400, - SAMR_FIELD_LOGON_HOURS = 0x00002000, - SAMR_FIELD_ACCT_FLAGS = 0x00100000, - SAMR_FIELD_PARAMETERS = 0x00200000, - SAMR_FIELD_COUNTRY_CODE = 0x00400000, - SAMR_FIELD_CODE_PAGE = 0x00800000, - SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */ - SAMR_FIELD_PASSWORD2 = 0x02000000 /* two bits seems to work */ + SAMR_FIELD_ACCOUNT_NAME = 0x00000001, + SAMR_FIELD_FULL_NAME = 0x00000002, + SAMR_FIELD_RID = 0x00000004, + SAMR_FIELD_PRIMARY_GID = 0x00000008, + SAMR_FIELD_DESCRIPTION = 0x00000010, + SAMR_FIELD_COMMENT = 0x00000020, + SAMR_FIELD_HOME_DIRECTORY = 0x00000040, + SAMR_FIELD_HOME_DRIVE = 0x00000080, + SAMR_FIELD_LOGON_SCRIPT = 0x00000100, + SAMR_FIELD_PROFILE_PATH = 0x00000200, + SAMR_FIELD_WORKSTATIONS = 0x00000400, + SAMR_FIELD_LAST_LOGON = 0x00000800, + SAMR_FIELD_LAST_LOGOFF = 0x00001000, + SAMR_FIELD_LOGON_HOURS = 0x00002000, + SAMR_FIELD_BAD_PWD_COUNT = 0x00004000, + SAMR_FIELD_NUM_LOGONS = 0x00008000, + SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000, + SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000, + SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000, + SAMR_FIELD_ACCT_EXPIRY = 0x00080000, + SAMR_FIELD_ACCT_FLAGS = 0x00100000, + SAMR_FIELD_PARAMETERS = 0x00200000, + SAMR_FIELD_COUNTRY_CODE = 0x00400000, + SAMR_FIELD_CODE_PAGE = 0x00800000, + SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */ + SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */ + SAMR_FIELD_PRIVATE_DATA = 0x04000000, + SAMR_FIELD_EXPIRED_FLAG = 0x08000000, + SAMR_FIELD_SEC_DESC = 0x10000000, + SAMR_FIELD_OWF_PWD = 0x20000000 } samr_FieldsPresent; typedef struct { @@ -790,7 +859,7 @@ [case(26)] samr_UserInfo26 info26; } samr_UserInfo; - NTSTATUS samr_QueryUserInfo( + [public] NTSTATUS samr_QueryUserInfo( [in,ref] policy_handle *user_handle, [in] uint16 level, [out,switch_is(level)] samr_UserInfo *info @@ -799,7 +868,7 @@ /************************/ /* Function 0x25 */ - NTSTATUS samr_SetUserInfo( + [public] NTSTATUS samr_SetUserInfo( [in,ref] policy_handle *user_handle, [in] uint16 level, [in,ref,switch_is(level)] samr_UserInfo *info @@ -855,8 +924,8 @@ uint32 rid; samr_AcctFlags acct_flags; lsa_String account_name; - lsa_String full_name; lsa_String description; + lsa_String full_name; } samr_DispEntryGeneral; typedef struct { @@ -877,6 +946,19 @@ [size_is(count)] samr_DispEntryFull *entries; } samr_DispInfoFull; + typedef struct { + uint32 idx; + uint32 rid; + samr_GroupAttrs acct_flags; + lsa_String account_name; + lsa_String description; + } samr_DispEntryFullGroup; + + typedef struct { + uint32 count; + [size_is(count)] samr_DispEntryFullGroup *entries; + } samr_DispInfoFullGroups; + typedef struct { uint32 idx; lsa_AsciiString account_name; @@ -890,7 +972,7 @@ typedef [switch_type(uint16)] union { [case(1)] samr_DispInfoGeneral info1;/* users */ [case(2)] samr_DispInfoFull info2; /* trust accounts? */ - [case(3)] samr_DispInfoFull info3; /* groups */ + [case(3)] samr_DispInfoFullGroups info3; /* groups */ [case(4)] samr_DispInfoAscii info4; /* users */ [case(5)] samr_DispInfoAscii info5; /* groups */ } samr_DispInfo; @@ -958,7 +1040,7 @@ samr_PasswordProperties password_properties; } samr_PwInfo; - NTSTATUS samr_GetUserPwInfo( + [public] NTSTATUS samr_GetUserPwInfo( [in,ref] policy_handle *user_handle, [out] samr_PwInfo info ); @@ -1031,7 +1113,7 @@ [in,ref] policy_handle *domain_handle, [in,ref] lsa_String *account_name, [in] samr_AcctFlags acct_flags, - [in] uint32 access_mask, + [in] samr_UserAccessMask access_mask, [out,ref] policy_handle *user_handle, [out,ref] uint32 *access_granted, [out,ref] uint32 *rid @@ -1102,7 +1184,7 @@ /* Function 0x39 */ NTSTATUS samr_Connect2( [in,string,charset(UTF16)] uint16 *system_name, - [in] uint32 access_mask, + [in] samr_ConnectAccessMask access_mask, [out,ref] policy_handle *connect_handle ); @@ -1111,7 +1193,7 @@ /* seems to be an exact alias for samr_SetUserInfo() */ - NTSTATUS samr_SetUserInfo2( + [public] NTSTATUS samr_SetUserInfo2( [in,ref] policy_handle *user_handle, [in] uint16 level, [in,ref,switch_is(level)] samr_UserInfo *info @@ -1142,7 +1224,7 @@ [in,string,charset(UTF16)] uint16 *system_name, /* this unknown value seems to be completely ignored by w2k3 */ [in] uint32 unknown, - [in] uint32 access_mask, + [in] samr_ConnectAccessMask access_mask, [out,ref] policy_handle *connect_handle ); @@ -1151,7 +1233,7 @@ NTSTATUS samr_Connect4( [in,string,charset(UTF16)] uint16 *system_name, [in] uint32 unknown, - [in] uint32 access_mask, + [in] samr_ConnectAccessMask access_mask, [out,ref] policy_handle *connect_handle ); @@ -1191,9 +1273,9 @@ [case(1)] samr_ConnectInfo1 info1; } samr_ConnectInfo; - NTSTATUS samr_Connect5( + [public] NTSTATUS samr_Connect5( [in,string,charset(UTF16)] uint16 *system_name, - [in] uint32 access_mask, + [in] samr_ConnectAccessMask access_mask, [in,out] uint32 level, [in,out,switch_is(level),ref] samr_ConnectInfo *info, [out,ref] policy_handle *connect_handle @@ -1226,9 +1308,99 @@ /************************/ /* Function 0x43 */ - /* - I haven't been able to work out the format of this one yet. - Seems to start with a switch level for a union? - */ - NTSTATUS samr_ValidatePassword(); + /************************/ + typedef [bitmap32bit] bitmap { + SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001, + SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002, + SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004, + SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008, + SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010, + SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020 + } samr_ValidateFieldsPresent; + + typedef enum { + NetValidateAuthentication = 1, + NetValidatePasswordChange= 2, + NetValidatePasswordReset = 3 + } samr_ValidatePasswordLevel; + + /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't + * identified the mapping of + * - NERR_PasswordFilterError + * - NERR_PasswordExpired and + * - NERR_PasswordCantChange + * yet - Guenther + */ + + typedef enum { + SAMR_VALIDATION_STATUS_SUCCESS = 0, + SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1, + SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2, + SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4, + SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5, + SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6, + SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7, + SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8, + SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9 + } samr_ValidationStatus; + + typedef struct { + uint32 length; + [size_is(length)] uint8 *data; + } samr_ValidationBlob; + + typedef struct { + samr_ValidateFieldsPresent fields_present; + NTTIME_hyper last_password_change; + NTTIME_hyper bad_password_time; + NTTIME_hyper lockout_time; + uint32 bad_pwd_count; + uint32 pwd_history_len; + [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history; + } samr_ValidatePasswordInfo; + + typedef struct { + samr_ValidatePasswordInfo info; + samr_ValidationStatus status; + } samr_ValidatePasswordRepCtr; + + typedef [switch_type(uint16)] union { + [case(1)] samr_ValidatePasswordRepCtr ctr1; + [case(2)] samr_ValidatePasswordRepCtr ctr2; + [case(3)] samr_ValidatePasswordRepCtr ctr3; + } samr_ValidatePasswordRep; + + typedef struct { + samr_ValidatePasswordInfo info; + lsa_StringLarge password; + lsa_StringLarge account; + samr_ValidationBlob hash; + boolean8 pwd_must_change_at_next_logon; + boolean8 clear_lockout; + } samr_ValidatePasswordReq3; + + typedef struct { + samr_ValidatePasswordInfo info; + lsa_StringLarge password; + lsa_StringLarge account; + samr_ValidationBlob hash; + boolean8 password_matched; + } samr_ValidatePasswordReq2; + + typedef struct { + samr_ValidatePasswordInfo info; + boolean8 password_matched; + } samr_ValidatePasswordReq1; + + typedef [switch_type(uint16)] union { + [case(1)] samr_ValidatePasswordReq1 req1; + [case(2)] samr_ValidatePasswordReq2 req2; + [case(3)] samr_ValidatePasswordReq3 req3; + } samr_ValidatePasswordReq; + + NTSTATUS samr_ValidatePassword( + [in] samr_ValidatePasswordLevel level, + [in,switch_is(level)] samr_ValidatePasswordReq req, + [out,switch_is(level)] samr_ValidatePasswordRep *rep + ); } -- cgit From 516397e676d4d111b2992c57787c1b78994bb4d9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 09:49:10 +0100 Subject: Add samba3 [out,ref] pointer massage to samr&netlogon idl. Guenther (This used to be commit 8a895a37a0a0d155fddf0a6a124f161e3ace5e0b) --- source3/librpc/idl/netlogon.idl | 101 ++++++++++++++++++++-------------------- source3/librpc/idl/samr.idl | 86 +++++++++++++++++----------------- 2 files changed, 94 insertions(+), 93 deletions(-) diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index dcbb647ba0..c5d97c0d0f 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -4,7 +4,7 @@ who contributed! */ -import "lsa.idl", "samr.idl", "security.idl", "nbt.idl"; +import "lsa.idl", "samr.idl", "security.idl"; #include "idl_types.h" @@ -46,7 +46,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *server_name, [in] [string,charset(UTF16)] uint16 account_name[], [in] [string,charset(UTF16)] uint16 workstation[], - [out] netr_UasInfo *info + [out,ref] netr_UasInfo *info ); @@ -62,7 +62,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *server_name, [in] [string,charset(UTF16)] uint16 account_name[], [in] [string,charset(UTF16)] uint16 workstation[], - [out] netr_UasLogoffInfo info + [out,ref] netr_UasLogoffInfo *info ); @@ -246,8 +246,8 @@ interface netlogon [in] uint16 logon_level, [in] [switch_is(logon_level)] netr_LogonLevel logon, [in] uint16 validation_level, - [out] [switch_is(validation_level)] netr_Validation validation, - [out] uint8 authoritative + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative ); @@ -268,7 +268,7 @@ interface netlogon /*****************/ /* Function 0x04 */ - [public] NTSTATUS netr_ServerReqChallenge( + NTSTATUS netr_ServerReqChallenge( [in,string,charset(UTF16)] uint16 *server_name, [in,string,charset(UTF16)] uint16 computer_name[], [in,out,ref] netr_Credential *credentials @@ -299,7 +299,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 computer_name[], [in] netr_Authenticator credential, [in] samr_Password new_password, - [out] netr_Authenticator return_authenticator + [out,ref] netr_Authenticator *return_authenticator ); @@ -680,11 +680,11 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in] netr_SamDatabaseID database_id, - [in,out] udlong sequence_num, + [in,out,ref] udlong *sequence_num, [in] uint32 preferredmaximumlength, - [out] netr_DELTA_ENUM_ARRAY *delta_enum_array + [out,ref] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -695,11 +695,11 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in] netr_SamDatabaseID database_id, - [in,out] uint32 sync_context, + [in,out,ref] uint32 *sync_context, [in] uint32 preferredmaximumlength, - [out] netr_DELTA_ENUM_ARRAY *delta_enum_array + [out,ref] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -722,15 +722,15 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in] netr_UAS_INFO_0 uas, [in] uint32 count, [in] uint32 level, [in] uint32 buffersize, - [out,subcontext(4)] netr_AccountBuffer buffer, - [out] uint32 count_returned, - [out] uint32 total_entries, - [out] netr_UAS_INFO_0 recordid + [out,ref,subcontext(4)] netr_AccountBuffer *buffer, + [out,ref] uint32 *count_returned, + [out,ref] uint32 *total_entries, + [out,ref] netr_UAS_INFO_0 *recordid ); @@ -741,25 +741,25 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in] uint32 reference, [in] uint32 level, [in] uint32 buffersize, - [out,subcontext(4)] netr_AccountBuffer buffer, - [out] uint32 count_returned, - [out] uint32 total_entries, - [out] uint32 next_reference, - [in,out] netr_UAS_INFO_0 recordid + [out,ref,subcontext(4)] netr_AccountBuffer *buffer, + [out,ref] uint32 *count_returned, + [out,ref] uint32 *total_entries, + [out,ref] uint32 *next_reference, + [in,out,ref] netr_UAS_INFO_0 *recordid ); /*****************/ /* Function 0x0B */ - WERROR netr_GetDcName( + NTSTATUS netr_GetDcName( [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 *domainname, - [out] [string,charset(UTF16)] uint16 *dcname + [out,ref] [string,charset(UTF16)] uint16 **dcname ); /*****************/ @@ -805,7 +805,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 *logon_server, [in] netr_LogonControlCode function_code, [in] uint32 level, - [out,switch_is(level)] netr_CONTROL_QUERY_INFORMATION info + [out,ref,switch_is(level)] netr_CONTROL_QUERY_INFORMATION *info ); @@ -815,7 +815,7 @@ interface netlogon WERROR netr_GetAnyDCName( [in] [string,charset(UTF16)] uint16 *logon_server, [in] [string,charset(UTF16)] uint16 *domainname, - [out] [string,charset(UTF16)] uint16 *dcname + [out,ref] [string,charset(UTF16)] uint16 **dcname ); @@ -834,7 +834,7 @@ interface netlogon [in] uint32 function_code, [in] uint32 level, [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION data, - [out][switch_is(level)] netr_CONTROL_QUERY_INFORMATION query + [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query ); @@ -865,12 +865,12 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in] netr_SamDatabaseID database_id, [in] uint16 restart_state, - [in,out] uint32 sync_context, + [in,out,ref] uint32 *sync_context, [in] uint32 preferredmaximumlength, - [out] netr_DELTA_ENUM_ARRAY *delta_enum_array + [out,ref] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -883,10 +883,10 @@ interface netlogon [in] [string,charset(UTF16)] uint16 logon_server[], [in] [string,charset(UTF16)] uint16 computername[], [in] netr_Authenticator credential, - [in,out] netr_Authenticator return_authenticator, + [in,out,ref] netr_Authenticator *return_authenticator, [in][size_is(change_log_entry_size)] uint8 *change_log_entry, [in] uint32 change_log_entry_size, - [out] netr_DELTA_ENUM_ARRAY *delta_enum_array + [out,ref] netr_DELTA_ENUM_ARRAY *delta_enum_array ); @@ -898,7 +898,7 @@ interface netlogon [in] uint32 function_code, [in] uint32 level, [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION data, - [out][switch_is(level)] netr_CONTROL_QUERY_INFORMATION query + [out,ref][switch_is(level)] netr_CONTROL_QUERY_INFORMATION *query ); /*****************/ @@ -978,7 +978,7 @@ interface netlogon [in] GUID *domain_guid, [in] GUID *site_guid, [in] netr_DsRGetDCName_flags flags, - [out] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo *info ); /*****************/ @@ -1003,7 +1003,7 @@ interface netlogon /****************/ /* Function 0x1a */ - [public] NTSTATUS netr_ServerAuthenticate3( + NTSTATUS netr_ServerAuthenticate3( [in] [string,charset(UTF16)] uint16 *server_name, [in] [string,charset(UTF16)] uint16 account_name[], [in] netr_SchannelType secure_channel_type, @@ -1022,14 +1022,14 @@ interface netlogon [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, [in] netr_DsRGetDCName_flags flags, - [out] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo *info ); /****************/ /* Function 0x1c */ WERROR netr_DsRGetSiteName( [in] [string,charset(UTF16)] uint16 *computer_name, - [out] [string,charset(UTF16)] uint16 *site + [out,ref] [string,charset(UTF16)] uint16 **site ); /****************/ @@ -1090,7 +1090,7 @@ interface netlogon [in,out,ref] netr_Authenticator *return_authenticator, [in] uint32 level, [in,switch_is(level)] netr_DomainQuery query, - [out,switch_is(level)] netr_DomainInfo info + [out,ref,switch_is(level)] netr_DomainInfo *info ); typedef [flag(NDR_PAHEX)] struct { @@ -1107,7 +1107,7 @@ interface netlogon [in] [string,charset(UTF16)] uint16 computer_name[], [in] netr_Authenticator credential, [in] netr_CryptPassword new_password, - [out] netr_Authenticator return_authenticator + [out,ref] netr_Authenticator *return_authenticator ); /****************/ @@ -1155,7 +1155,7 @@ interface netlogon [in] GUID *domain_guid, [in] [string,charset(UTF16)] uint16 *site_name, [in] netr_DsRGetDCName_flags flags, - [out] netr_DsRGetDCNameInfo *info + [out,ref] netr_DsRGetDCNameInfo *info ); /****************/ @@ -1236,7 +1236,7 @@ interface netlogon WERROR netr_DsrGetDcSiteCoverageW( [in] [string,charset(UTF16)] uint16 *server_name, - [out] DcSitesCtr *ctr + [out,ref] DcSitesCtr *ctr ); /****************/ @@ -1247,9 +1247,9 @@ interface netlogon [in] uint16 logon_level, [in] [switch_is(logon_level)] netr_LogonLevel logon, [in] uint16 validation_level, - [out] [switch_is(validation_level)] netr_Validation validation, - [out] uint8 authoritative, - [in,out] uint32 flags + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative, + [in,out,ref] uint32 *flags ); /****************/ @@ -1258,8 +1258,7 @@ interface netlogon WERROR netr_DsrEnumerateDomainTrusts( [in] [string,charset(UTF16)] uint16 *server_name, [in] netr_TrustFlags trust_flags, - [out] uint32 count, - [out,size_is(count)] netr_DomainTrust *trusts + [out,ref] netr_DomainTrustList **trusts ); @@ -1315,9 +1314,9 @@ interface netlogon [in] uint16 logon_level, [in] [switch_is(logon_level)] netr_LogonLevel logon, [in] uint16 validation_level, - [out] [switch_is(validation_level)] netr_Validation validation, - [out] uint8 authoritative, - [in,out] uint32 flags + [out,ref] [switch_is(validation_level)] netr_Validation *validation, + [out,ref] uint8 *authoritative, + [in,out,ref] uint32 *flags ); /****************/ diff --git a/source3/librpc/idl/samr.idl b/source3/librpc/idl/samr.idl index b6d2b9f941..baf61c6df3 100644 --- a/source3/librpc/idl/samr.idl +++ b/source3/librpc/idl/samr.idl @@ -125,7 +125,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QuerySecurity ( [in,ref] policy_handle *handle, [in] security_secinfo sec_info, - [out] sec_desc_buf *sdbuf + [out,ref] sec_desc_buf *sdbuf ); /******************/ @@ -143,7 +143,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_LookupDomain ( [in,ref] policy_handle *connect_handle, [in,ref] lsa_String *domain_name, - [out] dom_sid2 *sid + [out,ref] dom_sid2 *sid ); @@ -164,8 +164,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *connect_handle, [in,out,ref] uint32 *resume_handle, [in] uint32 buf_size, - [out] samr_SamArray *sam, - [out] uint32 num_entries + [out,ref] samr_SamArray *sam, + [out,ref] uint32 *num_entries ); @@ -288,7 +288,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryDomainInfo( [in,ref] policy_handle *domain_handle, [in] uint16 level, - [out,switch_is(level)] samr_DomainInfo *info + [out,ref,switch_is(level)] samr_DomainInfo *info ); /************************/ @@ -321,8 +321,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in,out,ref] uint32 *resume_handle, [in] uint32 max_size, - [out] samr_SamArray *sam, - [out] uint32 num_entries + [out,ref] samr_SamArray *sam, + [out,ref] uint32 *num_entries ); /************************/ @@ -349,8 +349,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,out,ref] uint32 *resume_handle, [in] samr_AcctFlags acct_flags, [in] uint32 max_size, - [out] samr_SamArray *sam, - [out] uint32 num_entries + [out,ref] samr_SamArray *sam, + [out,ref] uint32 *num_entries ); /************************/ @@ -369,8 +369,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in,out,ref] uint32 *resume_handle, [in] samr_AcctFlags acct_flags, - [out] samr_SamArray *sam, - [out] uint32 num_entries + [out,ref] samr_SamArray *sam, + [out,ref] uint32 *num_entries ); /************************/ @@ -394,8 +394,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in,range(0,1000)] uint32 num_names, [in,size_is(1000),length_is(num_names)] lsa_String names[], - [out] samr_Ids rids, - [out] samr_Ids types + [out,ref] samr_Ids *rids, + [out,ref] samr_Ids *types ); @@ -405,8 +405,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in,range(0,1000)] uint32 num_rids, [in,size_is(1000),length_is(num_rids)] uint32 rids[], - [out] lsa_Strings names, - [out] samr_Ids types + [out,ref] lsa_Strings *names, + [out,ref] samr_Ids *types ); /************************/ @@ -466,7 +466,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryGroupInfo( [in,ref] policy_handle *group_handle, [in] samr_GroupInfoEnum level, - [out,switch_is(level)] samr_GroupInfo *info + [out,ref,switch_is(level)] samr_GroupInfo *info ); /************************/ @@ -509,7 +509,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryGroupMember( [in,ref] policy_handle *group_handle, - [out] samr_RidTypeArray *rids + [out,ref] samr_RidTypeArray *rids ); @@ -563,7 +563,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryAliasInfo( [in,ref] policy_handle *alias_handle, [in] samr_AliasInfoEnum level, - [out,switch_is(level)] samr_AliasInfo *info + [out,ref,switch_is(level)] samr_AliasInfo *info ); /************************/ @@ -862,7 +862,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [public] NTSTATUS samr_QueryUserInfo( [in,ref] policy_handle *user_handle, [in] uint16 level, - [out,switch_is(level)] samr_UserInfo *info + [out,ref,switch_is(level)] samr_UserInfo *info ); @@ -913,7 +913,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_GetGroupsForUser( [in,ref] policy_handle *user_handle, - [out] samr_RidWithAttributeArray *rids + [out,ref] samr_RidWithAttributeArray *rids ); /************************/ @@ -983,9 +983,9 @@ import "misc.idl", "lsa.idl", "security.idl"; [in] uint32 start_idx, [in] uint32 max_entries, [in] uint32 buf_size, - [out] uint32 total_size, - [out] uint32 returned_size, - [out,switch_is(level)] samr_DispInfo info + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info ); @@ -1005,7 +1005,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in] uint16 level, [in] lsa_String name, - [out] uint32 idx + [out,ref] uint32 *idx ); @@ -1042,7 +1042,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [public] NTSTATUS samr_GetUserPwInfo( [in,ref] policy_handle *user_handle, - [out] samr_PwInfo info + [out,ref] samr_PwInfo *info ); /************************/ @@ -1061,7 +1061,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryDomainInfo2( [in,ref] policy_handle *domain_handle, [in] uint16 level, - [out,switch_is(level)] samr_DomainInfo *info + [out,ref,switch_is(level)] samr_DomainInfo *info ); /************************/ @@ -1073,7 +1073,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_QueryUserInfo2( [in,ref] policy_handle *user_handle, [in] uint16 level, - [out,switch_is(level)] samr_UserInfo *info + [out,ref,switch_is(level)] samr_UserInfo *info ); /************************/ @@ -1088,9 +1088,9 @@ import "misc.idl", "lsa.idl", "security.idl"; [in] uint32 start_idx, [in] uint32 max_entries, [in] uint32 buf_size, - [out] uint32 total_size, - [out] uint32 returned_size, - [out,switch_is(level)] samr_DispInfo info + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info ); /************************/ @@ -1103,7 +1103,7 @@ import "misc.idl", "lsa.idl", "security.idl"; [in,ref] policy_handle *domain_handle, [in] uint16 level, [in] lsa_String name, - [out] uint32 idx + [out,ref] uint32 *idx ); @@ -1132,9 +1132,9 @@ import "misc.idl", "lsa.idl", "security.idl"; [in] uint32 start_idx, [in] uint32 max_entries, [in] uint32 buf_size, - [out] uint32 total_size, - [out] uint32 returned_size, - [out,switch_is(level)] samr_DispInfo info + [out,ref] uint32 *total_size, + [out,ref] uint32 *returned_size, + [out,ref,switch_is(level)] samr_DispInfo *info ); /************************/ @@ -1177,7 +1177,7 @@ import "misc.idl", "lsa.idl", "security.idl"; /* Function 0x38 */ NTSTATUS samr_GetDomPwInfo( [in] lsa_String *domain_name, - [out] samr_PwInfo info + [out,ref] samr_PwInfo *info ); /************************/ @@ -1215,7 +1215,7 @@ import "misc.idl", "lsa.idl", "security.idl"; /* Function 0x3c */ NTSTATUS samr_GetBootKeyInformation( [in,ref] policy_handle *domain_handle, - [out] uint32 unknown + [out,ref] uint32 *unknown ); /************************/ @@ -1257,8 +1257,8 @@ import "misc.idl", "lsa.idl", "security.idl"; [in] samr_CryptPassword *lm_password, [in] samr_Password *lm_verifier, [in] samr_CryptPassword *password3, - [out] samr_DomInfo1 *dominfo, - [out] samr_ChangeReject *reject + [out,ref] samr_DomInfo1 *dominfo, + [out,ref] samr_ChangeReject *reject ); /************************/ @@ -1276,8 +1276,10 @@ import "misc.idl", "lsa.idl", "security.idl"; [public] NTSTATUS samr_Connect5( [in,string,charset(UTF16)] uint16 *system_name, [in] samr_ConnectAccessMask access_mask, - [in,out] uint32 level, - [in,out,switch_is(level),ref] samr_ConnectInfo *info, + [in] uint32 level_in, + [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in, + [out,ref] uint32 *level_out, + [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out, [out,ref] policy_handle *connect_handle ); @@ -1286,7 +1288,7 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_RidToSid( [in,ref] policy_handle *domain_handle, [in] uint32 rid, - [out] dom_sid2 *sid + [out,ref] dom_sid2 *sid ); @@ -1401,6 +1403,6 @@ import "misc.idl", "lsa.idl", "security.idl"; NTSTATUS samr_ValidatePassword( [in] samr_ValidatePasswordLevel level, [in,switch_is(level)] samr_ValidatePasswordReq req, - [out,switch_is(level)] samr_ValidatePasswordRep *rep + [out,ref,switch_is(level)] samr_ValidatePasswordRep *rep ); } -- cgit From a042b8c8e1219f1acc971c576c2d606bcb88a265 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 09:50:45 +0100 Subject: Import recent misc.idl from Samba4. Guenther (This used to be commit 9afc7d957d1b5362e470c2e87e336fdd74b8be3c) --- source3/librpc/idl/misc.idl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source3/librpc/idl/misc.idl b/source3/librpc/idl/misc.idl index 00f9fb6bed..0861758187 100644 --- a/source3/librpc/idl/misc.idl +++ b/source3/librpc/idl/misc.idl @@ -49,5 +49,9 @@ interface misc SAMR_REJECT_COMPLEXITY = 5 } samr_RejectReason; - + /* id used to identify a endpoint, possibly in a cluster */ + typedef [public] struct { + uint32 id; + uint32 node; + } server_id; } -- cgit From c5277097924985ed23abc109712b7ca2213e87e8 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 09:52:21 +0100 Subject: Remove samba4 specifi struct server_id from misc.idl. Guenther (This used to be commit 9d76153f54aea671d5d1543eaa3e617aad1ba9e9) --- source3/librpc/idl/misc.idl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source3/librpc/idl/misc.idl b/source3/librpc/idl/misc.idl index 0861758187..132a81f138 100644 --- a/source3/librpc/idl/misc.idl +++ b/source3/librpc/idl/misc.idl @@ -48,10 +48,4 @@ interface misc SAMR_REJECT_IN_HISTORY = 2, SAMR_REJECT_COMPLEXITY = 5 } samr_RejectReason; - - /* id used to identify a endpoint, possibly in a cluster */ - typedef [public] struct { - uint32 id; - uint32 node; - } server_id; } -- cgit From fc23de785554934a18f45852caa65f63e4c42d68 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 09:54:35 +0100 Subject: Remove dependency for nbt.idl (the NBT_SERVER_* flags) in netlogon.idl. Guenther (This used to be commit 37d976d90c9bd7697010309e5efbc7853aced9e5) --- source3/librpc/idl/netlogon.idl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index c5d97c0d0f..87b1d5f90d 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -945,15 +945,15 @@ interface netlogon } netr_DsRGetDCNameInfo_AddressType; typedef [bitmap32bit] bitmap { - DS_SERVER_PDC = NBT_SERVER_PDC, - DS_SERVER_GC = NBT_SERVER_GC, - DS_SERVER_LDAP = NBT_SERVER_LDAP, - DS_SERVER_DS = NBT_SERVER_DS, - DS_SERVER_KDC = NBT_SERVER_KDC, - DS_SERVER_TIMESERV = NBT_SERVER_TIMESERV, - DS_SERVER_CLOSEST = NBT_SERVER_CLOSEST, - DS_SERVER_WRITABLE = NBT_SERVER_WRITABLE, - DS_SERVER_GOOD_TIMESERV = NBT_SERVER_GOOD_TIMESERV, + DS_SERVER_PDC = 0x00000001 /* NBT_SERVER_PDC */, + DS_SERVER_GC = 0x00000004 /* NBT_SERVER_GC */, + DS_SERVER_LDAP = 0x00000008 /* NBT_SERVER_LDAP */, + DS_SERVER_DS = 0x00000010 /* NBT_SERVER_DS */, + DS_SERVER_KDC = 0x00000020 /* NBT_SERVER_KDC */, + DS_SERVER_TIMESERV = 0x00000040 /* NBT_SERVER_TIMESERV */, + DS_SERVER_CLOSEST = 0x00000080 /* NBT_SERVER_CLOSEST */, + DS_SERVER_WRITABLE = 0x00000100 /* NBT_SERVER_WRITABLE */, + DS_SERVER_GOOD_TIMESERV = 0x00000200 /* NBT_SERVER_GOOD_TIMESERV */, DS_SERVER_NDNC = 0x00000400, DS_DNS_CONTROLLER = 0x20000000, DS_DNS_DOMAIN = 0x40000000, -- cgit From 8c81ce9a6004f1ae2d6f1812d08820d7244598c1 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:00:37 +0100 Subject: Re-run make idl to regenerate netlogon output. Guenther (This used to be commit b0e86c5b4d375f21f06208dc063adb9d2659d30b) --- source3/librpc/gen_ndr/cli_netlogon.c | 211 ++-- source3/librpc/gen_ndr/cli_netlogon.h | 71 +- source3/librpc/gen_ndr/ndr_netlogon.c | 2130 +++++++++++++++++++++++++++------ source3/librpc/gen_ndr/ndr_netlogon.h | 34 +- source3/librpc/gen_ndr/netlogon.h | 197 ++- source3/librpc/gen_ndr/srv_netlogon.c | 227 ++-- source3/librpc/gen_ndr/srv_netlogon.h | 18 +- 7 files changed, 2277 insertions(+), 611 deletions(-) diff --git a/source3/librpc/gen_ndr/cli_netlogon.c b/source3/librpc/gen_ndr/cli_netlogon.c index efabf2e08f..414e053dc9 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.c +++ b/source3/librpc/gen_ndr/cli_netlogon.c @@ -46,9 +46,7 @@ NTSTATUS rpccli_netr_LogonUasLogon(struct rpc_pipe_client *cli, } /* Return variables */ - if (info && r.out.info) { - *info = *r.out.info; - } + *info = *r.out.info; /* Return result */ if (werror) { @@ -410,9 +408,7 @@ NTSTATUS rpccli_netr_DatabaseDeltas(struct rpc_pipe_client *cli, /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sequence_num = *r.out.sequence_num; - if (delta_enum_array && r.out.delta_enum_array) { - *delta_enum_array = *r.out.delta_enum_array; - } + *delta_enum_array = *r.out.delta_enum_array; /* Return result */ return r.out.result; @@ -467,9 +463,7 @@ NTSTATUS rpccli_netr_DatabaseSync(struct rpc_pipe_client *cli, /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sync_context = *r.out.sync_context; - if (delta_enum_array && r.out.delta_enum_array) { - *delta_enum_array = *r.out.delta_enum_array; - } + *delta_enum_array = *r.out.delta_enum_array; /* Return result */ return r.out.result; @@ -895,9 +889,7 @@ NTSTATUS rpccli_netr_DatabaseSync2(struct rpc_pipe_client *cli, /* Return variables */ *return_authenticator = *r.out.return_authenticator; *sync_context = *r.out.sync_context; - if (delta_enum_array && r.out.delta_enum_array) { - *delta_enum_array = *r.out.delta_enum_array; - } + *delta_enum_array = *r.out.delta_enum_array; /* Return result */ return r.out.result; @@ -949,9 +941,7 @@ NTSTATUS rpccli_netr_DatabaseRedo(struct rpc_pipe_client *cli, /* Return variables */ *return_authenticator = *r.out.return_authenticator; - if (delta_enum_array && r.out.delta_enum_array) { - *delta_enum_array = *r.out.delta_enum_array; - } + *delta_enum_array = *r.out.delta_enum_array; /* Return result */ return r.out.result; @@ -1009,17 +999,20 @@ NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct netr_Blob *trusted_domains_blob, WERROR *werror) { - struct netr_NETRENUMERATETRUSTEDDOMAINS r; + struct netr_NetrEnumerateTrustedDomains r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, &r); } status = cli_do_rpc_ndr(cli, @@ -1034,7 +1027,7 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, &r); + NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1042,6 +1035,7 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, } /* Return variables */ + *trusted_domains_blob = *r.out.trusted_domains_blob; /* Return result */ if (werror) { @@ -1095,9 +1089,7 @@ NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, } /* Return variables */ - if (info && r.out.info) { - *info = *r.out.info; - } + *info = *r.out.info; /* Return result */ if (werror) { @@ -1414,9 +1406,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx(struct rpc_pipe_client *cli, } /* Return variables */ - if (info && r.out.info) { - *info = *r.out.info; - } + *info = *r.out.info; /* Return result */ if (werror) { @@ -1575,24 +1565,36 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, return r.out.result; } -NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror) +NTSTATUS rpccli_netr_ServerPasswordGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + struct samr_Password *password, + WERROR *werror) { - struct netr_NETRSERVERPASSWORDGET r; + struct netr_ServerPasswordGet r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.account_name = account_name; + r.in.secure_channel_type = secure_channel_type; + r.in.computer_name = computer_name; + r.in.credential = credential; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, &r); + NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, &r); } status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, - NDR_NETR_NETRSERVERPASSWORDGET, + NDR_NETR_SERVERPASSWORDGET, &r); if (!NT_STATUS_IS_OK(status)) { @@ -1600,7 +1602,7 @@ NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1608,6 +1610,8 @@ NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, } /* Return variables */ + *return_authenticator = *r.out.return_authenticator; + *password = *r.out.password; /* Return result */ if (werror) { @@ -1659,17 +1663,24 @@ NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsRAddressToSitenamesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t count, + struct netr_DsRAddress *addresses, + struct netr_DsRAddressToSitenamesWCtr **ctr, WERROR *werror) { - struct netr_DSRADDRESSTOSITENAMESW r; + struct netr_DsRAddressToSitenamesW r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.count = count; + r.in.addresses = addresses; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); + NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, &r); } status = cli_do_rpc_ndr(cli, @@ -1684,7 +1695,7 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1692,6 +1703,7 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, } /* Return variables */ + *ctr = *r.out.ctr; /* Return result */ if (werror) { @@ -1749,9 +1761,7 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, } /* Return variables */ - if (info && r.out.info) { - *info = *r.out.info; - } + *info = *r.out.info; /* Return result */ if (werror) { @@ -1803,17 +1813,20 @@ NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct netr_DomainTrustList *dom_trust_list, WERROR *werror) { - struct netr_NETRENUMERATETRUSTEDDOMAINSEX r; + struct netr_NetrEnumerateTrustedDomainsEx r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r); } status = cli_do_rpc_ndr(cli, @@ -1828,7 +1841,7 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, &r); + NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1836,6 +1849,7 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, } /* Return variables */ + *dom_trust_list = *r.out.dom_trust_list; /* Return result */ if (werror) { @@ -1845,17 +1859,24 @@ NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t count, + struct netr_DsRAddress *addresses, + struct netr_DsRAddressToSitenamesExWCtr **ctr, WERROR *werror) { - struct netr_DSRADDRESSTOSITENAMESEXW r; + struct netr_DsRAddressToSitenamesExW r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.count = count; + r.in.addresses = addresses; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); + NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, &r); } status = cli_do_rpc_ndr(cli, @@ -1870,7 +1891,7 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1878,6 +1899,7 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, } /* Return variables */ + *ctr = *r.out.ctr; /* Return result */ if (werror) { @@ -1887,17 +1909,20 @@ NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct DcSitesCtr *ctr, WERROR *werror) { - struct netr_DSRGETDCSITECOVERAGEW r; + struct netr_DsrGetDcSiteCoverageW r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); + NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, &r); } status = cli_do_rpc_ndr(cli, @@ -1912,7 +1937,7 @@ NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, &r); + NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -1920,6 +1945,7 @@ NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, } /* Return variables */ + *ctr = *r.out.ctr; /* Return result */ if (werror) { @@ -1987,8 +2013,7 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, - uint32_t *count, - struct netr_DomainTrust **trusts, + struct netr_DomainTrustList **trusts, WERROR *werror) { struct netr_DsrEnumerateDomainTrusts r; @@ -2022,8 +2047,7 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, } /* Return variables */ - *count = *r.out.count; - memcpy(trusts, r.out.trusts, count); + *trusts = *r.out.trusts; /* Return result */ if (werror) { @@ -2075,24 +2099,36 @@ NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror) +NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + struct samr_Password *password, + struct samr_Password *password2) { - struct netr_NETRSERVERTRUSTPASSWORDSGET r; + struct netr_ServerTrustPasswordsGet r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.account_name = account_name; + r.in.secure_channel_type = secure_channel_type; + r.in.computer_name = computer_name; + r.in.credential = credential; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, &r); } status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, - NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, + NDR_NETR_SERVERTRUSTPASSWORDSGET, &r); if (!NT_STATUS_IS_OK(status)) { @@ -2100,7 +2136,7 @@ NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, &r); + NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -2108,26 +2144,32 @@ NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, } /* Return variables */ + *return_authenticator = *r.out.return_authenticator; + *password = *r.out.password; + *password2 = *r.out.password2; /* Return result */ - if (werror) { - *werror = r.out.result; - } - - return werror_to_ntstatus(r.out.result); + return r.out.result; } -NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsRGetForestTrustInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + const char *trusted_domain_name, + uint32_t flags, + struct lsa_ForestTrustInformation **forest_trust_info, WERROR *werror) { - struct netr_DSRGETFORESTTRUSTINFORMATION r; + struct netr_DsRGetForestTrustInformation r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.trusted_domain_name = trusted_domain_name; + r.in.flags = flags; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, &r); } status = cli_do_rpc_ndr(cli, @@ -2142,7 +2184,7 @@ NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -2150,6 +2192,7 @@ NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } /* Return variables */ + *forest_trust_info = *r.out.forest_trust_info; /* Return result */ if (werror) { @@ -2159,24 +2202,34 @@ NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror) +NTSTATUS rpccli_netr_GetForestTrustInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *trusted_domain_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint32_t flags, + struct lsa_ForestTrustInformation **forest_trust_info, + WERROR *werror) { - struct netr_NETRGETFORESTTRUSTINFORMATION r; + struct netr_GetForestTrustInformation r; NTSTATUS status; /* In parameters */ + r.in.server_name = server_name; + r.in.trusted_domain_name = trusted_domain_name; + r.in.credential = credential; + r.in.flags = flags; if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, &r); } status = cli_do_rpc_ndr(cli, mem_ctx, PI_NETLOGON, &ndr_table_netlogon, - NDR_NETR_NETRGETFORESTTRUSTINFORMATION, + NDR_NETR_GETFORESTTRUSTINFORMATION, &r); if (!NT_STATUS_IS_OK(status)) { @@ -2184,7 +2237,7 @@ NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, &r); + NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, &r); } if (NT_STATUS_IS_ERR(status)) { @@ -2192,6 +2245,8 @@ NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, } /* Return variables */ + *return_authenticator = *r.out.return_authenticator; + *forest_trust_info = *r.out.forest_trust_info; /* Return result */ if (werror) { diff --git a/source3/librpc/gen_ndr/cli_netlogon.h b/source3/librpc/gen_ndr/cli_netlogon.h index 9409077d09..30a9645767 100644 --- a/source3/librpc/gen_ndr/cli_netlogon.h +++ b/source3/librpc/gen_ndr/cli_netlogon.h @@ -165,8 +165,10 @@ NTSTATUS rpccli_netr_LogonControl2Ex(struct rpc_pipe_client *cli, union netr_CONTROL_DATA_INFORMATION data, union netr_CONTROL_QUERY_INFORMATION *query, WERROR *werror); -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINS(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_NetrEnumerateTrustedDomains(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct netr_Blob *trusted_domains_blob, WERROR *werror); NTSTATUS rpccli_netr_DsRGetDCName(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -233,14 +235,25 @@ NTSTATUS rpccli_netr_ServerPasswordSet2(struct rpc_pipe_client *cli, struct netr_Authenticator credential, struct netr_CryptPassword new_password, struct netr_Authenticator *return_authenticator); -NTSTATUS rpccli_netr_NETRSERVERPASSWORDGET(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror); +NTSTATUS rpccli_netr_ServerPasswordGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + struct samr_Password *password, + WERROR *werror); NTSTATUS rpccli_netr_NETRLOGONSENDTOSAM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsRAddressToSitenamesW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t count, + struct netr_DsRAddress *addresses, + struct netr_DsRAddressToSitenamesWCtr **ctr, WERROR *werror); NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -256,14 +269,22 @@ NTSTATUS rpccli_netr_DsRGetDCNameEx2(struct rpc_pipe_client *cli, NTSTATUS rpccli_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_NetrEnumerateTrustedDomainsEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct netr_DomainTrustList *dom_trust_list, WERROR *werror); -NTSTATUS rpccli_netr_DSRADDRESSTOSITENAMESEXW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsRAddressToSitenamesExW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + uint32_t count, + struct netr_DsRAddress *addresses, + struct netr_DsRAddressToSitenamesExWCtr **ctr, WERROR *werror); -NTSTATUS rpccli_netr_DSRGETDCSITECOVERAGEW(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_DsrGetDcSiteCoverageW(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + struct DcSitesCtr *ctr, WERROR *werror); NTSTATUS rpccli_netr_LogonSamLogonEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, @@ -279,21 +300,37 @@ NTSTATUS rpccli_netr_DsrEnumerateDomainTrusts(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, uint32_t trust_flags, - uint32_t *count, - struct netr_DomainTrust **trusts, + struct netr_DomainTrustList **trusts, WERROR *werror); NTSTATUS rpccli_netr_DSRDEREGISTERDNSHOSTRECORDS(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, WERROR *werror); -NTSTATUS rpccli_netr_NETRSERVERTRUSTPASSWORDSGET(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror); -NTSTATUS rpccli_netr_DSRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, +NTSTATUS rpccli_netr_ServerTrustPasswordsGet(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *account_name, + enum netr_SchannelType secure_channel_type, + const char *computer_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + struct samr_Password *password, + struct samr_Password *password2); +NTSTATUS rpccli_netr_DsRGetForestTrustInformation(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, + const char *server_name, + const char *trusted_domain_name, + uint32_t flags, + struct lsa_ForestTrustInformation **forest_trust_info, WERROR *werror); -NTSTATUS rpccli_netr_NETRGETFORESTTRUSTINFORMATION(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - WERROR *werror); +NTSTATUS rpccli_netr_GetForestTrustInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *server_name, + const char *trusted_domain_name, + struct netr_Authenticator *credential, + struct netr_Authenticator *return_authenticator, + uint32_t flags, + struct lsa_ForestTrustInformation **forest_trust_info, + WERROR *werror); NTSTATUS rpccli_netr_LogonSamLogonWithFlags(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, const char *server_name, diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 0512f4db65..1ceca9d8d4 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -2096,7 +2096,7 @@ static enum ndr_err_code ndr_push_netr_USER_KEYS2(struct ndr_push *ndr, int ndr_ NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_SCALARS, &r->lmpassword)); NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_SCALARS, &r->ntpassword)); - NDR_CHECK(ndr_push_netr_PasswordHistory(ndr, NDR_SCALARS, &r->lmhistory)); + NDR_CHECK(ndr_push_netr_PasswordHistory(ndr, NDR_SCALARS, &r->history)); } if (ndr_flags & NDR_BUFFERS) { NDR_CHECK(ndr_push_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->lmpassword)); @@ -2111,7 +2111,7 @@ static enum ndr_err_code ndr_pull_netr_USER_KEYS2(struct ndr_pull *ndr, int ndr_ NDR_CHECK(ndr_pull_align(ndr, 4)); NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_SCALARS, &r->lmpassword)); NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_SCALARS, &r->ntpassword)); - NDR_CHECK(ndr_pull_netr_PasswordHistory(ndr, NDR_SCALARS, &r->lmhistory)); + NDR_CHECK(ndr_pull_netr_PasswordHistory(ndr, NDR_SCALARS, &r->history)); } if (ndr_flags & NDR_BUFFERS) { NDR_CHECK(ndr_pull_netr_USER_KEY16(ndr, NDR_BUFFERS, &r->lmpassword)); @@ -2126,7 +2126,7 @@ _PUBLIC_ void ndr_print_netr_USER_KEYS2(struct ndr_print *ndr, const char *name, ndr->depth++; ndr_print_netr_USER_KEY16(ndr, "lmpassword", &r->lmpassword); ndr_print_netr_USER_KEY16(ndr, "ntpassword", &r->ntpassword); - ndr_print_netr_PasswordHistory(ndr, "lmhistory", &r->lmhistory); + ndr_print_netr_PasswordHistory(ndr, "history", &r->history); ndr->depth--; } @@ -5942,17 +5942,174 @@ _PUBLIC_ void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, con } } +static enum ndr_err_code ndr_push_netr_Blob(struct ndr_push *ndr, int ndr_flags, const struct netr_Blob *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_Blob(struct ndr_pull *ndr, int ndr_flags, struct netr_Blob *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); + NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + if (r->data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r) +{ + ndr_print_struct(ndr, name, "netr_Blob"); + ndr->depth++; + ndr_print_uint32(ndr, "length", r->length); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_array_uint8(ndr, "data", r->data, r->length); + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_netr_DsRGetDCName_flags(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsRGetDCName_flags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_FORCE_REDISCOVERY", DS_FORCE_REDISCOVERY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DIRECTORY_SERVICE_REQUIRED", DS_DIRECTORY_SERVICE_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DIRECTORY_SERVICE_PREFERRED", DS_DIRECTORY_SERVICE_PREFERRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_GC_SERVER_REQUIRED", DS_GC_SERVER_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_PDC_REQUIRED", DS_PDC_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_BACKGROUND_ONLY", DS_BACKGROUND_ONLY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IP_REQUIRED", DS_IP_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_KDC_REQUIRED", DS_KDC_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_TIMESERV_REQUIRED", DS_TIMESERV_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_WRITABLE_REQUIRED", DS_WRITABLE_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_GOOD_TIMESERV_PREFERRED", DS_GOOD_TIMESERV_PREFERRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_AVOID_SELF", DS_AVOID_SELF, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_ONLY_LDAP_NEEDED", DS_ONLY_LDAP_NEEDED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IS_FLAT_NAME", DS_IS_FLAT_NAME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_IS_DNS_NAME", DS_IS_DNS_NAME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_RETURN_DNS_NAME", DS_RETURN_DNS_NAME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_RETURN_FLAT_NAME", DS_RETURN_FLAT_NAME, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo_AddressType(struct ndr_push *ndr, int ndr_flags, enum netr_DsRGetDCNameInfo_AddressType r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo_AddressType(struct ndr_pull *ndr, int ndr_flags, enum netr_DsRGetDCNameInfo_AddressType *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r) +{ + const char *val = NULL; + + switch (r) { + case DS_ADDRESS_TYPE_INET: val = "DS_ADDRESS_TYPE_INET"; break; + case DS_ADDRESS_TYPE_NETBIOS: val = "DS_ADDRESS_TYPE_NETBIOS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_netr_DsR_DcFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsR_DcFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_PDC", DS_SERVER_PDC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_GC", DS_SERVER_GC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_LDAP", DS_SERVER_LDAP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_DS", DS_SERVER_DS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_KDC", DS_SERVER_KDC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_TIMESERV", DS_SERVER_TIMESERV, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_CLOSEST", DS_SERVER_CLOSEST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_WRITABLE", DS_SERVER_WRITABLE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_GOOD_TIMESERV", DS_SERVER_GOOD_TIMESERV, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_SERVER_NDNC", DS_SERVER_NDNC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_CONTROLLER", DS_DNS_CONTROLLER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_DOMAIN", DS_DNS_DOMAIN, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DS_DNS_FOREST", DS_DNS_FOREST, r); + ndr->depth--; +} + static enum ndr_err_code ndr_push_netr_DsRGetDCNameInfo(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRGetDCNameInfo *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_unc)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_address)); - NDR_CHECK(ndr_push_int32(ndr, NDR_SCALARS, r->dc_address_type)); + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo_AddressType(ndr, NDR_SCALARS, r->dc_address_type)); NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_guid)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->domain_name)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest_name)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->dc_flags)); + NDR_CHECK(ndr_push_netr_DsR_DcFlags(ndr, NDR_SCALARS, r->dc_flags)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->dc_site_name)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->client_site_name)); } @@ -6026,7 +6183,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, in } else { r->dc_address = NULL; } - NDR_CHECK(ndr_pull_int32(ndr, NDR_SCALARS, &r->dc_address_type)); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo_AddressType(ndr, NDR_SCALARS, &r->dc_address_type)); NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_guid)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name)); if (_ptr_domain_name) { @@ -6040,7 +6197,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameInfo(struct ndr_pull *ndr, in } else { r->forest_name = NULL; } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->dc_flags)); + NDR_CHECK(ndr_pull_netr_DsR_DcFlags(ndr, NDR_SCALARS, &r->dc_flags)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_dc_site_name)); if (_ptr_dc_site_name) { NDR_PULL_ALLOC(ndr, r->dc_site_name); @@ -6148,7 +6305,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char ndr_print_string(ndr, "dc_address", r->dc_address); } ndr->depth--; - ndr_print_int32(ndr, "dc_address_type", r->dc_address_type); + ndr_print_netr_DsRGetDCNameInfo_AddressType(ndr, "dc_address_type", r->dc_address_type); ndr_print_GUID(ndr, "domain_guid", &r->domain_guid); ndr_print_ptr(ndr, "domain_name", r->domain_name); ndr->depth++; @@ -6162,7 +6319,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char ndr_print_string(ndr, "forest_name", r->forest_name); } ndr->depth--; - ndr_print_uint32(ndr, "dc_flags", r->dc_flags); + ndr_print_netr_DsR_DcFlags(ndr, "dc_flags", r->dc_flags); ndr_print_ptr(ndr, "dc_site_name", r->dc_site_name); ndr->depth++; if (r->dc_site_name) { @@ -6178,66 +6335,6 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char ndr->depth--; } -static enum ndr_err_code ndr_push_netr_Blob(struct ndr_push *ndr, int ndr_flags, const struct netr_Blob *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); - } - if (ndr_flags & NDR_BUFFERS) { - if (r->data) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); - } - } - return NDR_ERR_SUCCESS; -} - -static enum ndr_err_code ndr_pull_netr_Blob(struct ndr_pull *ndr, int ndr_flags, struct netr_Blob *r) -{ - uint32_t _ptr_data; - TALLOC_CTX *_mem_save_data_0; - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); - if (_ptr_data) { - NDR_PULL_ALLOC(ndr, r->data); - } else { - r->data = NULL; - } - } - if (ndr_flags & NDR_BUFFERS) { - if (r->data) { - _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); - NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); - NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data))); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); - } - if (r->data) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length)); - } - } - return NDR_ERR_SUCCESS; -} - -_PUBLIC_ void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r) -{ - ndr_print_struct(ndr, name, "netr_Blob"); - ndr->depth++; - ndr_print_uint32(ndr, "length", r->length); - ndr_print_ptr(ndr, "data", r->data); - ndr->depth++; - if (r->data) { - ndr_print_array_uint8(ndr, "data", r->data, r->length); - } - ndr->depth--; - ndr->depth--; -} - static enum ndr_err_code ndr_push_netr_BinaryString(struct ndr_push *ndr, int ndr_flags, const struct netr_BinaryString *r) { uint32_t cntr_data_1; @@ -7157,6 +7254,153 @@ _PUBLIC_ void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *na } } +static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesWCtr(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddressToSitenamesWCtr *r) +{ + uint32_t cntr_sitename_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->sitename)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sitename) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1])); + } + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesWCtr(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddressToSitenamesWCtr *r) +{ + uint32_t _ptr_sitename; + uint32_t cntr_sitename_1; + TALLOC_CTX *_mem_save_sitename_0; + TALLOC_CTX *_mem_save_sitename_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sitename)); + if (_ptr_sitename) { + NDR_PULL_ALLOC(ndr, r->sitename); + } else { + r->sitename = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sitename) { + _mem_save_sitename_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->sitename)); + NDR_PULL_ALLOC_N(ndr, r->sitename, ndr_get_array_size(ndr, &r->sitename)); + _mem_save_sitename_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0); + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1])); + } + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_0, 0); + } + if (r->sitename) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sitename, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r) +{ + uint32_t cntr_sitename_1; + ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesWCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "sitename", r->sitename); + ndr->depth++; + if (r->sitename) { + ndr->print(ndr, "%s: ARRAY(%d)", "sitename", r->count); + ndr->depth++; + for (cntr_sitename_1=0;cntr_sitename_1count;cntr_sitename_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_sitename_1); + if (idx_1) { + ndr_print_lsa_String(ndr, "sitename", &r->sitename[cntr_sitename_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_netr_DsRAddress(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddress *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->buffer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->buffer, r->size)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsRAddress(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddress *r) +{ + uint32_t _ptr_buffer; + TALLOC_CTX *_mem_save_buffer_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->buffer); + } else { + r->buffer = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->buffer)); + NDR_PULL_ALLOC_N(ndr, r->buffer, ndr_get_array_size(ndr, &r->buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->buffer, ndr_get_array_size(ndr, &r->buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + if (r->buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->buffer, r->size)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r) +{ + ndr_print_struct(ndr, name, "netr_DsRAddress"); + ndr->depth++; + ndr_print_ptr(ndr, "buffer", r->buffer); + ndr->depth++; + if (r->buffer) { + ndr_print_array_uint8(ndr, "buffer", r->buffer, r->size); + } + ndr->depth--; + ndr_print_uint32(ndr, "size", r->size); + ndr->depth--; +} + static enum ndr_err_code ndr_push_netr_TrustFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); @@ -7373,13 +7617,331 @@ _PUBLIC_ void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name ndr->depth--; } -static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int flags, const struct netr_LogonUasLogon *r) +static enum ndr_err_code ndr_push_netr_DomainTrustList(struct ndr_push *ndr, int ndr_flags, const struct netr_DomainTrustList *r) { - if (flags & NDR_IN) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); - if (r->in.server_name) { - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + uint32_t cntr_array_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->array)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->array) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { + NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_SCALARS, &r->array[cntr_array_1])); + } + for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { + NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_BUFFERS, &r->array[cntr_array_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DomainTrustList(struct ndr_pull *ndr, int ndr_flags, struct netr_DomainTrustList *r) +{ + uint32_t _ptr_array; + uint32_t cntr_array_1; + TALLOC_CTX *_mem_save_array_0; + TALLOC_CTX *_mem_save_array_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array)); + if (_ptr_array) { + NDR_PULL_ALLOC(ndr, r->array); + } else { + r->array = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->array) { + _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->array, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->array)); + NDR_PULL_ALLOC_N(ndr, r->array, ndr_get_array_size(ndr, &r->array)); + _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->array, 0); + for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { + NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_SCALARS, &r->array[cntr_array_1])); + } + for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) { + NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_BUFFERS, &r->array[cntr_array_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0); + } + if (r->array) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->array, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r) +{ + uint32_t cntr_array_1; + ndr_print_struct(ndr, name, "netr_DomainTrustList"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "array", r->array); + ndr->depth++; + if (r->array) { + ndr->print(ndr, "%s: ARRAY(%d)", "array", r->count); + ndr->depth++; + for (cntr_array_1=0;cntr_array_1count;cntr_array_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_array_1); + if (idx_1) { + ndr_print_netr_DomainTrust(ndr, "array", &r->array[cntr_array_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesExWCtr(struct ndr_push *ndr, int ndr_flags, const struct netr_DsRAddressToSitenamesExWCtr *r) +{ + uint32_t cntr_sitename_1; + uint32_t cntr_subnetname_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->sitename)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->subnetname)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sitename) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1])); + } + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1])); + } + } + if (r->subnetname) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->subnetname[cntr_subnetname_1])); + } + for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->subnetname[cntr_subnetname_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesExWCtr(struct ndr_pull *ndr, int ndr_flags, struct netr_DsRAddressToSitenamesExWCtr *r) +{ + uint32_t _ptr_sitename; + uint32_t cntr_sitename_1; + TALLOC_CTX *_mem_save_sitename_0; + TALLOC_CTX *_mem_save_sitename_1; + uint32_t _ptr_subnetname; + uint32_t cntr_subnetname_1; + TALLOC_CTX *_mem_save_subnetname_0; + TALLOC_CTX *_mem_save_subnetname_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sitename)); + if (_ptr_sitename) { + NDR_PULL_ALLOC(ndr, r->sitename); + } else { + r->sitename = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_subnetname)); + if (_ptr_subnetname) { + NDR_PULL_ALLOC(ndr, r->subnetname); + } else { + r->subnetname = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sitename) { + _mem_save_sitename_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->sitename)); + NDR_PULL_ALLOC_N(ndr, r->sitename, ndr_get_array_size(ndr, &r->sitename)); + _mem_save_sitename_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sitename, 0); + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sitename[cntr_sitename_1])); + } + for (cntr_sitename_1 = 0; cntr_sitename_1 < r->count; cntr_sitename_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sitename[cntr_sitename_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sitename_0, 0); + } + if (r->subnetname) { + _mem_save_subnetname_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->subnetname, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->subnetname)); + NDR_PULL_ALLOC_N(ndr, r->subnetname, ndr_get_array_size(ndr, &r->subnetname)); + _mem_save_subnetname_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->subnetname, 0); + for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->subnetname[cntr_subnetname_1])); + } + for (cntr_subnetname_1 = 0; cntr_subnetname_1 < r->count; cntr_subnetname_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->subnetname[cntr_subnetname_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_subnetname_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_subnetname_0, 0); + } + if (r->sitename) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sitename, r->count)); + } + if (r->subnetname) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->subnetname, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r) +{ + uint32_t cntr_sitename_1; + uint32_t cntr_subnetname_1; + ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesExWCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "sitename", r->sitename); + ndr->depth++; + if (r->sitename) { + ndr->print(ndr, "%s: ARRAY(%d)", "sitename", r->count); + ndr->depth++; + for (cntr_sitename_1=0;cntr_sitename_1count;cntr_sitename_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_sitename_1); + if (idx_1) { + ndr_print_lsa_String(ndr, "sitename", &r->sitename[cntr_sitename_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr_print_ptr(ndr, "subnetname", r->subnetname); + ndr->depth++; + if (r->subnetname) { + ndr->print(ndr, "%s: ARRAY(%d)", "subnetname", r->count); + ndr->depth++; + for (cntr_subnetname_1=0;cntr_subnetname_1count;cntr_subnetname_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_subnetname_1); + if (idx_1) { + ndr_print_lsa_String(ndr, "subnetname", &r->subnetname[cntr_subnetname_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_DcSitesCtr(struct ndr_push *ndr, int ndr_flags, const struct DcSitesCtr *r) +{ + uint32_t cntr_sites_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sites)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->sites)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sites) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sites)); + for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->sites[cntr_sites_1])); + } + for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->sites[cntr_sites_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_DcSitesCtr(struct ndr_pull *ndr, int ndr_flags, struct DcSitesCtr *r) +{ + uint32_t _ptr_sites; + uint32_t cntr_sites_1; + TALLOC_CTX *_mem_save_sites_0; + TALLOC_CTX *_mem_save_sites_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sites)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sites)); + if (_ptr_sites) { + NDR_PULL_ALLOC(ndr, r->sites); + } else { + r->sites = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->sites) { + _mem_save_sites_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sites, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->sites)); + NDR_PULL_ALLOC_N(ndr, r->sites, ndr_get_array_size(ndr, &r->sites)); + _mem_save_sites_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->sites, 0); + for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->sites[cntr_sites_1])); + } + for (cntr_sites_1 = 0; cntr_sites_1 < r->num_sites; cntr_sites_1++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->sites[cntr_sites_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sites_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sites_0, 0); + } + if (r->sites) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sites, r->num_sites)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r) +{ + uint32_t cntr_sites_1; + ndr_print_struct(ndr, name, "DcSitesCtr"); + ndr->depth++; + ndr_print_uint32(ndr, "num_sites", r->num_sites); + ndr_print_ptr(ndr, "sites", r->sites); + ndr->depth++; + if (r->sites) { + ndr->print(ndr, "%s: ARRAY(%d)", "sites", r->num_sites); + ndr->depth++; + for (cntr_sites_1=0;cntr_sites_1num_sites;cntr_sites_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_sites_1); + if (idx_1) { + ndr_print_lsa_String(ndr, "sites", &r->sites[cntr_sites_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int flags, const struct netr_LogonUasLogon *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } @@ -7393,10 +7955,10 @@ static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int f NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.workstation, ndr_charset_length(r->in.workstation, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); - if (r->out.info) { - NDR_CHECK(ndr_push_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -7405,7 +7967,6 @@ static enum ndr_err_code ndr_push_netr_LogonUasLogon(struct ndr_push *ndr, int f static enum ndr_err_code ndr_pull_netr_LogonUasLogon(struct ndr_pull *ndr, int flags, struct netr_LogonUasLogon *r) { uint32_t _ptr_server_name; - uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_name_0; TALLOC_CTX *_mem_save_info_0; if (flags & NDR_IN) { @@ -7443,20 +8004,17 @@ static enum ndr_err_code ndr_pull_netr_LogonUasLogon(struct ndr_pull *ndr, int f } NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.workstation), sizeof(uint16_t))); NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.workstation, ndr_get_array_length(ndr, &r->in.workstation), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); - if (_ptr_info) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.info); - } else { - r->out.info = NULL; - } - if (r->out.info) { - _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); - NDR_CHECK(ndr_pull_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_UasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -7487,9 +8045,7 @@ _PUBLIC_ void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *na ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - if (r->out.info) { - ndr_print_netr_UasInfo(ndr, "info", r->out.info); - } + ndr_print_netr_UasInfo(ndr, "info", r->out.info); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -8449,10 +9005,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseDeltas(struct ndr_push *ndr, int return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, *r->out.sequence_num)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array)); - if (r->out.delta_enum_array) { - NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + if (r->out.delta_enum_array == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -8460,7 +9016,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseDeltas(struct ndr_push *ndr, int static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int flags, struct netr_DatabaseDeltas *r) { - uint32_t _ptr_delta_enum_array; TALLOC_CTX *_mem_save_return_authenticator_0; TALLOC_CTX *_mem_save_sequence_num_0; TALLOC_CTX *_mem_save_delta_enum_array_0; @@ -8502,6 +9057,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int *r->out.return_authenticator = *r->in.return_authenticator; NDR_PULL_ALLOC(ndr, r->out.sequence_num); *r->out.sequence_num = *r->in.sequence_num; + NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); + ZERO_STRUCTP(r->out.delta_enum_array); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { @@ -8518,18 +9075,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseDeltas(struct ndr_pull *ndr, int NDR_PULL_SET_MEM_CTX(ndr, r->out.sequence_num, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, r->out.sequence_num)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sequence_num_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array)); - if (_ptr_delta_enum_array) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); - } else { - r->out.delta_enum_array = NULL; - } - if (r->out.delta_enum_array) { - _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0); - NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0); } + _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -8573,9 +9125,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseDeltas(struct ndr_print *ndr, const char *n ndr->depth--; ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth++; - if (r->out.delta_enum_array) { - ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); - } + ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -8615,10 +9165,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync(struct ndr_push *ndr, int fl return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.sync_context)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array)); - if (r->out.delta_enum_array) { - NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + if (r->out.delta_enum_array == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -8626,7 +9176,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync(struct ndr_push *ndr, int fl static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int flags, struct netr_DatabaseSync *r) { - uint32_t _ptr_delta_enum_array; TALLOC_CTX *_mem_save_return_authenticator_0; TALLOC_CTX *_mem_save_sync_context_0; TALLOC_CTX *_mem_save_delta_enum_array_0; @@ -8668,6 +9217,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int fl *r->out.return_authenticator = *r->in.return_authenticator; NDR_PULL_ALLOC(ndr, r->out.sync_context); *r->out.sync_context = *r->in.sync_context; + NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); + ZERO_STRUCTP(r->out.delta_enum_array); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { @@ -8684,18 +9235,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync(struct ndr_pull *ndr, int fl NDR_PULL_SET_MEM_CTX(ndr, r->out.sync_context, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.sync_context)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sync_context_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array)); - if (_ptr_delta_enum_array) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); - } else { - r->out.delta_enum_array = NULL; - } - if (r->out.delta_enum_array) { - _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0); - NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0); } + _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -8739,9 +9285,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseSync(struct ndr_print *ndr, const char *nam ndr->depth--; ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth++; - if (r->out.delta_enum_array) { - ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); - } + ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -9898,10 +10442,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync2(struct ndr_push *ndr, int f return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.sync_context)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array)); - if (r->out.delta_enum_array) { - NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + if (r->out.delta_enum_array == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -9909,7 +10453,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseSync2(struct ndr_push *ndr, int f static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int flags, struct netr_DatabaseSync2 *r) { - uint32_t _ptr_delta_enum_array; TALLOC_CTX *_mem_save_return_authenticator_0; TALLOC_CTX *_mem_save_sync_context_0; TALLOC_CTX *_mem_save_delta_enum_array_0; @@ -9952,6 +10495,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int f *r->out.return_authenticator = *r->in.return_authenticator; NDR_PULL_ALLOC(ndr, r->out.sync_context); *r->out.sync_context = *r->in.sync_context; + NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); + ZERO_STRUCTP(r->out.delta_enum_array); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { @@ -9968,18 +10513,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseSync2(struct ndr_pull *ndr, int f NDR_PULL_SET_MEM_CTX(ndr, r->out.sync_context, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.sync_context)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sync_context_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array)); - if (_ptr_delta_enum_array) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); - } else { - r->out.delta_enum_array = NULL; - } - if (r->out.delta_enum_array) { - _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0); - NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0); } + _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -10024,9 +10564,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *na ndr->depth--; ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth++; - if (r->out.delta_enum_array) { - ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); - } + ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -10062,10 +10600,10 @@ static enum ndr_err_code ndr_push_netr_DatabaseRedo(struct ndr_push *ndr, int fl return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.delta_enum_array)); - if (r->out.delta_enum_array) { - NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + if (r->out.delta_enum_array == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10074,7 +10612,6 @@ static enum ndr_err_code ndr_push_netr_DatabaseRedo(struct ndr_push *ndr, int fl static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int flags, struct netr_DatabaseRedo *r) { uint32_t _ptr_change_log_entry; - uint32_t _ptr_delta_enum_array; TALLOC_CTX *_mem_save_return_authenticator_0; TALLOC_CTX *_mem_save_change_log_entry_0; TALLOC_CTX *_mem_save_delta_enum_array_0; @@ -10120,6 +10657,8 @@ static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int fl NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.change_log_entry_size)); NDR_PULL_ALLOC(ndr, r->out.return_authenticator); *r->out.return_authenticator = *r->in.return_authenticator; + NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); + ZERO_STRUCTP(r->out.delta_enum_array); if (r->in.change_log_entry) { NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.change_log_entry, r->in.change_log_entry_size)); } @@ -10132,18 +10671,13 @@ static enum ndr_err_code ndr_pull_netr_DatabaseRedo(struct ndr_pull *ndr, int fl NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_delta_enum_array)); - if (_ptr_delta_enum_array) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.delta_enum_array); - } else { - r->out.delta_enum_array = NULL; - } - if (r->out.delta_enum_array) { - _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, 0); - NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, 0); } + _mem_save_delta_enum_array_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.delta_enum_array, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DELTA_ENUM_ARRAY(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.delta_enum_array)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_delta_enum_array_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -10184,9 +10718,7 @@ _PUBLIC_ void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *nam ndr->depth--; ndr_print_ptr(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth++; - if (r->out.delta_enum_array) { - ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); - } + ndr_print_netr_DELTA_ENUM_ARRAY(ndr, "delta_enum_array", r->out.delta_enum_array); ndr->depth--; ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; @@ -10303,41 +10835,94 @@ _PUBLIC_ void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char * ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_push *ndr, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r) +static enum ndr_err_code ndr_push_netr_NetrEnumerateTrustedDomains(struct ndr_push *ndr, int flags, const struct netr_NetrEnumerateTrustedDomains *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } if (flags & NDR_OUT) { + if (r->out.trusted_domains_blob == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Blob(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusted_domains_blob)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_pull *ndr, int flags, struct netr_NETRENUMERATETRUSTEDDOMAINS *r) +static enum ndr_err_code ndr_pull_netr_NetrEnumerateTrustedDomains(struct ndr_pull *ndr, int flags, struct netr_NetrEnumerateTrustedDomains *r) { + uint32_t _ptr_server_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_trusted_domains_blob_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.trusted_domains_blob); + ZERO_STRUCTP(r->out.trusted_domains_blob); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.trusted_domains_blob); + } + _mem_save_trusted_domains_blob_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.trusted_domains_blob, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Blob(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusted_domains_blob)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domains_blob_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r) +_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomains *r) { - ndr_print_struct(ndr, name, "netr_NETRENUMERATETRUSTEDDOMAINS"); + ndr_print_struct(ndr, name, "netr_NetrEnumerateTrustedDomains"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRENUMERATETRUSTEDDOMAINS"); + ndr_print_struct(ndr, "in", "netr_NetrEnumerateTrustedDomains"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRENUMERATETRUSTEDDOMAINS"); + ndr_print_struct(ndr, "out", "netr_NetrEnumerateTrustedDomains"); + ndr->depth++; + ndr_print_ptr(ndr, "trusted_domains_blob", r->out.trusted_domains_blob); ndr->depth++; + ndr_print_netr_Blob(ndr, "trusted_domains_blob", r->out.trusted_domains_blob); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -10369,13 +10954,13 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCName(struct ndr_push *ndr, int fl if (r->in.site_guid) { NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid)); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); + NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); - if (r->out.info) { - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10387,7 +10972,6 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_guid; - uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_domain_name_0; TALLOC_CTX *_mem_save_domain_guid_0; @@ -10456,21 +11040,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCName(struct ndr_pull *ndr, int fl NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.site_guid)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_guid_0, 0); } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); - if (_ptr_info) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.info); - } else { - r->out.info = NULL; - } - if (r->out.info) { - _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -10510,7 +11091,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *nam ndr_print_GUID(ndr, "site_guid", r->in.site_guid); } ndr->depth--; - ndr_print_uint32(ndr, "flags", r->in.flags); + ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { @@ -10518,9 +11099,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *nam ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - if (r->out.info) { - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); - } + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -10948,13 +11527,13 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.site_name, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.site_name, ndr_charset_length(r->in.site_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); + NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); - if (r->out.info) { - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -10966,7 +11545,6 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_name; - uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_domain_name_0; TALLOC_CTX *_mem_save_domain_guid_0; @@ -11041,21 +11619,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.site_name, ndr_get_array_length(ndr, &r->in.site_name), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_name_0, 0); } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); - if (_ptr_info) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.info); - } else { - r->out.info = NULL; - } - if (r->out.info) { - _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -11095,7 +11670,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n ndr_print_string(ndr, "site_name", r->in.site_name); } ndr->depth--; - ndr_print_uint32(ndr, "flags", r->in.flags); + ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { @@ -11103,9 +11678,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *n ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - if (r->out.info) { - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); - } + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -11519,41 +12092,155 @@ _PUBLIC_ void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const cha ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRSERVERPASSWORDGET(struct ndr_push *ndr, int flags, const struct netr_NETRSERVERPASSWORDGET *r) +static enum ndr_err_code ndr_push_netr_ServerPasswordGet(struct ndr_push *ndr, int flags, const struct netr_ServerPasswordGet *r) { if (flags & NDR_IN) { - } - if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); - } - return NDR_ERR_SUCCESS; + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.account_name, ndr_charset_length(r->in.account_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_netr_SchannelType(ndr, NDR_SCALARS, r->in.secure_channel_type)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.computer_name, ndr_charset_length(r->in.computer_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->in.credential == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); + } + if (flags & NDR_OUT) { + if (r->out.return_authenticator == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + if (r->out.password == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password)); + NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRSERVERPASSWORDGET(struct ndr_pull *ndr, int flags, struct netr_NETRSERVERPASSWORDGET *r) +static enum ndr_err_code ndr_pull_netr_ServerPasswordGet(struct ndr_pull *ndr, int flags, struct netr_ServerPasswordGet *r) { + uint32_t _ptr_server_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_credential_0; + TALLOC_CTX *_mem_save_return_authenticator_0; + TALLOC_CTX *_mem_save_password_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.account_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.account_name)); + if (ndr_get_array_length(ndr, &r->in.account_name) > ndr_get_array_size(ndr, &r->in.account_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.account_name), ndr_get_array_length(ndr, &r->in.account_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.account_name, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_netr_SchannelType(ndr, NDR_SCALARS, &r->in.secure_channel_type)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.computer_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.computer_name)); + if (ndr_get_array_length(ndr, &r->in.computer_name) > ndr_get_array_size(ndr, &r->in.computer_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.computer_name), ndr_get_array_length(ndr, &r->in.computer_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.computer_name, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t), CH_UTF16)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.credential); + } + _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + ZERO_STRUCTP(r->out.return_authenticator); + NDR_PULL_ALLOC(ndr, r->out.password); + ZERO_STRUCTP(r->out.password); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + } + _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.password); + } + _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.password, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRSERVERPASSWORDGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERPASSWORDGET *r) +_PUBLIC_ void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r) { - ndr_print_struct(ndr, name, "netr_NETRSERVERPASSWORDGET"); + ndr_print_struct(ndr, name, "netr_ServerPasswordGet"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRSERVERPASSWORDGET"); + ndr_print_struct(ndr, "in", "netr_ServerPasswordGet"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_string(ndr, "account_name", r->in.account_name); + ndr_print_netr_SchannelType(ndr, "secure_channel_type", r->in.secure_channel_type); + ndr_print_string(ndr, "computer_name", r->in.computer_name); + ndr_print_ptr(ndr, "credential", r->in.credential); ndr->depth++; + ndr_print_netr_Authenticator(ndr, "credential", r->in.credential); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRSERVERPASSWORDGET"); + ndr_print_struct(ndr, "out", "netr_ServerPasswordGet"); + ndr->depth++; + ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator); ndr->depth++; + ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator); + ndr->depth--; + ndr_print_ptr(ndr, "password", r->out.password); + ndr->depth++; + ndr_print_samr_Password(ndr, "password", r->out.password); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -11601,41 +12288,160 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const cha ndr->depth--; } -static enum ndr_err_code ndr_push_netr_DSRADDRESSTOSITENAMESW(struct ndr_push *ndr, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r) +static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesW(struct ndr_push *ndr, int flags, const struct netr_DsRAddressToSitenamesW *r) { + uint32_t cntr_addresses_1; if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count)); + if (r->in.addresses == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count)); + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1])); + } + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1])); + } } if (flags & NDR_OUT) { + if (r->out.ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_DSRADDRESSTOSITENAMESW(struct ndr_pull *ndr, int flags, struct netr_DSRADDRESSTOSITENAMESW *r) +static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesW(struct ndr_pull *ndr, int flags, struct netr_DsRAddressToSitenamesW *r) { + uint32_t _ptr_server_name; + uint32_t cntr_addresses_1; + uint32_t _ptr_ctr; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_addresses_1; + TALLOC_CTX *_mem_save_ctr_0; + TALLOC_CTX *_mem_save_ctr_1; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.count)); + if (r->in.count < 0 || r->in.count > 32000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.addresses)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->in.addresses, ndr_get_array_size(ndr, &r->in.addresses)); + } + _mem_save_addresses_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.addresses, 0); + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1])); + } + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_1, 0); + NDR_PULL_ALLOC(ndr, r->out.ctr); + ZERO_STRUCTP(r->out.ctr); + if (r->in.addresses) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.addresses, r->in.count)); + } } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.ctr); + } + _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.ctr); + } + _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_DSRADDRESSTOSITENAMESW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r) +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesW *r) { - ndr_print_struct(ndr, name, "netr_DSRADDRESSTOSITENAMESW"); + uint32_t cntr_addresses_1; + ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesW"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_DSRADDRESSTOSITENAMESW"); + ndr_print_struct(ndr, "in", "netr_DsRAddressToSitenamesW"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "count", r->in.count); + ndr_print_ptr(ndr, "addresses", r->in.addresses); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->in.count); ndr->depth++; + for (cntr_addresses_1=0;cntr_addresses_1in.count;cntr_addresses_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_addresses_1); + if (idx_1) { + ndr_print_netr_DsRAddress(ndr, "addresses", &r->in.addresses[cntr_addresses_1]); + free(idx_1); + } + } + ndr->depth--; + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_DSRADDRESSTOSITENAMESW"); + ndr_print_struct(ndr, "out", "netr_DsRAddressToSitenamesW"); + ndr->depth++; + ndr_print_ptr(ndr, "ctr", r->out.ctr); ndr->depth++; + ndr_print_ptr(ndr, "ctr", *r->out.ctr); + ndr->depth++; + ndr_print_netr_DsRAddressToSitenamesWCtr(ndr, "ctr", *r->out.ctr); + ndr->depth--; + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -11659,7 +12465,7 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.client_account, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.client_account, ndr_charset_length(r->in.client_account, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.mask)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.mask)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name)); if (r->in.domain_name) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.domain_name, CH_UTF16))); @@ -11678,13 +12484,13 @@ static enum ndr_err_code ndr_push_netr_DsRGetDCNameEx2(struct ndr_push *ndr, int NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.site_name, CH_UTF16))); NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.site_name, ndr_charset_length(r->in.site_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); + NDR_CHECK(ndr_push_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info)); - if (r->out.info) { - NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -11697,7 +12503,6 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int uint32_t _ptr_domain_name; uint32_t _ptr_domain_guid; uint32_t _ptr_site_name; - uint32_t _ptr_info; TALLOC_CTX *_mem_save_server_unc_0; TALLOC_CTX *_mem_save_client_account_0; TALLOC_CTX *_mem_save_domain_name_0; @@ -11743,7 +12548,7 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.client_account, ndr_get_array_length(ndr, &r->in.client_account), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_client_account_0, 0); } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.mask)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.mask)); NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name)); if (_ptr_domain_name) { NDR_PULL_ALLOC(ndr, r->in.domain_name); @@ -11792,21 +12597,18 @@ static enum ndr_err_code ndr_pull_netr_DsRGetDCNameEx2(struct ndr_pull *ndr, int NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.site_name, ndr_get_array_length(ndr, &r->in.site_name), sizeof(uint16_t), CH_UTF16)); NDR_PULL_SET_MEM_CTX(ndr, _mem_save_site_name_0, 0); } - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_CHECK(ndr_pull_netr_DsRGetDCName_flags(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_info)); - if (_ptr_info) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { NDR_PULL_ALLOC(ndr, r->out.info); - } else { - r->out.info = NULL; - } - if (r->out.info) { - _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0); - NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0); } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRGetDCNameInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; @@ -11834,7 +12636,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char * ndr_print_string(ndr, "client_account", r->in.client_account); } ndr->depth--; - ndr_print_uint32(ndr, "mask", r->in.mask); + ndr_print_samr_AcctFlags(ndr, "mask", r->in.mask); ndr_print_ptr(ndr, "domain_name", r->in.domain_name); ndr->depth++; if (r->in.domain_name) { @@ -11853,7 +12655,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char * ndr_print_string(ndr, "site_name", r->in.site_name); } ndr->depth--; - ndr_print_uint32(ndr, "flags", r->in.flags); + ndr_print_netr_DsRGetDCName_flags(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { @@ -11861,9 +12663,7 @@ _PUBLIC_ void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char * ndr->depth++; ndr_print_ptr(ndr, "info", r->out.info); ndr->depth++; - if (r->out.info) { - ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); - } + ndr_print_netr_DsRGetDCNameInfo(ndr, "info", r->out.info); ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; @@ -11912,123 +12712,348 @@ _PUBLIC_ void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_prin ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_push *ndr, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r) +static enum ndr_err_code ndr_push_netr_NetrEnumerateTrustedDomainsEx(struct ndr_push *ndr, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } if (flags & NDR_OUT) { + if (r->out.dom_trust_list == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.dom_trust_list)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_pull *ndr, int flags, struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r) +static enum ndr_err_code ndr_pull_netr_NetrEnumerateTrustedDomainsEx(struct ndr_pull *ndr, int flags, struct netr_NetrEnumerateTrustedDomainsEx *r) { + uint32_t _ptr_server_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_dom_trust_list_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.dom_trust_list); + ZERO_STRUCTP(r->out.dom_trust_list); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.dom_trust_list); + } + _mem_save_dom_trust_list_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.dom_trust_list, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.dom_trust_list)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dom_trust_list_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r) +_PUBLIC_ void ndr_print_netr_NetrEnumerateTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r) { - ndr_print_struct(ndr, name, "netr_NETRENUMERATETRUSTEDDOMAINSEX"); + ndr_print_struct(ndr, name, "netr_NetrEnumerateTrustedDomainsEx"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRENUMERATETRUSTEDDOMAINSEX"); + ndr_print_struct(ndr, "in", "netr_NetrEnumerateTrustedDomainsEx"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRENUMERATETRUSTEDDOMAINSEX"); + ndr_print_struct(ndr, "out", "netr_NetrEnumerateTrustedDomainsEx"); ndr->depth++; + ndr_print_ptr(ndr, "dom_trust_list", r->out.dom_trust_list); + ndr->depth++; + ndr_print_netr_DomainTrustList(ndr, "dom_trust_list", r->out.dom_trust_list); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } ndr->depth--; } -static enum ndr_err_code ndr_push_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_push *ndr, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r) +static enum ndr_err_code ndr_push_netr_DsRAddressToSitenamesExW(struct ndr_push *ndr, int flags, const struct netr_DsRAddressToSitenamesExW *r) { + uint32_t cntr_addresses_1; if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count)); + if (r->in.addresses == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.count)); + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1])); + } + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_push_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1])); + } } if (flags & NDR_OUT) { + if (r->out.ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_pull *ndr, int flags, struct netr_DSRADDRESSTOSITENAMESEXW *r) +static enum ndr_err_code ndr_pull_netr_DsRAddressToSitenamesExW(struct ndr_pull *ndr, int flags, struct netr_DsRAddressToSitenamesExW *r) { + uint32_t _ptr_server_name; + uint32_t cntr_addresses_1; + uint32_t _ptr_ctr; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_addresses_1; + TALLOC_CTX *_mem_save_ctr_0; + TALLOC_CTX *_mem_save_ctr_1; if (flags & NDR_IN) { - } - if (flags & NDR_OUT) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.count)); + if (r->in.count < 0 || r->in.count > 32000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.addresses)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC_N(ndr, r->in.addresses, ndr_get_array_size(ndr, &r->in.addresses)); + } + _mem_save_addresses_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.addresses, 0); + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_SCALARS, &r->in.addresses[cntr_addresses_1])); + } + for (cntr_addresses_1 = 0; cntr_addresses_1 < r->in.count; cntr_addresses_1++) { + NDR_CHECK(ndr_pull_netr_DsRAddress(ndr, NDR_BUFFERS, &r->in.addresses[cntr_addresses_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_addresses_1, 0); + NDR_PULL_ALLOC(ndr, r->out.ctr); + ZERO_STRUCTP(r->out.ctr); + if (r->in.addresses) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.addresses, r->in.count)); + } + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.ctr); + } + _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_ctr)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.ctr); + } + _mem_save_ctr_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DsRAddressToSitenamesExWCtr(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r) +_PUBLIC_ void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r) { - ndr_print_struct(ndr, name, "netr_DSRADDRESSTOSITENAMESEXW"); + uint32_t cntr_addresses_1; + ndr_print_struct(ndr, name, "netr_DsRAddressToSitenamesExW"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_DSRADDRESSTOSITENAMESEXW"); + ndr_print_struct(ndr, "in", "netr_DsRAddressToSitenamesExW"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "count", r->in.count); + ndr_print_ptr(ndr, "addresses", r->in.addresses); + ndr->depth++; + ndr->print(ndr, "%s: ARRAY(%d)", "addresses", r->in.count); ndr->depth++; + for (cntr_addresses_1=0;cntr_addresses_1in.count;cntr_addresses_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_addresses_1); + if (idx_1) { + ndr_print_netr_DsRAddress(ndr, "addresses", &r->in.addresses[cntr_addresses_1]); + free(idx_1); + } + } + ndr->depth--; + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_DSRADDRESSTOSITENAMESEXW"); + ndr_print_struct(ndr, "out", "netr_DsRAddressToSitenamesExW"); + ndr->depth++; + ndr_print_ptr(ndr, "ctr", r->out.ctr); + ndr->depth++; + ndr_print_ptr(ndr, "ctr", *r->out.ctr); ndr->depth++; + ndr_print_netr_DsRAddressToSitenamesExWCtr(ndr, "ctr", *r->out.ctr); + ndr->depth--; + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } ndr->depth--; } -static enum ndr_err_code ndr_push_netr_DSRGETDCSITECOVERAGEW(struct ndr_push *ndr, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r) +static enum ndr_err_code ndr_push_netr_DsrGetDcSiteCoverageW(struct ndr_push *ndr, int flags, const struct netr_DsrGetDcSiteCoverageW *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } } if (flags & NDR_OUT) { + if (r->out.ctr == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_DSRGETDCSITECOVERAGEW(struct ndr_pull *ndr, int flags, struct netr_DSRGETDCSITECOVERAGEW *r) +static enum ndr_err_code ndr_pull_netr_DsrGetDcSiteCoverageW(struct ndr_pull *ndr, int flags, struct netr_DsrGetDcSiteCoverageW *r) { + uint32_t _ptr_server_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_ctr_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.ctr); + ZERO_STRUCTP(r->out.ctr); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.ctr); + } + _mem_save_ctr_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.ctr, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_DcSitesCtr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ctr_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_DSRGETDCSITECOVERAGEW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r) +_PUBLIC_ void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r) { - ndr_print_struct(ndr, name, "netr_DSRGETDCSITECOVERAGEW"); + ndr_print_struct(ndr, name, "netr_DsrGetDcSiteCoverageW"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_DSRGETDCSITECOVERAGEW"); + ndr_print_struct(ndr, "in", "netr_DsrGetDcSiteCoverageW"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_DSRGETDCSITECOVERAGEW"); + ndr_print_struct(ndr, "out", "netr_DsrGetDcSiteCoverageW"); + ndr->depth++; + ndr_print_ptr(ndr, "ctr", r->out.ctr); ndr->depth++; + ndr_print_DcSitesCtr(ndr, "ctr", r->out.ctr); + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -12230,7 +13255,6 @@ _PUBLIC_ void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char * static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push *ndr, int flags, const struct netr_DsrEnumerateDomainTrusts *r) { - uint32_t cntr_trusts_1; if (flags & NDR_IN) { NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); if (r->in.server_name) { @@ -12242,23 +13266,14 @@ static enum ndr_err_code ndr_push_netr_DsrEnumerateDomainTrusts(struct ndr_push NDR_CHECK(ndr_push_netr_TrustFlags(ndr, NDR_SCALARS, r->in.trust_flags)); } if (flags & NDR_OUT) { - if (r->out.count == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.count)); if (r->out.trusts == NULL) { return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.count)); - for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) { - if (r->out.trusts[cntr_trusts_1] == NULL) { - return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); - } - NDR_CHECK(ndr_push_ref_ptr(ndr)); - } - for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) { - NDR_CHECK(ndr_push_netr_DomainTrust(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts[cntr_trusts_1])); + if (*r->out.trusts == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.trusts)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; @@ -12268,11 +13283,9 @@ static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull { uint32_t _ptr_server_name; uint32_t _ptr_trusts; - uint32_t cntr_trusts_1; TALLOC_CTX *_mem_save_server_name_0; - TALLOC_CTX *_mem_save_count_0; + TALLOC_CTX *_mem_save_trusts_0; TALLOC_CTX *_mem_save_trusts_1; - TALLOC_CTX *_mem_save_trusts_2; if (flags & NDR_IN) { ZERO_STRUCT(r->out); @@ -12295,49 +13308,31 @@ static enum ndr_err_code ndr_pull_netr_DsrEnumerateDomainTrusts(struct ndr_pull NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); } NDR_CHECK(ndr_pull_netr_TrustFlags(ndr, NDR_SCALARS, &r->in.trust_flags)); - NDR_PULL_ALLOC(ndr, r->out.count); - ZERO_STRUCTP(r->out.count); - NDR_PULL_ALLOC_N(ndr, r->out.trusts, count); - memset(r->out.trusts, 0, count * sizeof(*r->out.trusts)); + NDR_PULL_ALLOC(ndr, r->out.trusts); + ZERO_STRUCTP(r->out.trusts); } if (flags & NDR_OUT) { if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.count); + NDR_PULL_ALLOC(ndr, r->out.trusts); } - _mem_save_count_0 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.count, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.count)); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_count_0, LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_array_size(ndr, &r->out.trusts)); + _mem_save_trusts_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_trusts)); if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC_N(ndr, r->out.trusts, ndr_get_array_size(ndr, &r->out.trusts)); + NDR_PULL_ALLOC(ndr, *r->out.trusts); } _mem_save_trusts_1 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts, 0); - for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) { - NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_trusts)); - if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { - NDR_PULL_ALLOC(ndr, r->out.trusts[cntr_trusts_1]); - } - } - for (cntr_trusts_1 = 0; cntr_trusts_1 < r->out.count; cntr_trusts_1++) { - _mem_save_trusts_2 = NDR_PULL_GET_MEM_CTX(ndr); - NDR_PULL_SET_MEM_CTX(ndr, r->out.trusts[cntr_trusts_1], LIBNDR_FLAG_REF_ALLOC); - NDR_CHECK(ndr_pull_netr_DomainTrust(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.trusts[cntr_trusts_1])); - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_2, LIBNDR_FLAG_REF_ALLOC); - } - NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.trusts, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_DomainTrustList(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.trusts)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusts_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); - if (r->out.trusts) { - NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->out.trusts, r->out.count)); - } } return NDR_ERR_SUCCESS; } _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r) { - uint32_t cntr_trusts_1; ndr_print_struct(ndr, name, "netr_DsrEnumerateDomainTrusts"); ndr->depth++; if (flags & NDR_SET_VALUES) { @@ -12358,25 +13353,11 @@ _PUBLIC_ void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, con if (flags & NDR_OUT) { ndr_print_struct(ndr, "out", "netr_DsrEnumerateDomainTrusts"); ndr->depth++; - ndr_print_ptr(ndr, "count", r->out.count); - ndr->depth++; - ndr_print_uint32(ndr, "count", *r->out.count); - ndr->depth--; ndr_print_ptr(ndr, "trusts", r->out.trusts); ndr->depth++; - ndr->print(ndr, "%s: ARRAY(%d)", "trusts", r->out.count); + ndr_print_ptr(ndr, "trusts", *r->out.trusts); ndr->depth++; - for (cntr_trusts_1=0;cntr_trusts_1out.count;cntr_trusts_1++) { - char *idx_1=NULL; - asprintf(&idx_1, "[%d]", cntr_trusts_1); - if (idx_1) { - ndr_print_ptr(ndr, "trusts", r->out.trusts[cntr_trusts_1]); - ndr->depth++; - ndr_print_netr_DomainTrust(ndr, "trusts", r->out.trusts[cntr_trusts_1]); - ndr->depth--; - free(idx_1); - } - } + ndr_print_netr_DomainTrustList(ndr, "trusts", *r->out.trusts); ndr->depth--; ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); @@ -12426,123 +13407,484 @@ _PUBLIC_ void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_push *ndr, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r) +static enum ndr_err_code ndr_push_netr_ServerTrustPasswordsGet(struct ndr_push *ndr, int flags, const struct netr_ServerTrustPasswordsGet *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.account_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.account_name, ndr_charset_length(r->in.account_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_netr_SchannelType(ndr, NDR_SCALARS, r->in.secure_channel_type)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.computer_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.computer_name, ndr_charset_length(r->in.computer_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->in.credential == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); + if (r->out.return_authenticator == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + if (r->out.password == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password)); + if (r->out.password2 == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password2)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_pull *ndr, int flags, struct netr_NETRSERVERTRUSTPASSWORDSGET *r) +static enum ndr_err_code ndr_pull_netr_ServerTrustPasswordsGet(struct ndr_pull *ndr, int flags, struct netr_ServerTrustPasswordsGet *r) { + uint32_t _ptr_server_name; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_credential_0; + TALLOC_CTX *_mem_save_return_authenticator_0; + TALLOC_CTX *_mem_save_password_0; + TALLOC_CTX *_mem_save_password2_0; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.account_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.account_name)); + if (ndr_get_array_length(ndr, &r->in.account_name) > ndr_get_array_size(ndr, &r->in.account_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.account_name), ndr_get_array_length(ndr, &r->in.account_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.account_name, ndr_get_array_length(ndr, &r->in.account_name), sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_pull_netr_SchannelType(ndr, NDR_SCALARS, &r->in.secure_channel_type)); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.computer_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.computer_name)); + if (ndr_get_array_length(ndr, &r->in.computer_name) > ndr_get_array_size(ndr, &r->in.computer_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.computer_name), ndr_get_array_length(ndr, &r->in.computer_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.computer_name, ndr_get_array_length(ndr, &r->in.computer_name), sizeof(uint16_t), CH_UTF16)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.credential); + } + _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + ZERO_STRUCTP(r->out.return_authenticator); + NDR_PULL_ALLOC(ndr, r->out.password); + ZERO_STRUCTP(r->out.password); + NDR_PULL_ALLOC(ndr, r->out.password2); + ZERO_STRUCTP(r->out.password2); } if (flags & NDR_OUT) { - NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + } + _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.password); + } + _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.password, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.password2); + } + _mem_save_password2_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.password2, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.password2)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password2_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r) +_PUBLIC_ void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r) { - ndr_print_struct(ndr, name, "netr_NETRSERVERTRUSTPASSWORDSGET"); + ndr_print_struct(ndr, name, "netr_ServerTrustPasswordsGet"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRSERVERTRUSTPASSWORDSGET"); + ndr_print_struct(ndr, "in", "netr_ServerTrustPasswordsGet"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_string(ndr, "account_name", r->in.account_name); + ndr_print_netr_SchannelType(ndr, "secure_channel_type", r->in.secure_channel_type); + ndr_print_string(ndr, "computer_name", r->in.computer_name); + ndr_print_ptr(ndr, "credential", r->in.credential); ndr->depth++; + ndr_print_netr_Authenticator(ndr, "credential", r->in.credential); + ndr->depth--; ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRSERVERTRUSTPASSWORDSGET"); + ndr_print_struct(ndr, "out", "netr_ServerTrustPasswordsGet"); ndr->depth++; - ndr_print_WERROR(ndr, "result", r->out.result); + ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator); + ndr->depth++; + ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator); + ndr->depth--; + ndr_print_ptr(ndr, "password", r->out.password); + ndr->depth++; + ndr_print_samr_Password(ndr, "password", r->out.password); + ndr->depth--; + ndr_print_ptr(ndr, "password2", r->out.password2); + ndr->depth++; + ndr_print_samr_Password(ndr, "password2", r->out.password2); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); ndr->depth--; } ndr->depth--; } -static enum ndr_err_code ndr_push_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_push_netr_DsRGetForestTrustInformation(struct ndr_push *ndr, int flags, const struct netr_DsRGetForestTrustInformation *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.trusted_domain_name)); + if (r->in.trusted_domain_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.trusted_domain_name, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { + if (r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct netr_DSRGETFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_pull_netr_DsRGetForestTrustInformation(struct ndr_pull *ndr, int flags, struct netr_DsRGetForestTrustInformation *r) { + uint32_t _ptr_server_name; + uint32_t _ptr_trusted_domain_name; + uint32_t _ptr_forest_trust_info; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_trusted_domain_name_0; + TALLOC_CTX *_mem_save_forest_trust_info_0; + TALLOC_CTX *_mem_save_forest_trust_info_1; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_trusted_domain_name)); + if (_ptr_trusted_domain_name) { + NDR_PULL_ALLOC(ndr, r->in.trusted_domain_name); + } else { + r->in.trusted_domain_name = NULL; + } + if (r->in.trusted_domain_name) { + _mem_save_trusted_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.trusted_domain_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.trusted_domain_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.trusted_domain_name)); + if (ndr_get_array_length(ndr, &r->in.trusted_domain_name) > ndr_get_array_size(ndr, &r->in.trusted_domain_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.trusted_domain_name), ndr_get_array_length(ndr, &r->in.trusted_domain_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.trusted_domain_name, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_trusted_domain_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + ZERO_STRUCTP(r->out.forest_trust_info); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + } + _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r) +_PUBLIC_ void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r) { - ndr_print_struct(ndr, name, "netr_DSRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, name, "netr_DsRGetForestTrustInformation"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_DSRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "in", "netr_DsRGetForestTrustInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name); ndr->depth++; + if (r->in.trusted_domain_name) { + ndr_print_string(ndr, "trusted_domain_name", r->in.trusted_domain_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_DSRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "out", "netr_DsRGetForestTrustInformation"); ndr->depth++; + ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info); + ndr->depth++; + ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); + ndr->depth++; + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + ndr->depth--; + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } ndr->depth--; } -static enum ndr_err_code ndr_push_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_push *ndr, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_push_netr_GetForestTrustInformation(struct ndr_push *ndr, int flags, const struct netr_GetForestTrustInformation *r) { if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server_name)); + if (r->in.server_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.server_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.server_name, ndr_charset_length(r->in.server_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + if (r->in.trusted_domain_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.trusted_domain_name, ndr_charset_length(r->in.trusted_domain_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + if (r->in.credential == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); } if (flags & NDR_OUT) { + if (r->out.return_authenticator == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + if (r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + if (*r->out.forest_trust_info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_ref_ptr(ndr)); + NDR_CHECK(ndr_push_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result)); } return NDR_ERR_SUCCESS; } -static enum ndr_err_code ndr_pull_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_pull *ndr, int flags, struct netr_NETRGETFORESTTRUSTINFORMATION *r) +static enum ndr_err_code ndr_pull_netr_GetForestTrustInformation(struct ndr_pull *ndr, int flags, struct netr_GetForestTrustInformation *r) { + uint32_t _ptr_server_name; + uint32_t _ptr_forest_trust_info; + TALLOC_CTX *_mem_save_server_name_0; + TALLOC_CTX *_mem_save_credential_0; + TALLOC_CTX *_mem_save_return_authenticator_0; + TALLOC_CTX *_mem_save_forest_trust_info_0; + TALLOC_CTX *_mem_save_forest_trust_info_1; if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server_name)); + if (_ptr_server_name) { + NDR_PULL_ALLOC(ndr, r->in.server_name); + } else { + r->in.server_name = NULL; + } + if (r->in.server_name) { + _mem_save_server_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.server_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.server_name)); + if (ndr_get_array_length(ndr, &r->in.server_name) > ndr_get_array_size(ndr, &r->in.server_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.server_name), ndr_get_array_length(ndr, &r->in.server_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.server_name, ndr_get_array_length(ndr, &r->in.server_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_name_0, 0); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.trusted_domain_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.trusted_domain_name)); + if (ndr_get_array_length(ndr, &r->in.trusted_domain_name) > ndr_get_array_size(ndr, &r->in.trusted_domain_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.trusted_domain_name), ndr_get_array_length(ndr, &r->in.trusted_domain_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.trusted_domain_name, ndr_get_array_length(ndr, &r->in.trusted_domain_name), sizeof(uint16_t), CH_UTF16)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.credential); + } + _mem_save_credential_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.credential, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->in.credential)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_credential_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + ZERO_STRUCTP(r->out.return_authenticator); + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + ZERO_STRUCTP(r->out.forest_trust_info); } if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.return_authenticator); + } + _mem_save_return_authenticator_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.return_authenticator, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_netr_Authenticator(ndr, NDR_SCALARS, r->out.return_authenticator)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_return_authenticator_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.forest_trust_info); + } + _mem_save_forest_trust_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_ref_ptr(ndr, &_ptr_forest_trust_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, *r->out.forest_trust_info); + } + _mem_save_forest_trust_info_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, *r->out.forest_trust_info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_ForestTrustInformation(ndr, NDR_SCALARS|NDR_BUFFERS, *r->out.forest_trust_info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_1, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_info_0, LIBNDR_FLAG_REF_ALLOC); NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result)); } return NDR_ERR_SUCCESS; } -_PUBLIC_ void ndr_print_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r) +_PUBLIC_ void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r) { - ndr_print_struct(ndr, name, "netr_NETRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, name, "netr_GetForestTrustInformation"); ndr->depth++; if (flags & NDR_SET_VALUES) { ndr->flags |= LIBNDR_PRINT_SET_VALUES; } if (flags & NDR_IN) { - ndr_print_struct(ndr, "in", "netr_NETRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "in", "netr_GetForestTrustInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "server_name", r->in.server_name); + ndr->depth++; + if (r->in.server_name) { + ndr_print_string(ndr, "server_name", r->in.server_name); + } + ndr->depth--; + ndr_print_ptr(ndr, "trusted_domain_name", r->in.trusted_domain_name); ndr->depth++; + ndr_print_string(ndr, "trusted_domain_name", r->in.trusted_domain_name); + ndr->depth--; + ndr_print_ptr(ndr, "credential", r->in.credential); + ndr->depth++; + ndr_print_netr_Authenticator(ndr, "credential", r->in.credential); + ndr->depth--; + ndr_print_uint32(ndr, "flags", r->in.flags); ndr->depth--; } if (flags & NDR_OUT) { - ndr_print_struct(ndr, "out", "netr_NETRGETFORESTTRUSTINFORMATION"); + ndr_print_struct(ndr, "out", "netr_GetForestTrustInformation"); ndr->depth++; + ndr_print_ptr(ndr, "return_authenticator", r->out.return_authenticator); + ndr->depth++; + ndr_print_netr_Authenticator(ndr, "return_authenticator", r->out.return_authenticator); + ndr->depth--; + ndr_print_ptr(ndr, "forest_trust_info", r->out.forest_trust_info); + ndr->depth++; + ndr_print_ptr(ndr, "forest_trust_info", *r->out.forest_trust_info); + ndr->depth++; + ndr_print_lsa_ForestTrustInformation(ndr, "forest_trust_info", *r->out.forest_trust_info); + ndr->depth--; + ndr->depth--; ndr_print_WERROR(ndr, "result", r->out.result); ndr->depth--; } @@ -13007,11 +14349,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRENUMERATETRUSTEDDOMAINS", - sizeof(struct netr_NETRENUMERATETRUSTEDDOMAINS), - (ndr_push_flags_fn_t) ndr_push_netr_NETRENUMERATETRUSTEDDOMAINS, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINS, - (ndr_print_function_t) ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS, + "netr_NetrEnumerateTrustedDomains", + sizeof(struct netr_NetrEnumerateTrustedDomains), + (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomains, + (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomains, + (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomains, false, }, { @@ -13103,11 +14445,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRSERVERPASSWORDGET", - sizeof(struct netr_NETRSERVERPASSWORDGET), - (ndr_push_flags_fn_t) ndr_push_netr_NETRSERVERPASSWORDGET, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRSERVERPASSWORDGET, - (ndr_print_function_t) ndr_print_netr_NETRSERVERPASSWORDGET, + "netr_ServerPasswordGet", + sizeof(struct netr_ServerPasswordGet), + (ndr_push_flags_fn_t) ndr_push_netr_ServerPasswordGet, + (ndr_pull_flags_fn_t) ndr_pull_netr_ServerPasswordGet, + (ndr_print_function_t) ndr_print_netr_ServerPasswordGet, false, }, { @@ -13119,11 +14461,11 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_DSRADDRESSTOSITENAMESW", - sizeof(struct netr_DSRADDRESSTOSITENAMESW), - (ndr_push_flags_fn_t) ndr_push_netr_DSRADDRESSTOSITENAMESW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DSRADDRESSTOSITENAMESW, - (ndr_print_function_t) ndr_print_netr_DSRADDRESSTOSITENAMESW, + "netr_DsRAddressToSitenamesW", + sizeof(struct netr_DsRAddressToSitenamesW), + (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesW, + (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesW, + (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesW, false, }, { @@ -13143,27 +14485,27 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRENUMERATETRUSTEDDOMAINSEX", - sizeof(struct netr_NETRENUMERATETRUSTEDDOMAINSEX), - (ndr_push_flags_fn_t) ndr_push_netr_NETRENUMERATETRUSTEDDOMAINSEX, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRENUMERATETRUSTEDDOMAINSEX, - (ndr_print_function_t) ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX, + "netr_NetrEnumerateTrustedDomainsEx", + sizeof(struct netr_NetrEnumerateTrustedDomainsEx), + (ndr_push_flags_fn_t) ndr_push_netr_NetrEnumerateTrustedDomainsEx, + (ndr_pull_flags_fn_t) ndr_pull_netr_NetrEnumerateTrustedDomainsEx, + (ndr_print_function_t) ndr_print_netr_NetrEnumerateTrustedDomainsEx, false, }, { - "netr_DSRADDRESSTOSITENAMESEXW", - sizeof(struct netr_DSRADDRESSTOSITENAMESEXW), - (ndr_push_flags_fn_t) ndr_push_netr_DSRADDRESSTOSITENAMESEXW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DSRADDRESSTOSITENAMESEXW, - (ndr_print_function_t) ndr_print_netr_DSRADDRESSTOSITENAMESEXW, + "netr_DsRAddressToSitenamesExW", + sizeof(struct netr_DsRAddressToSitenamesExW), + (ndr_push_flags_fn_t) ndr_push_netr_DsRAddressToSitenamesExW, + (ndr_pull_flags_fn_t) ndr_pull_netr_DsRAddressToSitenamesExW, + (ndr_print_function_t) ndr_print_netr_DsRAddressToSitenamesExW, false, }, { - "netr_DSRGETDCSITECOVERAGEW", - sizeof(struct netr_DSRGETDCSITECOVERAGEW), - (ndr_push_flags_fn_t) ndr_push_netr_DSRGETDCSITECOVERAGEW, - (ndr_pull_flags_fn_t) ndr_pull_netr_DSRGETDCSITECOVERAGEW, - (ndr_print_function_t) ndr_print_netr_DSRGETDCSITECOVERAGEW, + "netr_DsrGetDcSiteCoverageW", + sizeof(struct netr_DsrGetDcSiteCoverageW), + (ndr_push_flags_fn_t) ndr_push_netr_DsrGetDcSiteCoverageW, + (ndr_pull_flags_fn_t) ndr_pull_netr_DsrGetDcSiteCoverageW, + (ndr_print_function_t) ndr_print_netr_DsrGetDcSiteCoverageW, false, }, { @@ -13191,27 +14533,27 @@ static const struct ndr_interface_call netlogon_calls[] = { false, }, { - "netr_NETRSERVERTRUSTPASSWORDSGET", - sizeof(struct netr_NETRSERVERTRUSTPASSWORDSGET), - (ndr_push_flags_fn_t) ndr_push_netr_NETRSERVERTRUSTPASSWORDSGET, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRSERVERTRUSTPASSWORDSGET, - (ndr_print_function_t) ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET, + "netr_ServerTrustPasswordsGet", + sizeof(struct netr_ServerTrustPasswordsGet), + (ndr_push_flags_fn_t) ndr_push_netr_ServerTrustPasswordsGet, + (ndr_pull_flags_fn_t) ndr_pull_netr_ServerTrustPasswordsGet, + (ndr_print_function_t) ndr_print_netr_ServerTrustPasswordsGet, false, }, { - "netr_DSRGETFORESTTRUSTINFORMATION", - sizeof(struct netr_DSRGETFORESTTRUSTINFORMATION), - (ndr_push_flags_fn_t) ndr_push_netr_DSRGETFORESTTRUSTINFORMATION, - (ndr_pull_flags_fn_t) ndr_pull_netr_DSRGETFORESTTRUSTINFORMATION, - (ndr_print_function_t) ndr_print_netr_DSRGETFORESTTRUSTINFORMATION, + "netr_DsRGetForestTrustInformation", + sizeof(struct netr_DsRGetForestTrustInformation), + (ndr_push_flags_fn_t) ndr_push_netr_DsRGetForestTrustInformation, + (ndr_pull_flags_fn_t) ndr_pull_netr_DsRGetForestTrustInformation, + (ndr_print_function_t) ndr_print_netr_DsRGetForestTrustInformation, false, }, { - "netr_NETRGETFORESTTRUSTINFORMATION", - sizeof(struct netr_NETRGETFORESTTRUSTINFORMATION), - (ndr_push_flags_fn_t) ndr_push_netr_NETRGETFORESTTRUSTINFORMATION, - (ndr_pull_flags_fn_t) ndr_pull_netr_NETRGETFORESTTRUSTINFORMATION, - (ndr_print_function_t) ndr_print_netr_NETRGETFORESTTRUSTINFORMATION, + "netr_GetForestTrustInformation", + sizeof(struct netr_GetForestTrustInformation), + (ndr_push_flags_fn_t) ndr_push_netr_GetForestTrustInformation, + (ndr_pull_flags_fn_t) ndr_pull_netr_GetForestTrustInformation, + (ndr_print_function_t) ndr_print_netr_GetForestTrustInformation, false, }, { diff --git a/source3/librpc/gen_ndr/ndr_netlogon.h b/source3/librpc/gen_ndr/ndr_netlogon.h index 07c96f8c89..c2fd0655d8 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.h +++ b/source3/librpc/gen_ndr/ndr_netlogon.h @@ -73,7 +73,7 @@ extern const struct ndr_interface_table ndr_table_netlogon; #define NDR_NETR_SERVERPASSWORDSET2 (0x1e) -#define NDR_NETR_NETRSERVERPASSWORDGET (0x1f) +#define NDR_NETR_SERVERPASSWORDGET (0x1f) #define NDR_NETR_NETRLOGONSENDTOSAM (0x20) @@ -95,11 +95,11 @@ extern const struct ndr_interface_table ndr_table_netlogon; #define NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS (0x29) -#define NDR_NETR_NETRSERVERTRUSTPASSWORDSGET (0x2a) +#define NDR_NETR_SERVERTRUSTPASSWORDSGET (0x2a) #define NDR_NETR_DSRGETFORESTTRUSTINFORMATION (0x2b) -#define NDR_NETR_NETRGETFORESTTRUSTINFORMATION (0x2c) +#define NDR_NETR_GETFORESTTRUSTINFORMATION (0x2c) #define NDR_NETR_LOGONSAMLOGONWITHFLAGS (0x2d) @@ -183,8 +183,11 @@ void ndr_print_netr_NETLOGON_INFO_3(struct ndr_print *ndr, const char *name, con void ndr_print_netr_CONTROL_QUERY_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_QUERY_INFORMATION *r); void ndr_print_netr_LogonControlCode(struct ndr_print *ndr, const char *name, enum netr_LogonControlCode r); void ndr_print_netr_CONTROL_DATA_INFORMATION(struct ndr_print *ndr, const char *name, const union netr_CONTROL_DATA_INFORMATION *r); -void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r); void ndr_print_netr_Blob(struct ndr_print *ndr, const char *name, const struct netr_Blob *r); +void ndr_print_netr_DsRGetDCName_flags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_netr_DsRGetDCNameInfo_AddressType(struct ndr_print *ndr, const char *name, enum netr_DsRGetDCNameInfo_AddressType r); +void ndr_print_netr_DsR_DcFlags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_netr_DsRGetDCNameInfo(struct ndr_print *ndr, const char *name, const struct netr_DsRGetDCNameInfo *r); void ndr_print_netr_BinaryString(struct ndr_print *ndr, const char *name, const struct netr_BinaryString *r); void ndr_print_netr_DomainQuery1(struct ndr_print *ndr, const char *name, const struct netr_DomainQuery1 *r); void ndr_print_netr_DomainQuery(struct ndr_print *ndr, const char *name, const union netr_DomainQuery *r); @@ -192,10 +195,15 @@ void ndr_print_netr_DomainTrustInfo(struct ndr_print *ndr, const char *name, con void ndr_print_netr_DomainInfo1(struct ndr_print *ndr, const char *name, const struct netr_DomainInfo1 *r); void ndr_print_netr_DomainInfo(struct ndr_print *ndr, const char *name, const union netr_DomainInfo *r); void ndr_print_netr_CryptPassword(struct ndr_print *ndr, const char *name, const struct netr_CryptPassword *r); +void ndr_print_netr_DsRAddressToSitenamesWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesWCtr *r); +void ndr_print_netr_DsRAddress(struct ndr_print *ndr, const char *name, const struct netr_DsRAddress *r); void ndr_print_netr_TrustFlags(struct ndr_print *ndr, const char *name, uint32_t r); void ndr_print_netr_TrustType(struct ndr_print *ndr, const char *name, enum netr_TrustType r); void ndr_print_netr_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r); void ndr_print_netr_DomainTrust(struct ndr_print *ndr, const char *name, const struct netr_DomainTrust *r); +void ndr_print_netr_DomainTrustList(struct ndr_print *ndr, const char *name, const struct netr_DomainTrustList *r); +void ndr_print_netr_DsRAddressToSitenamesExWCtr(struct ndr_print *ndr, const char *name, const struct netr_DsRAddressToSitenamesExWCtr *r); +void ndr_print_DcSitesCtr(struct ndr_print *ndr, const char *name, const struct DcSitesCtr *r); void ndr_print_netr_LogonUasLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogon *r); void ndr_print_netr_LogonUasLogoff(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonUasLogoff *r); void ndr_print_netr_LogonSamLogon(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogon *r); @@ -215,7 +223,7 @@ void ndr_print_netr_ServerAuthenticate2(struct ndr_print *ndr, const char *name, void ndr_print_netr_DatabaseSync2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseSync2 *r); void ndr_print_netr_DatabaseRedo(struct ndr_print *ndr, const char *name, int flags, const struct netr_DatabaseRedo *r); void ndr_print_netr_LogonControl2Ex(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonControl2Ex *r); -void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINS *r); +void ndr_print_netr_NetrEnumerateTrustedDomains(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomains *r); void ndr_print_netr_DsRGetDCName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCName *r); void ndr_print_netr_NETRLOGONDUMMYROUTINE1(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONDUMMYROUTINE1 *r); void ndr_print_netr_NETRLOGONSETSERVICEBITS(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSETSERVICEBITS *r); @@ -227,20 +235,20 @@ void ndr_print_netr_DsRGetDCNameEx(struct ndr_print *ndr, const char *name, int void ndr_print_netr_DsRGetSiteName(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetSiteName *r); void ndr_print_netr_LogonGetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonGetDomainInfo *r); void ndr_print_netr_ServerPasswordSet2(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordSet2 *r); -void ndr_print_netr_NETRSERVERPASSWORDGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERPASSWORDGET *r); +void ndr_print_netr_ServerPasswordGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerPasswordGet *r); void ndr_print_netr_NETRLOGONSENDTOSAM(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONSENDTOSAM *r); -void ndr_print_netr_DSRADDRESSTOSITENAMESW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESW *r); +void ndr_print_netr_DsRAddressToSitenamesW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesW *r); void ndr_print_netr_DsRGetDCNameEx2(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetDCNameEx2 *r); void ndr_print_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); -void ndr_print_netr_NETRENUMERATETRUSTEDDOMAINSEX(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r); -void ndr_print_netr_DSRADDRESSTOSITENAMESEXW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRADDRESSTOSITENAMESEXW *r); -void ndr_print_netr_DSRGETDCSITECOVERAGEW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETDCSITECOVERAGEW *r); +void ndr_print_netr_NetrEnumerateTrustedDomainsEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_NetrEnumerateTrustedDomainsEx *r); +void ndr_print_netr_DsRAddressToSitenamesExW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRAddressToSitenamesExW *r); +void ndr_print_netr_DsrGetDcSiteCoverageW(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrGetDcSiteCoverageW *r); void ndr_print_netr_LogonSamLogonEx(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonEx *r); void ndr_print_netr_DsrEnumerateDomainTrusts(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsrEnumerateDomainTrusts *r); void ndr_print_netr_DSRDEREGISTERDNSHOSTRECORDS(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRDEREGISTERDNSHOSTRECORDS *r); -void ndr_print_netr_NETRSERVERTRUSTPASSWORDSGET(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERTRUSTPASSWORDSGET *r); -void ndr_print_netr_DSRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_DSRGETFORESTTRUSTINFORMATION *r); -void ndr_print_netr_NETRGETFORESTTRUSTINFORMATION(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRGETFORESTTRUSTINFORMATION *r); +void ndr_print_netr_ServerTrustPasswordsGet(struct ndr_print *ndr, const char *name, int flags, const struct netr_ServerTrustPasswordsGet *r); +void ndr_print_netr_DsRGetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_DsRGetForestTrustInformation *r); +void ndr_print_netr_GetForestTrustInformation(struct ndr_print *ndr, const char *name, int flags, const struct netr_GetForestTrustInformation *r); void ndr_print_netr_LogonSamLogonWithFlags(struct ndr_print *ndr, const char *name, int flags, const struct netr_LogonSamLogonWithFlags *r); void ndr_print_netr_NETRSERVERGETTRUSTINFO(struct ndr_print *ndr, const char *name, int flags, const struct netr_NETRSERVERGETTRUSTINFO *r); #endif /* _HEADER_NDR_netlogon */ diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 4b97470b6a..2ced17405d 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -14,6 +14,7 @@ #define NETLOGON_NEG_ARCFOUR ( 0x00000004 ) #define NETLOGON_NEG_128BIT ( 0x00004000 ) #define NETLOGON_NEG_SCHANNEL ( 0x40000000 ) +#define DS_GFTI_UPDATE_TDO ( 0x1 ) ; struct netr_UasInfo { @@ -227,7 +228,7 @@ struct netr_PasswordHistory { struct netr_USER_KEYS2 { struct netr_USER_KEY16 lmpassword; struct netr_USER_KEY16 ntpassword; - struct netr_PasswordHistory lmhistory; + struct netr_PasswordHistory history; }; struct netr_USER_KEY_UNION { @@ -624,10 +625,66 @@ union netr_CONTROL_DATA_INFORMATION { uint32_t debug_level;/* [case(NETLOGON_CONTROL_SET_DBFLAG)] */ }; +struct netr_Blob { + uint32_t length; + uint8_t *data;/* [unique,size_is(length)] */ +}; + +/* bitmap netr_DsRGetDCName_flags */ +#define DS_FORCE_REDISCOVERY ( 0x00000001 ) +#define DS_DIRECTORY_SERVICE_REQUIRED ( 0x00000010 ) +#define DS_DIRECTORY_SERVICE_PREFERRED ( 0x00000020 ) +#define DS_GC_SERVER_REQUIRED ( 0x00000040 ) +#define DS_PDC_REQUIRED ( 0x00000080 ) +#define DS_BACKGROUND_ONLY ( 0x00000100 ) +#define DS_IP_REQUIRED ( 0x00000200 ) +#define DS_KDC_REQUIRED ( 0x00000400 ) +#define DS_TIMESERV_REQUIRED ( 0x00000800 ) +#define DS_WRITABLE_REQUIRED ( 0x00001000 ) +#define DS_GOOD_TIMESERV_PREFERRED ( 0x00002000 ) +#define DS_AVOID_SELF ( 0x00004000 ) +#define DS_ONLY_LDAP_NEEDED ( 0x00008000 ) +#define DS_IS_FLAT_NAME ( 0x00010000 ) +#define DS_IS_DNS_NAME ( 0x00020000 ) +#define DS_RETURN_DNS_NAME ( 0x40000000 ) +#define DS_RETURN_FLAT_NAME ( 0x80000000 ) + +; + +enum netr_DsRGetDCNameInfo_AddressType +#ifndef USE_UINT_ENUMS + { + DS_ADDRESS_TYPE_INET=1, + DS_ADDRESS_TYPE_NETBIOS=2 +} +#else + { __donnot_use_enum_netr_DsRGetDCNameInfo_AddressType=0x7FFFFFFF} +#define DS_ADDRESS_TYPE_INET ( 1 ) +#define DS_ADDRESS_TYPE_NETBIOS ( 2 ) +#endif +; + +/* bitmap netr_DsR_DcFlags */ +#define DS_SERVER_PDC ( 0x00000001 ) +#define DS_SERVER_GC ( 0x00000004 ) +#define DS_SERVER_LDAP ( 0x00000008 ) +#define DS_SERVER_DS ( 0x00000010 ) +#define DS_SERVER_KDC ( 0x00000020 ) +#define DS_SERVER_TIMESERV ( 0x00000040 ) +#define DS_SERVER_CLOSEST ( 0x00000080 ) +#define DS_SERVER_WRITABLE ( 0x00000100 ) +#define DS_SERVER_GOOD_TIMESERV ( 0x00000200 ) +#define DS_SERVER_NDNC ( 0x00000400 ) +#define DS_DNS_CONTROLLER ( 0x20000000 ) +#define DS_DNS_DOMAIN ( 0x40000000 ) +#define DS_DNS_FOREST ( 0x80000000 ) + +; + struct netr_DsRGetDCNameInfo { const char *dc_unc;/* [unique,charset(UTF16)] */ const char *dc_address;/* [unique,charset(UTF16)] */ - int32_t dc_address_type; + enum netr_DsRGetDCNameInfo_AddressType dc_address_type; struct GUID domain_guid; const char *domain_name;/* [unique,charset(UTF16)] */ const char *forest_name;/* [unique,charset(UTF16)] */ @@ -636,11 +693,6 @@ struct netr_DsRGetDCNameInfo { const char *client_site_name;/* [unique,charset(UTF16)] */ }; -struct netr_Blob { - uint32_t length; - uint8_t *data;/* [unique,size_is(length)] */ -}; - struct netr_BinaryString { uint16_t length; uint16_t size; @@ -692,6 +744,16 @@ struct netr_CryptPassword { uint32_t length; }/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */; +struct netr_DsRAddressToSitenamesWCtr { + uint32_t count; + struct lsa_String *sitename;/* [unique,size_is(count)] */ +}; + +struct netr_DsRAddress { + uint8_t *buffer;/* [unique,size_is(size)] */ + uint32_t size; +}; + /* bitmap netr_TrustFlags */ #define NETR_TRUST_FLAG_IN_FOREST ( 0x00000001 ) #define NETR_TRUST_FLAG_OUTBOUND ( 0x00000002 ) @@ -741,6 +803,22 @@ struct netr_DomainTrust { struct GUID guid; }; +struct netr_DomainTrustList { + uint32_t count; + struct netr_DomainTrust *array;/* [unique,size_is(count)] */ +}; + +struct netr_DsRAddressToSitenamesExWCtr { + uint32_t count; + struct lsa_String *sitename;/* [unique,size_is(count)] */ + struct lsa_String *subnetname;/* [unique,size_is(count)] */ +}; + +struct DcSitesCtr { + uint32_t num_sites; + struct lsa_String *sites;/* [unique,size_is(num_sites)] */ +}; + struct netr_LogonUasLogon { struct { @@ -750,7 +828,7 @@ struct netr_LogonUasLogon { } in; struct { - struct netr_UasInfo *info;/* [unique] */ + struct netr_UasInfo *info;/* [ref] */ WERROR result; } out; @@ -873,7 +951,7 @@ struct netr_DatabaseDeltas { } in; struct { - struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */ + struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */ struct netr_Authenticator *return_authenticator;/* [ref] */ uint64_t *sequence_num;/* [ref] */ NTSTATUS result; @@ -894,7 +972,7 @@ struct netr_DatabaseSync { } in; struct { - struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */ + struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */ struct netr_Authenticator *return_authenticator;/* [ref] */ uint32_t *sync_context;/* [ref] */ NTSTATUS result; @@ -1043,7 +1121,7 @@ struct netr_DatabaseSync2 { } in; struct { - struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */ + struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */ struct netr_Authenticator *return_authenticator;/* [ref] */ uint32_t *sync_context;/* [ref] */ NTSTATUS result; @@ -1063,7 +1141,7 @@ struct netr_DatabaseRedo { } in; struct { - struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [unique] */ + struct netr_DELTA_ENUM_ARRAY *delta_enum_array;/* [ref] */ struct netr_Authenticator *return_authenticator;/* [ref] */ NTSTATUS result; } out; @@ -1087,8 +1165,13 @@ struct netr_LogonControl2Ex { }; -struct netr_NETRENUMERATETRUSTEDDOMAINS { +struct netr_NetrEnumerateTrustedDomains { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + } in; + + struct { + struct netr_Blob *trusted_domains_blob;/* [ref] */ WERROR result; } out; @@ -1105,7 +1188,7 @@ struct netr_DsRGetDCName { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [unique] */ + struct netr_DsRGetDCNameInfo *info;/* [ref] */ WERROR result; } out; @@ -1182,7 +1265,7 @@ struct netr_DsRGetDCNameEx { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [unique] */ + struct netr_DsRGetDCNameInfo *info;/* [ref] */ WERROR result; } out; @@ -1239,8 +1322,18 @@ struct netr_ServerPasswordSet2 { }; -struct netr_NETRSERVERPASSWORDGET { +struct netr_ServerPasswordGet { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *account_name;/* [charset(UTF16)] */ + enum netr_SchannelType secure_channel_type; + const char *computer_name;/* [charset(UTF16)] */ + struct netr_Authenticator *credential;/* [ref] */ + } in; + + struct { + struct netr_Authenticator *return_authenticator;/* [ref] */ + struct samr_Password *password;/* [ref] */ WERROR result; } out; @@ -1255,8 +1348,15 @@ struct netr_NETRLOGONSENDTOSAM { }; -struct netr_DSRADDRESSTOSITENAMESW { +struct netr_DsRAddressToSitenamesW { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + uint32_t count;/* [range(0 32000)] */ + struct netr_DsRAddress *addresses;/* [ref,size_is(count)] */ + } in; + + struct { + struct netr_DsRAddressToSitenamesWCtr **ctr;/* [ref] */ WERROR result; } out; @@ -1275,7 +1375,7 @@ struct netr_DsRGetDCNameEx2 { } in; struct { - struct netr_DsRGetDCNameInfo *info;/* [unique] */ + struct netr_DsRGetDCNameInfo *info;/* [ref] */ WERROR result; } out; @@ -1290,24 +1390,41 @@ struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN { }; -struct netr_NETRENUMERATETRUSTEDDOMAINSEX { +struct netr_NetrEnumerateTrustedDomainsEx { + struct { + const char *server_name;/* [unique,charset(UTF16)] */ + } in; + struct { + struct netr_DomainTrustList *dom_trust_list;/* [ref] */ WERROR result; } out; }; -struct netr_DSRADDRESSTOSITENAMESEXW { +struct netr_DsRAddressToSitenamesExW { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + uint32_t count;/* [range(0 32000)] */ + struct netr_DsRAddress *addresses;/* [ref,size_is(count)] */ + } in; + + struct { + struct netr_DsRAddressToSitenamesExWCtr **ctr;/* [ref] */ WERROR result; } out; }; -struct netr_DSRGETDCSITECOVERAGEW { +struct netr_DsrGetDcSiteCoverageW { + struct { + const char *server_name;/* [unique,charset(UTF16)] */ + } in; + struct { + struct DcSitesCtr *ctr;/* [ref] */ WERROR result; } out; @@ -1341,8 +1458,7 @@ struct netr_DsrEnumerateDomainTrusts { } in; struct { - uint32_t *count;/* [ref] */ - struct netr_DomainTrust **trusts;/* [ref,size_is(count)] */ + struct netr_DomainTrustList **trusts;/* [ref] */ WERROR result; } out; @@ -1357,24 +1473,51 @@ struct netr_DSRDEREGISTERDNSHOSTRECORDS { }; -struct netr_NETRSERVERTRUSTPASSWORDSGET { +struct netr_ServerTrustPasswordsGet { struct { - WERROR result; + const char *server_name;/* [unique,charset(UTF16)] */ + const char *account_name;/* [charset(UTF16)] */ + enum netr_SchannelType secure_channel_type; + const char *computer_name;/* [charset(UTF16)] */ + struct netr_Authenticator *credential;/* [ref] */ + } in; + + struct { + struct netr_Authenticator *return_authenticator;/* [ref] */ + struct samr_Password *password;/* [ref] */ + struct samr_Password *password2;/* [ref] */ + NTSTATUS result; } out; }; -struct netr_DSRGETFORESTTRUSTINFORMATION { +struct netr_DsRGetForestTrustInformation { struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *trusted_domain_name;/* [unique,charset(UTF16)] */ + uint32_t flags; + } in; + + struct { + struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */ WERROR result; } out; }; -struct netr_NETRGETFORESTTRUSTINFORMATION { +struct netr_GetForestTrustInformation { + struct { + const char *server_name;/* [unique,charset(UTF16)] */ + const char *trusted_domain_name;/* [ref,charset(UTF16)] */ + struct netr_Authenticator *credential;/* [ref] */ + uint32_t flags; + } in; + struct { + struct netr_Authenticator *return_authenticator;/* [ref] */ + struct lsa_ForestTrustInformation **forest_trust_info;/* [ref] */ WERROR result; } out; diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c index 163de46ca8..421014e829 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.c +++ b/source3/librpc/gen_ndr/srv_netlogon.c @@ -1560,18 +1560,18 @@ static bool api_netr_LogonControl2Ex(pipes_struct *p) return true; } -static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) +static bool api_netr_NetrEnumerateTrustedDomains(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRENUMERATETRUSTEDDOMAINS *r; + struct netr_NetrEnumerateTrustedDomains *r; call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINS]; - r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINS); + r = talloc(NULL, struct netr_NetrEnumerateTrustedDomains); if (r == NULL) { return false; } @@ -1595,10 +1595,17 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r); + NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomains, r); } - r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINS(p, r); + ZERO_STRUCT(r->out); + r->out.trusted_domains_blob = talloc_zero(r, struct netr_Blob); + if (r->out.trusted_domains_blob == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_NetrEnumerateTrustedDomains(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -1607,7 +1614,7 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINS, r); + NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomains, r); } push = ndr_push_init_ctx(r); @@ -2481,18 +2488,18 @@ static bool api_netr_ServerPasswordSet2(pipes_struct *p) return true; } -static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p) +static bool api_netr_ServerPasswordGet(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRSERVERPASSWORDGET *r; + struct netr_ServerPasswordGet *r; - call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERPASSWORDGET]; + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERPASSWORDGET]; - r = talloc(NULL, struct netr_NETRSERVERPASSWORDGET); + r = talloc(NULL, struct netr_ServerPasswordGet); if (r == NULL) { return false; } @@ -2516,10 +2523,23 @@ static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRSERVERPASSWORDGET, r); + NDR_PRINT_IN_DEBUG(netr_ServerPasswordGet, r); + } + + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_NETRSERVERPASSWORDGET(p, r); + r->out.password = talloc_zero(r, struct samr_Password); + if (r->out.password == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_ServerPasswordGet(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -2528,7 +2548,7 @@ static bool api_netr_NETRSERVERPASSWORDGET(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRSERVERPASSWORDGET, r); + NDR_PRINT_OUT_DEBUG(netr_ServerPasswordGet, r); } push = ndr_push_init_ctx(r); @@ -2627,18 +2647,18 @@ static bool api_netr_NETRLOGONSENDTOSAM(pipes_struct *p) return true; } -static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) +static bool api_netr_DsRAddressToSitenamesW(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_DSRADDRESSTOSITENAMESW *r; + struct netr_DsRAddressToSitenamesW *r; call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESW]; - r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESW); + r = talloc(NULL, struct netr_DsRAddressToSitenamesW); if (r == NULL) { return false; } @@ -2662,10 +2682,17 @@ static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESW, r); + NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesW, r); + } + + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesWCtr *); + if (r->out.ctr == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_DSRADDRESSTOSITENAMESW(p, r); + r->out.result = _netr_DsRAddressToSitenamesW(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -2674,7 +2701,7 @@ static bool api_netr_DSRADDRESSTOSITENAMESW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESW, r); + NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesW, r); } push = ndr_push_init_ctx(r); @@ -2853,18 +2880,18 @@ static bool api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p) return true; } -static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) +static bool api_netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r; + struct netr_NetrEnumerateTrustedDomainsEx *r; call = &ndr_table_netlogon.calls[NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX]; - r = talloc(NULL, struct netr_NETRENUMERATETRUSTEDDOMAINSEX); + r = talloc(NULL, struct netr_NetrEnumerateTrustedDomainsEx); if (r == NULL) { return false; } @@ -2888,10 +2915,17 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r); + NDR_PRINT_IN_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r); } - r->out.result = _netr_NETRENUMERATETRUSTEDDOMAINSEX(p, r); + ZERO_STRUCT(r->out); + r->out.dom_trust_list = talloc_zero(r, struct netr_DomainTrustList); + if (r->out.dom_trust_list == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_NetrEnumerateTrustedDomainsEx(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -2900,7 +2934,7 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRENUMERATETRUSTEDDOMAINSEX, r); + NDR_PRINT_OUT_DEBUG(netr_NetrEnumerateTrustedDomainsEx, r); } push = ndr_push_init_ctx(r); @@ -2926,18 +2960,18 @@ static bool api_netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p) return true; } -static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) +static bool api_netr_DsRAddressToSitenamesExW(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_DSRADDRESSTOSITENAMESEXW *r; + struct netr_DsRAddressToSitenamesExW *r; call = &ndr_table_netlogon.calls[NDR_NETR_DSRADDRESSTOSITENAMESEXW]; - r = talloc(NULL, struct netr_DSRADDRESSTOSITENAMESEXW); + r = talloc(NULL, struct netr_DsRAddressToSitenamesExW); if (r == NULL) { return false; } @@ -2961,10 +2995,17 @@ static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r); + NDR_PRINT_IN_DEBUG(netr_DsRAddressToSitenamesExW, r); + } + + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(r, struct netr_DsRAddressToSitenamesExWCtr *); + if (r->out.ctr == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_DSRADDRESSTOSITENAMESEXW(p, r); + r->out.result = _netr_DsRAddressToSitenamesExW(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -2973,7 +3014,7 @@ static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRADDRESSTOSITENAMESEXW, r); + NDR_PRINT_OUT_DEBUG(netr_DsRAddressToSitenamesExW, r); } push = ndr_push_init_ctx(r); @@ -2999,18 +3040,18 @@ static bool api_netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p) return true; } -static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) +static bool api_netr_DsrGetDcSiteCoverageW(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_DSRGETDCSITECOVERAGEW *r; + struct netr_DsrGetDcSiteCoverageW *r; call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETDCSITECOVERAGEW]; - r = talloc(NULL, struct netr_DSRGETDCSITECOVERAGEW); + r = talloc(NULL, struct netr_DsrGetDcSiteCoverageW); if (r == NULL) { return false; } @@ -3034,10 +3075,17 @@ static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRGETDCSITECOVERAGEW, r); + NDR_PRINT_IN_DEBUG(netr_DsrGetDcSiteCoverageW, r); + } + + ZERO_STRUCT(r->out); + r->out.ctr = talloc_zero(r, struct DcSitesCtr); + if (r->out.ctr == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_DSRGETDCSITECOVERAGEW(p, r); + r->out.result = _netr_DsrGetDcSiteCoverageW(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -3046,7 +3094,7 @@ static bool api_netr_DSRGETDCSITECOVERAGEW(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRGETDCSITECOVERAGEW, r); + NDR_PRINT_OUT_DEBUG(netr_DsrGetDcSiteCoverageW, r); } push = ndr_push_init_ctx(r); @@ -3198,13 +3246,7 @@ static bool api_netr_DsrEnumerateDomainTrusts(pipes_struct *p) } ZERO_STRUCT(r->out); - r->out.count = talloc_zero(r, uint32_t); - if (r->out.count == NULL) { - talloc_free(r); - return false; - } - - r->out.trusts = talloc_zero_array(r, struct netr_DomainTrust *, r->out.count); + r->out.trusts = talloc_zero(r, struct netr_DomainTrustList *); if (r->out.trusts == NULL) { talloc_free(r); return false; @@ -3318,18 +3360,18 @@ static bool api_netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p) return true; } -static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) +static bool api_netr_ServerTrustPasswordsGet(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRSERVERTRUSTPASSWORDSGET *r; + struct netr_ServerTrustPasswordsGet *r; - call = &ndr_table_netlogon.calls[NDR_NETR_NETRSERVERTRUSTPASSWORDSGET]; + call = &ndr_table_netlogon.calls[NDR_NETR_SERVERTRUSTPASSWORDSGET]; - r = talloc(NULL, struct netr_NETRSERVERTRUSTPASSWORDSGET); + r = talloc(NULL, struct netr_ServerTrustPasswordsGet); if (r == NULL) { return false; } @@ -3353,10 +3395,29 @@ static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r); + NDR_PRINT_IN_DEBUG(netr_ServerTrustPasswordsGet, r); + } + + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_NETRSERVERTRUSTPASSWORDSGET(p, r); + r->out.password = talloc_zero(r, struct samr_Password); + if (r->out.password == NULL) { + talloc_free(r); + return false; + } + + r->out.password2 = talloc_zero(r, struct samr_Password); + if (r->out.password2 == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_ServerTrustPasswordsGet(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -3365,7 +3426,7 @@ static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRSERVERTRUSTPASSWORDSGET, r); + NDR_PRINT_OUT_DEBUG(netr_ServerTrustPasswordsGet, r); } push = ndr_push_init_ctx(r); @@ -3391,18 +3452,18 @@ static bool api_netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p) return true; } -static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) +static bool api_netr_DsRGetForestTrustInformation(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_DSRGETFORESTTRUSTINFORMATION *r; + struct netr_DsRGetForestTrustInformation *r; call = &ndr_table_netlogon.calls[NDR_NETR_DSRGETFORESTTRUSTINFORMATION]; - r = talloc(NULL, struct netr_DSRGETFORESTTRUSTINFORMATION); + r = talloc(NULL, struct netr_DsRGetForestTrustInformation); if (r == NULL) { return false; } @@ -3426,10 +3487,17 @@ static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r); + NDR_PRINT_IN_DEBUG(netr_DsRGetForestTrustInformation, r); } - r->out.result = _netr_DSRGETFORESTTRUSTINFORMATION(p, r); + ZERO_STRUCT(r->out); + r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _netr_DsRGetForestTrustInformation(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -3438,7 +3506,7 @@ static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_DSRGETFORESTTRUSTINFORMATION, r); + NDR_PRINT_OUT_DEBUG(netr_DsRGetForestTrustInformation, r); } push = ndr_push_init_ctx(r); @@ -3464,18 +3532,18 @@ static bool api_netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p) return true; } -static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) +static bool api_netr_GetForestTrustInformation(pipes_struct *p) { const struct ndr_interface_call *call; struct ndr_pull *pull; struct ndr_push *push; enum ndr_err_code ndr_err; DATA_BLOB blob; - struct netr_NETRGETFORESTTRUSTINFORMATION *r; + struct netr_GetForestTrustInformation *r; - call = &ndr_table_netlogon.calls[NDR_NETR_NETRGETFORESTTRUSTINFORMATION]; + call = &ndr_table_netlogon.calls[NDR_NETR_GETFORESTTRUSTINFORMATION]; - r = talloc(NULL, struct netr_NETRGETFORESTTRUSTINFORMATION); + r = talloc(NULL, struct netr_GetForestTrustInformation); if (r == NULL) { return false; } @@ -3499,10 +3567,23 @@ static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_IN_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r); + NDR_PRINT_IN_DEBUG(netr_GetForestTrustInformation, r); + } + + ZERO_STRUCT(r->out); + r->out.return_authenticator = talloc_zero(r, struct netr_Authenticator); + if (r->out.return_authenticator == NULL) { + talloc_free(r); + return false; + } + + r->out.forest_trust_info = talloc_zero(r, struct lsa_ForestTrustInformation *); + if (r->out.forest_trust_info == NULL) { + talloc_free(r); + return false; } - r->out.result = _netr_NETRGETFORESTTRUSTINFORMATION(p, r); + r->out.result = _netr_GetForestTrustInformation(p, r); if (p->rng_fault_state) { talloc_free(r); @@ -3511,7 +3592,7 @@ static bool api_netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p) } if (DEBUGLEVEL >= 10) { - NDR_PRINT_OUT_DEBUG(netr_NETRGETFORESTTRUSTINFORMATION, r); + NDR_PRINT_OUT_DEBUG(netr_GetForestTrustInformation, r); } push = ndr_push_init_ctx(r); @@ -3721,7 +3802,7 @@ static struct api_struct api_netlogon_cmds[] = {"NETR_DATABASESYNC2", NDR_NETR_DATABASESYNC2, api_netr_DatabaseSync2}, {"NETR_DATABASEREDO", NDR_NETR_DATABASEREDO, api_netr_DatabaseRedo}, {"NETR_LOGONCONTROL2EX", NDR_NETR_LOGONCONTROL2EX, api_netr_LogonControl2Ex}, - {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NETRENUMERATETRUSTEDDOMAINS}, + {"NETR_NETRENUMERATETRUSTEDDOMAINS", NDR_NETR_NETRENUMERATETRUSTEDDOMAINS, api_netr_NetrEnumerateTrustedDomains}, {"NETR_DSRGETDCNAME", NDR_NETR_DSRGETDCNAME, api_netr_DsRGetDCName}, {"NETR_NETRLOGONDUMMYROUTINE1", NDR_NETR_NETRLOGONDUMMYROUTINE1, api_netr_NETRLOGONDUMMYROUTINE1}, {"NETR_NETRLOGONSETSERVICEBITS", NDR_NETR_NETRLOGONSETSERVICEBITS, api_netr_NETRLOGONSETSERVICEBITS}, @@ -3733,20 +3814,20 @@ static struct api_struct api_netlogon_cmds[] = {"NETR_DSRGETSITENAME", NDR_NETR_DSRGETSITENAME, api_netr_DsRGetSiteName}, {"NETR_LOGONGETDOMAININFO", NDR_NETR_LOGONGETDOMAININFO, api_netr_LogonGetDomainInfo}, {"NETR_SERVERPASSWORDSET2", NDR_NETR_SERVERPASSWORDSET2, api_netr_ServerPasswordSet2}, - {"NETR_NETRSERVERPASSWORDGET", NDR_NETR_NETRSERVERPASSWORDGET, api_netr_NETRSERVERPASSWORDGET}, + {"NETR_SERVERPASSWORDGET", NDR_NETR_SERVERPASSWORDGET, api_netr_ServerPasswordGet}, {"NETR_NETRLOGONSENDTOSAM", NDR_NETR_NETRLOGONSENDTOSAM, api_netr_NETRLOGONSENDTOSAM}, - {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DSRADDRESSTOSITENAMESW}, + {"NETR_DSRADDRESSTOSITENAMESW", NDR_NETR_DSRADDRESSTOSITENAMESW, api_netr_DsRAddressToSitenamesW}, {"NETR_DSRGETDCNAMEEX2", NDR_NETR_DSRGETDCNAMEEX2, api_netr_DsRGetDCNameEx2}, {"NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN", NDR_NETR_NETRLOGONGETTIMESERVICEPARENTDOMAIN, api_netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN}, - {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NETRENUMERATETRUSTEDDOMAINSEX}, - {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DSRADDRESSTOSITENAMESEXW}, - {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DSRGETDCSITECOVERAGEW}, + {"NETR_NETRENUMERATETRUSTEDDOMAINSEX", NDR_NETR_NETRENUMERATETRUSTEDDOMAINSEX, api_netr_NetrEnumerateTrustedDomainsEx}, + {"NETR_DSRADDRESSTOSITENAMESEXW", NDR_NETR_DSRADDRESSTOSITENAMESEXW, api_netr_DsRAddressToSitenamesExW}, + {"NETR_DSRGETDCSITECOVERAGEW", NDR_NETR_DSRGETDCSITECOVERAGEW, api_netr_DsrGetDcSiteCoverageW}, {"NETR_LOGONSAMLOGONEX", NDR_NETR_LOGONSAMLOGONEX, api_netr_LogonSamLogonEx}, {"NETR_DSRENUMERATEDOMAINTRUSTS", NDR_NETR_DSRENUMERATEDOMAINTRUSTS, api_netr_DsrEnumerateDomainTrusts}, {"NETR_DSRDEREGISTERDNSHOSTRECORDS", NDR_NETR_DSRDEREGISTERDNSHOSTRECORDS, api_netr_DSRDEREGISTERDNSHOSTRECORDS}, - {"NETR_NETRSERVERTRUSTPASSWORDSGET", NDR_NETR_NETRSERVERTRUSTPASSWORDSGET, api_netr_NETRSERVERTRUSTPASSWORDSGET}, - {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DSRGETFORESTTRUSTINFORMATION}, - {"NETR_NETRGETFORESTTRUSTINFORMATION", NDR_NETR_NETRGETFORESTTRUSTINFORMATION, api_netr_NETRGETFORESTTRUSTINFORMATION}, + {"NETR_SERVERTRUSTPASSWORDSGET", NDR_NETR_SERVERTRUSTPASSWORDSGET, api_netr_ServerTrustPasswordsGet}, + {"NETR_DSRGETFORESTTRUSTINFORMATION", NDR_NETR_DSRGETFORESTTRUSTINFORMATION, api_netr_DsRGetForestTrustInformation}, + {"NETR_GETFORESTTRUSTINFORMATION", NDR_NETR_GETFORESTTRUSTINFORMATION, api_netr_GetForestTrustInformation}, {"NETR_LOGONSAMLOGONWITHFLAGS", NDR_NETR_LOGONSAMLOGONWITHFLAGS, api_netr_LogonSamLogonWithFlags}, {"NETR_NETRSERVERGETTRUSTINFO", NDR_NETR_NETRSERVERGETTRUSTINFO, api_netr_NETRSERVERGETTRUSTINFO}, }; diff --git a/source3/librpc/gen_ndr/srv_netlogon.h b/source3/librpc/gen_ndr/srv_netlogon.h index 8350f437cd..dc91cf5c0c 100644 --- a/source3/librpc/gen_ndr/srv_netlogon.h +++ b/source3/librpc/gen_ndr/srv_netlogon.h @@ -20,7 +20,7 @@ NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, struct netr_ServerAuthentica NTSTATUS _netr_DatabaseSync2(pipes_struct *p, struct netr_DatabaseSync2 *r); NTSTATUS _netr_DatabaseRedo(pipes_struct *p, struct netr_DatabaseRedo *r); WERROR _netr_LogonControl2Ex(pipes_struct *p, struct netr_LogonControl2Ex *r); -WERROR _netr_NETRENUMERATETRUSTEDDOMAINS(pipes_struct *p, struct netr_NETRENUMERATETRUSTEDDOMAINS *r); +WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, struct netr_NetrEnumerateTrustedDomains *r); WERROR _netr_DsRGetDCName(pipes_struct *p, struct netr_DsRGetDCName *r); WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, struct netr_NETRLOGONDUMMYROUTINE1 *r); WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, struct netr_NETRLOGONSETSERVICEBITS *r); @@ -32,20 +32,20 @@ WERROR _netr_DsRGetDCNameEx(pipes_struct *p, struct netr_DsRGetDCNameEx *r); WERROR _netr_DsRGetSiteName(pipes_struct *p, struct netr_DsRGetSiteName *r); NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, struct netr_LogonGetDomainInfo *r); NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, struct netr_ServerPasswordSet2 *r); -WERROR _netr_NETRSERVERPASSWORDGET(pipes_struct *p, struct netr_NETRSERVERPASSWORDGET *r); +WERROR _netr_ServerPasswordGet(pipes_struct *p, struct netr_ServerPasswordGet *r); WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, struct netr_NETRLOGONSENDTOSAM *r); -WERROR _netr_DSRADDRESSTOSITENAMESW(pipes_struct *p, struct netr_DSRADDRESSTOSITENAMESW *r); +WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, struct netr_DsRAddressToSitenamesW *r); WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, struct netr_DsRGetDCNameEx2 *r); WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r); -WERROR _netr_NETRENUMERATETRUSTEDDOMAINSEX(pipes_struct *p, struct netr_NETRENUMERATETRUSTEDDOMAINSEX *r); -WERROR _netr_DSRADDRESSTOSITENAMESEXW(pipes_struct *p, struct netr_DSRADDRESSTOSITENAMESEXW *r); -WERROR _netr_DSRGETDCSITECOVERAGEW(pipes_struct *p, struct netr_DSRGETDCSITECOVERAGEW *r); +WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, struct netr_NetrEnumerateTrustedDomainsEx *r); +WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, struct netr_DsRAddressToSitenamesExW *r); +WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, struct netr_DsrGetDcSiteCoverageW *r); NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, struct netr_LogonSamLogonEx *r); WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, struct netr_DsrEnumerateDomainTrusts *r); WERROR _netr_DSRDEREGISTERDNSHOSTRECORDS(pipes_struct *p, struct netr_DSRDEREGISTERDNSHOSTRECORDS *r); -WERROR _netr_NETRSERVERTRUSTPASSWORDSGET(pipes_struct *p, struct netr_NETRSERVERTRUSTPASSWORDSGET *r); -WERROR _netr_DSRGETFORESTTRUSTINFORMATION(pipes_struct *p, struct netr_DSRGETFORESTTRUSTINFORMATION *r); -WERROR _netr_NETRGETFORESTTRUSTINFORMATION(pipes_struct *p, struct netr_NETRGETFORESTTRUSTINFORMATION *r); +NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, struct netr_ServerTrustPasswordsGet *r); +WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, struct netr_DsRGetForestTrustInformation *r); +WERROR _netr_GetForestTrustInformation(pipes_struct *p, struct netr_GetForestTrustInformation *r); NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, struct netr_LogonSamLogonWithFlags *r); WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p, struct netr_NETRSERVERGETTRUSTINFO *r); void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns); -- cgit From 101f275b988185ed3e47bc8061483a781c4d47c9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:11:28 +0100 Subject: Use pidl generated data from misc.idl. Guenther (This used to be commit 5d8e5cbc3b3ddd1c5788d66f252e4801739243bb) --- source3/Makefile.in | 11 ++- source3/include/smb.h | 20 ++--- source3/librpc/gen_ndr/misc.h | 73 +++++++++++++++ source3/librpc/gen_ndr/ndr_misc.c | 185 ++++++++++++++++++++++++++++++++++++++ source3/librpc/gen_ndr/ndr_misc.h | 30 ++++++- source3/librpc/ndr/libndr.h | 2 +- source3/librpc/ndr/misc.h | 42 --------- source3/librpc/ndr/ndr_misc.c | 68 -------------- 8 files changed, 306 insertions(+), 125 deletions(-) create mode 100644 source3/librpc/gen_ndr/misc.h create mode 100644 source3/librpc/gen_ndr/ndr_misc.c delete mode 100644 source3/librpc/ndr/misc.h diff --git a/source3/Makefile.in b/source3/Makefile.in index 265d14547c..8a4925e821 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -253,8 +253,13 @@ ERRORMAP_OBJ = libsmb/errormap.o PASSCHANGE_OBJ = libsmb/passchange.o -LIBNDR_OBJ = librpc/ndr/ndr_basic.o librpc/ndr/ndr.o librpc/ndr/ndr_misc.o \ - librpc/ndr/ndr_sec_helper.o librpc/ndr/ndr_string.o librpc/ndr/sid.o \ +LIBNDR_OBJ = librpc/ndr/ndr_basic.o \ + librpc/ndr/ndr.o \ + librpc/ndr/ndr_misc.o \ + librpc/gen_ndr/ndr_misc.o \ + librpc/ndr/ndr_sec_helper.o \ + librpc/ndr/ndr_string.o \ + librpc/ndr/sid.o \ librpc/ndr/uuid.o RPCCLIENT_NDR_OBJ = rpc_client/ndr.o @@ -1064,7 +1069,7 @@ modules: SHOWFLAGS $(MODULES) ## Perl IDL Compiler IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl \ srvsvc.idl svcctl.idl eventlog.idl wkssvc.idl netlogon.idl notify.idl \ - epmapper.idl messaging.idl xattr.idl + epmapper.idl messaging.idl xattr.idl misc.idl idl: @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \ diff --git a/source3/include/smb.h b/source3/include/smb.h index 744acd719f..350584a52e 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -310,7 +310,16 @@ struct id_map { enum id_mapping status; }; -#include "librpc/ndr/misc.h" +/* used to hold an arbitrary blob of data */ +typedef struct data_blob { + uint8 *data; + size_t length; + void (*free)(struct data_blob *data_blob); +} DATA_BLOB; + +extern const DATA_BLOB data_blob_null; + +#include "librpc/gen_ndr/misc.h" #include "librpc/ndr/security.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/lsa.h" @@ -532,15 +541,6 @@ typedef struct files_struct { #include "ntquotas.h" #include "sysquotas.h" -/* used to hold an arbitrary blob of data */ -typedef struct data_blob { - uint8 *data; - size_t length; - void (*free)(struct data_blob *data_blob); -} DATA_BLOB; - -extern const DATA_BLOB data_blob_null; - /* * Structure used to keep directory state information around. * Used in NT change-notify code. diff --git a/source3/librpc/gen_ndr/misc.h b/source3/librpc/gen_ndr/misc.h new file mode 100644 index 0000000000..4fa7415db7 --- /dev/null +++ b/source3/librpc/gen_ndr/misc.h @@ -0,0 +1,73 @@ +/* header auto-generated by pidl */ + +#include + +#ifndef _HEADER_misc +#define _HEADER_misc + +struct GUID { + uint32_t time_low; + uint16_t time_mid; + uint16_t time_hi_and_version; + uint8_t clock_seq[2]; + uint8_t node[6]; +}/* [noprint,gensize,public,noejs] */; + +struct ndr_syntax_id { + struct GUID uuid; + uint32_t if_version; +}/* [public] */; + +struct policy_handle { + uint32_t handle_type; + struct GUID uuid; +}/* [public] */; + +enum netr_SchannelType +#ifndef USE_UINT_ENUMS + { + SEC_CHAN_WKSTA=2, + SEC_CHAN_DOMAIN=4, + SEC_CHAN_BDC=6 +} +#else + { __donnot_use_enum_netr_SchannelType=0x7FFFFFFF} +#define SEC_CHAN_WKSTA ( 2 ) +#define SEC_CHAN_DOMAIN ( 4 ) +#define SEC_CHAN_BDC ( 6 ) +#endif +; + +enum netr_SamDatabaseID +#ifndef USE_UINT_ENUMS + { + SAM_DATABASE_DOMAIN=0, + SAM_DATABASE_BUILTIN=1, + SAM_DATABASE_PRIVS=2 +} +#else + { __donnot_use_enum_netr_SamDatabaseID=0x7FFFFFFF} +#define SAM_DATABASE_DOMAIN ( 0 ) +#define SAM_DATABASE_BUILTIN ( 1 ) +#define SAM_DATABASE_PRIVS ( 2 ) +#endif +; + +enum samr_RejectReason +#ifndef USE_UINT_ENUMS + { + SAMR_REJECT_OTHER=0, + SAMR_REJECT_TOO_SHORT=1, + SAMR_REJECT_IN_HISTORY=2, + SAMR_REJECT_COMPLEXITY=5 +} +#else + { __donnot_use_enum_samr_RejectReason=0x7FFFFFFF} +#define SAMR_REJECT_OTHER ( 0 ) +#define SAMR_REJECT_TOO_SHORT ( 1 ) +#define SAMR_REJECT_IN_HISTORY ( 2 ) +#define SAMR_REJECT_COMPLEXITY ( 5 ) +#endif +; + +#endif /* _HEADER_misc */ diff --git a/source3/librpc/gen_ndr/ndr_misc.c b/source3/librpc/gen_ndr/ndr_misc.c new file mode 100644 index 0000000000..56105d499f --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_misc.c @@ -0,0 +1,185 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_misc.h" + +_PUBLIC_ enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ size_t ndr_size_GUID(const struct GUID *r, int flags) +{ + return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID); +} + +_PUBLIC_ enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->if_version)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->if_version)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r) +{ + ndr_print_struct(ndr, name, "ndr_syntax_id"); + ndr->depth++; + ndr_print_GUID(ndr, "uuid", &r->uuid); + ndr_print_uint32(ndr, "if_version", r->if_version); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type)); + NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type)); + NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r) +{ + ndr_print_struct(ndr, name, "policy_handle"); + ndr->depth++; + ndr_print_uint32(ndr, "handle_type", r->handle_type); + ndr_print_GUID(ndr, "uuid", &r->uuid); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r) +{ + const char *val = NULL; + + switch (r) { + case SEC_CHAN_WKSTA: val = "SEC_CHAN_WKSTA"; break; + case SEC_CHAN_DOMAIN: val = "SEC_CHAN_DOMAIN"; break; + case SEC_CHAN_BDC: val = "SEC_CHAN_BDC"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r) +{ + const char *val = NULL; + + switch (r) { + case SAM_DATABASE_DOMAIN: val = "SAM_DATABASE_DOMAIN"; break; + case SAM_DATABASE_BUILTIN: val = "SAM_DATABASE_BUILTIN"; break; + case SAM_DATABASE_PRIVS: val = "SAM_DATABASE_PRIVS"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r) +{ + const char *val = NULL; + + switch (r) { + case SAMR_REJECT_OTHER: val = "SAMR_REJECT_OTHER"; break; + case SAMR_REJECT_TOO_SHORT: val = "SAMR_REJECT_TOO_SHORT"; break; + case SAMR_REJECT_IN_HISTORY: val = "SAMR_REJECT_IN_HISTORY"; break; + case SAMR_REJECT_COMPLEXITY: val = "SAMR_REJECT_COMPLEXITY"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + diff --git a/source3/librpc/gen_ndr/ndr_misc.h b/source3/librpc/gen_ndr/ndr_misc.h index d43a7d8b4a..a15a781367 100644 --- a/source3/librpc/gen_ndr/ndr_misc.h +++ b/source3/librpc/gen_ndr/ndr_misc.h @@ -1 +1,29 @@ -#include "ndr/ndr_misc.h" +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/misc.h" + +#ifndef _HEADER_NDR_misc +#define _HEADER_NDR_misc + +#define NDR_MISC_CALL_COUNT (0) +enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r); +enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r); +void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *r); +size_t ndr_size_GUID(const struct GUID *r, int flags); +enum ndr_err_code ndr_push_ndr_syntax_id(struct ndr_push *ndr, int ndr_flags, const struct ndr_syntax_id *r); +enum ndr_err_code ndr_pull_ndr_syntax_id(struct ndr_pull *ndr, int ndr_flags, struct ndr_syntax_id *r); +void ndr_print_ndr_syntax_id(struct ndr_print *ndr, const char *name, const struct ndr_syntax_id *r); +enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r); +enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r); +void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r); +enum ndr_err_code ndr_push_netr_SchannelType(struct ndr_push *ndr, int ndr_flags, enum netr_SchannelType r); +enum ndr_err_code ndr_pull_netr_SchannelType(struct ndr_pull *ndr, int ndr_flags, enum netr_SchannelType *r); +void ndr_print_netr_SchannelType(struct ndr_print *ndr, const char *name, enum netr_SchannelType r); +enum ndr_err_code ndr_push_netr_SamDatabaseID(struct ndr_push *ndr, int ndr_flags, enum netr_SamDatabaseID r); +enum ndr_err_code ndr_pull_netr_SamDatabaseID(struct ndr_pull *ndr, int ndr_flags, enum netr_SamDatabaseID *r); +void ndr_print_netr_SamDatabaseID(struct ndr_print *ndr, const char *name, enum netr_SamDatabaseID r); +enum ndr_err_code ndr_push_samr_RejectReason(struct ndr_push *ndr, int ndr_flags, enum samr_RejectReason r); +enum ndr_err_code ndr_pull_samr_RejectReason(struct ndr_pull *ndr, int ndr_flags, enum samr_RejectReason *r); +void ndr_print_samr_RejectReason(struct ndr_print *ndr, const char *name, enum samr_RejectReason r); +#endif /* _HEADER_NDR_misc */ diff --git a/source3/librpc/ndr/libndr.h b/source3/librpc/ndr/libndr.h index d0c2c74db9..9c8c401c10 100644 --- a/source3/librpc/ndr/libndr.h +++ b/source3/librpc/ndr/libndr.h @@ -22,7 +22,7 @@ #define _PRINTF_ATTRIBUTE(a,b) -#include "librpc/ndr/misc.h" +#include "librpc/gen_ndr/misc.h" #include "librpc/ndr/security.h" /* diff --git a/source3/librpc/ndr/misc.h b/source3/librpc/ndr/misc.h deleted file mode 100644 index 71975d7858..0000000000 --- a/source3/librpc/ndr/misc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* header auto-generated by pidl */ - -#ifndef _HEADER_misc -#define _HEADER_misc - -struct GUID { - uint32_t time_low; - uint16_t time_mid; - uint16_t time_hi_and_version; - uint8_t clock_seq[2]; - uint8_t node[6]; -}/* [noprint,gensize,public,noejs] */; - -struct ndr_syntax_id { - struct GUID uuid; - uint32_t if_version; -}/* [public] */; - -struct policy_handle { - uint32_t handle_type; - struct GUID uuid; -}/* [public] */; - -enum netr_SchannelType { - SEC_CHAN_WKSTA=2, - SEC_CHAN_DOMAIN=4, - SEC_CHAN_BDC=6 -}; - -enum netr_SamDatabaseID { - SAM_DATABASE_DOMAIN=0, - SAM_DATABASE_BUILTIN=1, - SAM_DATABASE_PRIVS=2 -}; - -enum samr_RejectReason { - SAMR_REJECT_OTHER=0, - SAMR_REJECT_TOO_SHORT=1, - SAMR_REJECT_COMPLEXITY=2 -}; - -#endif /* _HEADER_misc */ diff --git a/source3/librpc/ndr/ndr_misc.c b/source3/librpc/ndr/ndr_misc.c index 245ba45215..c806298ce5 100644 --- a/source3/librpc/ndr/ndr_misc.c +++ b/source3/librpc/ndr/ndr_misc.c @@ -24,41 +24,6 @@ #include "includes.h" -enum ndr_err_code ndr_push_GUID(struct ndr_push *ndr, int ndr_flags, const struct GUID *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->time_low)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_mid)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->time_hi_and_version)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); - NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->node, 6)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_GUID(struct ndr_pull *ndr, int ndr_flags, struct GUID *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->time_low)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_mid)); - NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->time_hi_and_version)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->clock_seq, 2)); - NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->node, 6)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -size_t ndr_size_GUID(const struct GUID *r, int flags) -{ - return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_GUID); -} - /** * see if a range of memory is all zero. A NULL pointer is considered * to be all zero @@ -78,39 +43,6 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID * ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid)); } -enum ndr_err_code ndr_push_policy_handle(struct ndr_push *ndr, int ndr_flags, const struct policy_handle *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handle_type)); - NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->uuid)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -enum ndr_err_code ndr_pull_policy_handle(struct ndr_pull *ndr, int ndr_flags, struct policy_handle *r) -{ - if (ndr_flags & NDR_SCALARS) { - NDR_CHECK(ndr_pull_align(ndr, 4)); - NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handle_type)); - NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->uuid)); - } - if (ndr_flags & NDR_BUFFERS) { - } - return NDR_ERR_SUCCESS; -} - -void ndr_print_policy_handle(struct ndr_print *ndr, const char *name, const struct policy_handle *r) -{ - ndr_print_struct(ndr, name, "policy_handle"); - ndr->depth++; - ndr_print_uint32(ndr, "handle_type", r->handle_type); - ndr_print_GUID(ndr, "uuid", &r->uuid); - ndr->depth--; -} - enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r) { if (ndr_flags & NDR_SCALARS) { -- cgit From 7faee16966d82266046c1267b9d8c20614e73b5f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:15:30 +0100 Subject: Re-run make idl to generate SAMR output. Guenther (This used to be commit b4c1904022cd34c239f163d49d5a13925d238cda) --- source3/Makefile.in | 2 +- source3/librpc/gen_ndr/cli_samr.c | 3030 +++++++++ source3/librpc/gen_ndr/cli_samr.h | 389 ++ source3/librpc/gen_ndr/ndr_samr.c | 12290 ++++++++++++++++++++++++++++++++++++ source3/librpc/gen_ndr/ndr_samr.h | 340 + source3/librpc/gen_ndr/samr.h | 1754 +++++ source3/librpc/gen_ndr/srv_samr.c | 5482 ++++++++++++++++ source3/librpc/gen_ndr/srv_samr.h | 74 + 8 files changed, 23360 insertions(+), 1 deletion(-) create mode 100644 source3/librpc/gen_ndr/cli_samr.c create mode 100644 source3/librpc/gen_ndr/cli_samr.h create mode 100644 source3/librpc/gen_ndr/ndr_samr.c create mode 100644 source3/librpc/gen_ndr/ndr_samr.h create mode 100644 source3/librpc/gen_ndr/samr.h create mode 100644 source3/librpc/gen_ndr/srv_samr.c create mode 100644 source3/librpc/gen_ndr/srv_samr.h diff --git a/source3/Makefile.in b/source3/Makefile.in index 8a4925e821..dd49b9b33b 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -1069,7 +1069,7 @@ modules: SHOWFLAGS $(MODULES) ## Perl IDL Compiler IDL_FILES = unixinfo.idl lsa.idl dfs.idl echo.idl winreg.idl initshutdown.idl \ srvsvc.idl svcctl.idl eventlog.idl wkssvc.idl netlogon.idl notify.idl \ - epmapper.idl messaging.idl xattr.idl misc.idl + epmapper.idl messaging.idl xattr.idl misc.idl samr.idl idl: @IDL_FILES="$(IDL_FILES)" CPP="$(CPP)" PERL="$(PERL)" \ diff --git a/source3/librpc/gen_ndr/cli_samr.c b/source3/librpc/gen_ndr/cli_samr.c new file mode 100644 index 0000000000..99e7e45b02 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_samr.c @@ -0,0 +1,3030 @@ +/* + * Unix SMB/CIFS implementation. + * client auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/cli_samr.h" + +NTSTATUS rpccli_samr_Connect(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *connect_handle) +{ + struct samr_Connect r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CONNECT, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *connect_handle = *r.out.connect_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Close(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + struct samr_Close r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Close, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CLOSE, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Close, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *handle = *r.out.handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf) +{ + struct samr_SetSecurity r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.sec_info = sec_info; + r.in.sdbuf = sdbuf; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetSecurity, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETSECURITY, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetSecurity, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QuerySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf) +{ + struct samr_QuerySecurity r; + NTSTATUS status; + + /* In parameters */ + r.in.handle = handle; + r.in.sec_info = sec_info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QuerySecurity, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYSECURITY, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sdbuf = *r.out.sdbuf; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Shutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle) +{ + struct samr_Shutdown r; + NTSTATUS status; + + /* In parameters */ + r.in.connect_handle = connect_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Shutdown, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SHUTDOWN, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Shutdown, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_LookupDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + struct lsa_String *domain_name, + struct dom_sid2 *sid) +{ + struct samr_LookupDomain r; + NTSTATUS status; + + /* In parameters */ + r.in.connect_handle = connect_handle; + r.in.domain_name = domain_name; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupDomain, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_LOOKUPDOMAIN, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupDomain, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sid = *r.out.sid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t *resume_handle, + uint32_t buf_size, + struct samr_SamArray *sam, + uint32_t *num_entries) +{ + struct samr_EnumDomains r; + NTSTATUS status; + + /* In parameters */ + r.in.connect_handle = connect_handle; + r.in.resume_handle = resume_handle; + r.in.buf_size = buf_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomains, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ENUMDOMAINS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomains, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *resume_handle = *r.out.resume_handle; + *sam = *r.out.sam; + *num_entries = *r.out.num_entries; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t access_mask, + struct dom_sid2 *sid, + struct policy_handle *domain_handle) +{ + struct samr_OpenDomain r; + NTSTATUS status; + + /* In parameters */ + r.in.connect_handle = connect_handle; + r.in.access_mask = access_mask; + r.in.sid = sid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenDomain, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_OPENDOMAIN, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenDomain, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *domain_handle = *r.out.domain_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info) +{ + struct samr_QueryDomainInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYDOMAININFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info) +{ + struct samr_SetDomainInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.info = info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETDOMAININFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_CreateDomainGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *name, + uint32_t access_mask, + struct policy_handle *group_handle, + uint32_t *rid) +{ + struct samr_CreateDomainGroup r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.name = name; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CREATEDOMAINGROUP, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *group_handle = *r.out.group_handle; + *rid = *r.out.rid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_EnumDomainGroups(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t max_size, + struct samr_SamArray *sam, + uint32_t *num_entries) +{ + struct samr_EnumDomainGroups r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.resume_handle = resume_handle; + r.in.max_size = max_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ENUMDOMAINGROUPS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *resume_handle = *r.out.resume_handle; + *sam = *r.out.sam; + *num_entries = *r.out.num_entries; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_CreateUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *account_name, + uint32_t access_mask, + struct policy_handle *user_handle, + uint32_t *rid) +{ + struct samr_CreateUser r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.account_name = account_name; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CREATEUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *user_handle = *r.out.user_handle; + *rid = *r.out.rid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t acct_flags, + uint32_t max_size, + struct samr_SamArray *sam, + uint32_t *num_entries) +{ + struct samr_EnumDomainUsers r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.resume_handle = resume_handle; + r.in.acct_flags = acct_flags; + r.in.max_size = max_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ENUMDOMAINUSERS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *resume_handle = *r.out.resume_handle; + *sam = *r.out.sam; + *num_entries = *r.out.num_entries; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_CreateDomAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *alias_name, + uint32_t access_mask, + struct policy_handle *alias_handle, + uint32_t *rid) +{ + struct samr_CreateDomAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.alias_name = alias_name; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CREATEDOMALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *alias_handle = *r.out.alias_handle; + *rid = *r.out.rid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_EnumDomainAliases(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t acct_flags, + struct samr_SamArray *sam, + uint32_t *num_entries) +{ + struct samr_EnumDomainAliases r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.resume_handle = resume_handle; + r.in.acct_flags = acct_flags; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ENUMDOMAINALIASES, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *resume_handle = *r.out.resume_handle; + *sam = *r.out.sam; + *num_entries = *r.out.num_entries; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetAliasMembership(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_SidArray *sids, + struct samr_Ids *rids) +{ + struct samr_GetAliasMembership r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.sids = sids; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETALIASMEMBERSHIP, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *rids = *r.out.rids; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_LookupNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t num_names, + struct lsa_String *names, + struct samr_Ids *rids, + struct samr_Ids *types) +{ + struct samr_LookupNames r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.num_names = num_names; + r.in.names = names; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupNames, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_LOOKUPNAMES, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupNames, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *rids = *r.out.rids; + *types = *r.out.types; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_LookupRids(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t num_rids, + uint32_t *rids, + struct lsa_Strings *names, + struct samr_Ids *types) +{ + struct samr_LookupRids r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.num_rids = num_rids; + r.in.rids = rids; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupRids, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_LOOKUPRIDS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupRids, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *names = *r.out.names; + *types = *r.out.types; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_OpenGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *group_handle) +{ + struct samr_OpenGroup r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.access_mask = access_mask; + r.in.rid = rid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenGroup, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_OPENGROUP, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenGroup, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *group_handle = *r.out.group_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryGroupInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + enum samr_GroupInfoEnum level, + union samr_GroupInfo *info) +{ + struct samr_QueryGroupInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYGROUPINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetGroupInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + enum samr_GroupInfoEnum level, + union samr_GroupInfo *info) +{ + struct samr_SetGroupInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + r.in.level = level; + r.in.info = info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETGROUPINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_AddGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t rid, + uint32_t flags) +{ + struct samr_AddGroupMember r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + r.in.rid = rid; + r.in.flags = flags; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddGroupMember, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ADDGROUPMEMBER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_DeleteDomainGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle) +{ + struct samr_DeleteDomainGroup r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_DELETEDOMAINGROUP, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *group_handle = *r.out.group_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_DeleteGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t rid) +{ + struct samr_DeleteGroupMember r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + r.in.rid = rid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_DELETEGROUPMEMBER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + struct samr_RidTypeArray *rids) +{ + struct samr_QueryGroupMember r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYGROUPMEMBER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *rids = *r.out.rids; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetMemberAttributesOfGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t unknown1, + uint32_t unknown2) +{ + struct samr_SetMemberAttributesOfGroup r; + NTSTATUS status; + + /* In parameters */ + r.in.group_handle = group_handle; + r.in.unknown1 = unknown1; + r.in.unknown2 = unknown2; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_OpenAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *alias_handle) +{ + struct samr_OpenAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.access_mask = access_mask; + r.in.rid = rid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_OPENALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *alias_handle = *r.out.alias_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryAliasInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + enum samr_AliasInfoEnum level, + union samr_AliasInfo *info) +{ + struct samr_QueryAliasInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYALIASINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetAliasInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + enum samr_AliasInfoEnum level, + union samr_AliasInfo *info) +{ + struct samr_SetAliasInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.level = level; + r.in.info = info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETALIASINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_DeleteDomAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle) +{ + struct samr_DeleteDomAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_DELETEDOMALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *alias_handle = *r.out.alias_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_AddAliasMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct dom_sid2 *sid) +{ + struct samr_AddAliasMember r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.sid = sid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddAliasMember, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ADDALIASMEMBER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_DeleteAliasMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct dom_sid2 *sid) +{ + struct samr_DeleteAliasMember r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.sid = sid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_DELETEALIASMEMBER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetMembersInAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids) +{ + struct samr_GetMembersInAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETMEMBERSINALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sids = *r.out.sids; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_OpenUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *user_handle) +{ + struct samr_OpenUser r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.access_mask = access_mask; + r.in.rid = rid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_OPENUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *user_handle = *r.out.user_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_DeleteUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle) +{ + struct samr_DeleteUser r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_DELETEUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *user_handle = *r.out.user_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryUserInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info) +{ + struct samr_QueryUserInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYUSERINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetUserInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info) +{ + struct samr_SetUserInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + r.in.level = level; + r.in.info = info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetUserInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETUSERINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_ChangePasswordUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint8_t lm_present, + struct samr_Password *old_lm_crypted, + struct samr_Password *new_lm_crypted, + uint8_t nt_present, + struct samr_Password *old_nt_crypted, + struct samr_Password *new_nt_crypted, + uint8_t cross1_present, + struct samr_Password *nt_cross, + uint8_t cross2_present, + struct samr_Password *lm_cross) +{ + struct samr_ChangePasswordUser r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + r.in.lm_present = lm_present; + r.in.old_lm_crypted = old_lm_crypted; + r.in.new_lm_crypted = new_lm_crypted; + r.in.nt_present = nt_present; + r.in.old_nt_crypted = old_nt_crypted; + r.in.new_nt_crypted = new_nt_crypted; + r.in.cross1_present = cross1_present; + r.in.nt_cross = nt_cross; + r.in.cross2_present = cross2_present; + r.in.lm_cross = lm_cross; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CHANGEPASSWORDUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetGroupsForUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + struct samr_RidWithAttributeArray *rids) +{ + struct samr_GetGroupsForUser r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETGROUPSFORUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *rids = *r.out.rids; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryDisplayInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info) +{ + struct samr_QueryDisplayInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.start_idx = start_idx; + r.in.max_entries = max_entries; + r.in.buf_size = buf_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYDISPLAYINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *total_size = *r.out.total_size; + *returned_size = *r.out.returned_size; + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetDisplayEnumerationIndex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + struct lsa_String name, + uint32_t *idx) +{ + struct samr_GetDisplayEnumerationIndex r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.name = name; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETDISPLAYENUMERATIONINDEX, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *idx = *r.out.idx; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_TestPrivateFunctionsDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle) +{ + struct samr_TestPrivateFunctionsDomain r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_TestPrivateFunctionsUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle) +{ + struct samr_TestPrivateFunctionsUser r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_TESTPRIVATEFUNCTIONSUSER, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetUserPwInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + struct samr_PwInfo *info) +{ + struct samr_GetUserPwInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETUSERPWINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct dom_sid2 *sid) +{ + struct samr_RemoveMemberFromForeignDomain r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.sid = sid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryDomainInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info) +{ + struct samr_QueryDomainInfo2 r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYDOMAININFO2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryUserInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info) +{ + struct samr_QueryUserInfo2 r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + r.in.level = level; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYUSERINFO2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryDisplayInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info) +{ + struct samr_QueryDisplayInfo2 r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.start_idx = start_idx; + r.in.max_entries = max_entries; + r.in.buf_size = buf_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYDISPLAYINFO2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *total_size = *r.out.total_size; + *returned_size = *r.out.returned_size; + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + struct lsa_String name, + uint32_t *idx) +{ + struct samr_GetDisplayEnumerationIndex2 r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.name = name; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETDISPLAYENUMERATIONINDEX2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *idx = *r.out.idx; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_CreateUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *account_name, + uint32_t acct_flags, + uint32_t access_mask, + struct policy_handle *user_handle, + uint32_t *access_granted, + uint32_t *rid) +{ + struct samr_CreateUser2 r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.account_name = account_name; + r.in.acct_flags = acct_flags; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateUser2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CREATEUSER2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateUser2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *user_handle = *r.out.user_handle; + *access_granted = *r.out.access_granted; + *rid = *r.out.rid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_QueryDisplayInfo3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info) +{ + struct samr_QueryDisplayInfo3 r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.level = level; + r.in.start_idx = start_idx; + r.in.max_entries = max_entries; + r.in.buf_size = buf_size; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_QUERYDISPLAYINFO3, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *total_size = *r.out.total_size; + *returned_size = *r.out.returned_size; + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_AddMultipleMembersToAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids) +{ + struct samr_AddMultipleMembersToAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.sids = sids; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids) +{ + struct samr_RemoveMultipleMembersFromAlias r; + NTSTATUS status; + + /* In parameters */ + r.in.alias_handle = alias_handle; + r.in.sids = sids; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_OemChangePasswordUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_AsciiString *server, + struct lsa_AsciiString *account, + struct samr_CryptPassword *password, + struct samr_Password *hash) +{ + struct samr_OemChangePasswordUser2 r; + NTSTATUS status; + + /* In parameters */ + r.in.server = server; + r.in.account = account; + r.in.password = password; + r.in.hash = hash; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_OEMCHANGEPASSWORDUSER2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_ChangePasswordUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *server, + struct lsa_String *account, + struct samr_CryptPassword *nt_password, + struct samr_Password *nt_verifier, + uint8_t lm_change, + struct samr_CryptPassword *lm_password, + struct samr_Password *lm_verifier) +{ + struct samr_ChangePasswordUser2 r; + NTSTATUS status; + + /* In parameters */ + r.in.server = server; + r.in.account = account; + r.in.nt_password = nt_password; + r.in.nt_verifier = nt_verifier; + r.in.lm_change = lm_change; + r.in.lm_password = lm_password; + r.in.lm_verifier = lm_verifier; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CHANGEPASSWORDUSER2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetDomPwInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *domain_name, + struct samr_PwInfo *info) +{ + struct samr_GetDomPwInfo r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_name = domain_name; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETDOMPWINFO, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *info = *r.out.info; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Connect2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t access_mask, + struct policy_handle *connect_handle) +{ + struct samr_Connect2 r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CONNECT2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *connect_handle = *r.out.connect_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetUserInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info) +{ + struct samr_SetUserInfo2 r; + NTSTATUS status; + + /* In parameters */ + r.in.user_handle = user_handle; + r.in.level = level; + r.in.info = info; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETUSERINFO2, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetBootKeyInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t unknown1, + uint32_t unknown2, + uint32_t unknown3) +{ + struct samr_SetBootKeyInformation r; + NTSTATUS status; + + /* In parameters */ + r.in.connect_handle = connect_handle; + r.in.unknown1 = unknown1; + r.in.unknown2 = unknown2; + r.in.unknown3 = unknown3; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETBOOTKEYINFORMATION, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_GetBootKeyInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *unknown) +{ + struct samr_GetBootKeyInformation r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_GETBOOTKEYINFORMATION, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *unknown = *r.out.unknown; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Connect3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *connect_handle) +{ + struct samr_Connect3 r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.unknown = unknown; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect3, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CONNECT3, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect3, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *connect_handle = *r.out.connect_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Connect4(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *connect_handle) +{ + struct samr_Connect4 r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.unknown = unknown; + r.in.access_mask = access_mask; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect4, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CONNECT4, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect4, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *connect_handle = *r.out.connect_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *server, + struct lsa_String *account, + struct samr_CryptPassword *nt_password, + struct samr_Password *nt_verifier, + uint8_t lm_change, + struct samr_CryptPassword *lm_password, + struct samr_Password *lm_verifier, + struct samr_CryptPassword *password3, + struct samr_DomInfo1 *dominfo, + struct samr_ChangeReject *reject) +{ + struct samr_ChangePasswordUser3 r; + NTSTATUS status; + + /* In parameters */ + r.in.server = server; + r.in.account = account; + r.in.nt_password = nt_password; + r.in.nt_verifier = nt_verifier; + r.in.lm_change = lm_change; + r.in.lm_password = lm_password; + r.in.lm_verifier = lm_verifier; + r.in.password3 = password3; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CHANGEPASSWORDUSER3, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *dominfo = *r.out.dominfo; + *reject = *r.out.reject; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t access_mask, + uint32_t level_in, + union samr_ConnectInfo *info_in, + uint32_t *level_out, + union samr_ConnectInfo *info_out, + struct policy_handle *connect_handle) +{ + struct samr_Connect5 r; + NTSTATUS status; + + /* In parameters */ + r.in.system_name = system_name; + r.in.access_mask = access_mask; + r.in.level_in = level_in; + r.in.info_in = info_in; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect5, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_CONNECT5, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect5, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *level_out = *r.out.level_out; + *info_out = *r.out.info_out; + *connect_handle = *r.out.connect_handle; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_RidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t rid, + struct dom_sid2 *sid) +{ + struct samr_RidToSid r; + NTSTATUS status; + + /* In parameters */ + r.in.domain_handle = domain_handle; + r.in.rid = rid; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RidToSid, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_RIDTOSID, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RidToSid, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *sid = *r.out.sid; + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_SetDsrmPassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *name, + uint32_t unknown, + struct samr_Password *hash) +{ + struct samr_SetDsrmPassword r; + NTSTATUS status; + + /* In parameters */ + r.in.name = name; + r.in.unknown = unknown; + r.in.hash = hash; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_SETDSRMPASSWORD, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + + /* Return result */ + return r.out.result; +} + +NTSTATUS rpccli_samr_ValidatePassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum samr_ValidatePasswordLevel level, + union samr_ValidatePasswordReq req, + union samr_ValidatePasswordRep *rep) +{ + struct samr_ValidatePassword r; + NTSTATUS status; + + /* In parameters */ + r.in.level = level; + r.in.req = req; + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ValidatePassword, &r); + } + + status = cli_do_rpc_ndr(cli, + mem_ctx, + PI_SAMR, + &ndr_table_samr, + NDR_SAMR_VALIDATEPASSWORD, + &r); + + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, &r); + } + + if (NT_STATUS_IS_ERR(status)) { + return status; + } + + /* Return variables */ + *rep = *r.out.rep; + + /* Return result */ + return r.out.result; +} + diff --git a/source3/librpc/gen_ndr/cli_samr.h b/source3/librpc/gen_ndr/cli_samr.h new file mode 100644 index 0000000000..23f2d1f1b6 --- /dev/null +++ b/source3/librpc/gen_ndr/cli_samr.h @@ -0,0 +1,389 @@ +#include "librpc/gen_ndr/ndr_samr.h" +#ifndef __CLI_SAMR__ +#define __CLI_SAMR__ +NTSTATUS rpccli_samr_Connect(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + uint16_t *system_name, + uint32_t access_mask, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_Close(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle); +NTSTATUS rpccli_samr_SetSecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf); +NTSTATUS rpccli_samr_QuerySecurity(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + uint32_t sec_info, + struct sec_desc_buf *sdbuf); +NTSTATUS rpccli_samr_Shutdown(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_LookupDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + struct lsa_String *domain_name, + struct dom_sid2 *sid); +NTSTATUS rpccli_samr_EnumDomains(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t *resume_handle, + uint32_t buf_size, + struct samr_SamArray *sam, + uint32_t *num_entries); +NTSTATUS rpccli_samr_OpenDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t access_mask, + struct dom_sid2 *sid, + struct policy_handle *domain_handle); +NTSTATUS rpccli_samr_QueryDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info); +NTSTATUS rpccli_samr_SetDomainInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info); +NTSTATUS rpccli_samr_CreateDomainGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *name, + uint32_t access_mask, + struct policy_handle *group_handle, + uint32_t *rid); +NTSTATUS rpccli_samr_EnumDomainGroups(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t max_size, + struct samr_SamArray *sam, + uint32_t *num_entries); +NTSTATUS rpccli_samr_CreateUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *account_name, + uint32_t access_mask, + struct policy_handle *user_handle, + uint32_t *rid); +NTSTATUS rpccli_samr_EnumDomainUsers(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t acct_flags, + uint32_t max_size, + struct samr_SamArray *sam, + uint32_t *num_entries); +NTSTATUS rpccli_samr_CreateDomAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *alias_name, + uint32_t access_mask, + struct policy_handle *alias_handle, + uint32_t *rid); +NTSTATUS rpccli_samr_EnumDomainAliases(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *resume_handle, + uint32_t acct_flags, + struct samr_SamArray *sam, + uint32_t *num_entries); +NTSTATUS rpccli_samr_GetAliasMembership(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_SidArray *sids, + struct samr_Ids *rids); +NTSTATUS rpccli_samr_LookupNames(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t num_names, + struct lsa_String *names, + struct samr_Ids *rids, + struct samr_Ids *types); +NTSTATUS rpccli_samr_LookupRids(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t num_rids, + uint32_t *rids, + struct lsa_Strings *names, + struct samr_Ids *types); +NTSTATUS rpccli_samr_OpenGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *group_handle); +NTSTATUS rpccli_samr_QueryGroupInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + enum samr_GroupInfoEnum level, + union samr_GroupInfo *info); +NTSTATUS rpccli_samr_SetGroupInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + enum samr_GroupInfoEnum level, + union samr_GroupInfo *info); +NTSTATUS rpccli_samr_AddGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t rid, + uint32_t flags); +NTSTATUS rpccli_samr_DeleteDomainGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle); +NTSTATUS rpccli_samr_DeleteGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t rid); +NTSTATUS rpccli_samr_QueryGroupMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + struct samr_RidTypeArray *rids); +NTSTATUS rpccli_samr_SetMemberAttributesOfGroup(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *group_handle, + uint32_t unknown1, + uint32_t unknown2); +NTSTATUS rpccli_samr_OpenAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *alias_handle); +NTSTATUS rpccli_samr_QueryAliasInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + enum samr_AliasInfoEnum level, + union samr_AliasInfo *info); +NTSTATUS rpccli_samr_SetAliasInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + enum samr_AliasInfoEnum level, + union samr_AliasInfo *info); +NTSTATUS rpccli_samr_DeleteDomAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle); +NTSTATUS rpccli_samr_AddAliasMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct dom_sid2 *sid); +NTSTATUS rpccli_samr_DeleteAliasMember(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct dom_sid2 *sid); +NTSTATUS rpccli_samr_GetMembersInAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids); +NTSTATUS rpccli_samr_OpenUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t access_mask, + uint32_t rid, + struct policy_handle *user_handle); +NTSTATUS rpccli_samr_DeleteUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle); +NTSTATUS rpccli_samr_QueryUserInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info); +NTSTATUS rpccli_samr_SetUserInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info); +NTSTATUS rpccli_samr_ChangePasswordUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint8_t lm_present, + struct samr_Password *old_lm_crypted, + struct samr_Password *new_lm_crypted, + uint8_t nt_present, + struct samr_Password *old_nt_crypted, + struct samr_Password *new_nt_crypted, + uint8_t cross1_present, + struct samr_Password *nt_cross, + uint8_t cross2_present, + struct samr_Password *lm_cross); +NTSTATUS rpccli_samr_GetGroupsForUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + struct samr_RidWithAttributeArray *rids); +NTSTATUS rpccli_samr_QueryDisplayInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info); +NTSTATUS rpccli_samr_GetDisplayEnumerationIndex(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + struct lsa_String name, + uint32_t *idx); +NTSTATUS rpccli_samr_TestPrivateFunctionsDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle); +NTSTATUS rpccli_samr_TestPrivateFunctionsUser(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle); +NTSTATUS rpccli_samr_GetUserPwInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + struct samr_PwInfo *info); +NTSTATUS rpccli_samr_RemoveMemberFromForeignDomain(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct dom_sid2 *sid); +NTSTATUS rpccli_samr_QueryDomainInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + union samr_DomainInfo *info); +NTSTATUS rpccli_samr_QueryUserInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info); +NTSTATUS rpccli_samr_QueryDisplayInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info); +NTSTATUS rpccli_samr_GetDisplayEnumerationIndex2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + struct lsa_String name, + uint32_t *idx); +NTSTATUS rpccli_samr_CreateUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + struct lsa_String *account_name, + uint32_t acct_flags, + uint32_t access_mask, + struct policy_handle *user_handle, + uint32_t *access_granted, + uint32_t *rid); +NTSTATUS rpccli_samr_QueryDisplayInfo3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint16_t level, + uint32_t start_idx, + uint32_t max_entries, + uint32_t buf_size, + uint32_t *total_size, + uint32_t *returned_size, + union samr_DispInfo *info); +NTSTATUS rpccli_samr_AddMultipleMembersToAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids); +NTSTATUS rpccli_samr_RemoveMultipleMembersFromAlias(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *alias_handle, + struct lsa_SidArray *sids); +NTSTATUS rpccli_samr_OemChangePasswordUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_AsciiString *server, + struct lsa_AsciiString *account, + struct samr_CryptPassword *password, + struct samr_Password *hash); +NTSTATUS rpccli_samr_ChangePasswordUser2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *server, + struct lsa_String *account, + struct samr_CryptPassword *nt_password, + struct samr_Password *nt_verifier, + uint8_t lm_change, + struct samr_CryptPassword *lm_password, + struct samr_Password *lm_verifier); +NTSTATUS rpccli_samr_GetDomPwInfo(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *domain_name, + struct samr_PwInfo *info); +NTSTATUS rpccli_samr_Connect2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t access_mask, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_SetUserInfo2(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *user_handle, + uint16_t level, + union samr_UserInfo *info); +NTSTATUS rpccli_samr_SetBootKeyInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *connect_handle, + uint32_t unknown1, + uint32_t unknown2, + uint32_t unknown3); +NTSTATUS rpccli_samr_GetBootKeyInformation(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t *unknown); +NTSTATUS rpccli_samr_Connect3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_Connect4(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t unknown, + uint32_t access_mask, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_ChangePasswordUser3(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *server, + struct lsa_String *account, + struct samr_CryptPassword *nt_password, + struct samr_Password *nt_verifier, + uint8_t lm_change, + struct samr_CryptPassword *lm_password, + struct samr_Password *lm_verifier, + struct samr_CryptPassword *password3, + struct samr_DomInfo1 *dominfo, + struct samr_ChangeReject *reject); +NTSTATUS rpccli_samr_Connect5(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + const char *system_name, + uint32_t access_mask, + uint32_t level_in, + union samr_ConnectInfo *info_in, + uint32_t *level_out, + union samr_ConnectInfo *info_out, + struct policy_handle *connect_handle); +NTSTATUS rpccli_samr_RidToSid(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct policy_handle *domain_handle, + uint32_t rid, + struct dom_sid2 *sid); +NTSTATUS rpccli_samr_SetDsrmPassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + struct lsa_String *name, + uint32_t unknown, + struct samr_Password *hash); +NTSTATUS rpccli_samr_ValidatePassword(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, + enum samr_ValidatePasswordLevel level, + union samr_ValidatePasswordReq req, + union samr_ValidatePasswordRep *rep); +#endif /* __CLI_SAMR__ */ diff --git a/source3/librpc/gen_ndr/ndr_samr.c b/source3/librpc/gen_ndr/ndr_samr.c new file mode 100644 index 0000000000..f407fcf954 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_samr.c @@ -0,0 +1,12290 @@ +/* parser auto-generated by pidl */ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_samr.h" + +#include "librpc/gen_ndr/ndr_misc.h" +#include "librpc/gen_ndr/ndr_lsa.h" +#include "librpc/gen_ndr/ndr_security.h" +_PUBLIC_ enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DISABLED", ACB_DISABLED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_HOMDIRREQ", ACB_HOMDIRREQ, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PWNOTREQ", ACB_PWNOTREQ, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_TEMPDUP", ACB_TEMPDUP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NORMAL", ACB_NORMAL, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_MNS", ACB_MNS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DOMTRUST", ACB_DOMTRUST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_WSTRUST", ACB_WSTRUST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_SVRTRUST", ACB_SVRTRUST, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PWNOEXP", ACB_PWNOEXP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_AUTOLOCK", ACB_AUTOLOCK, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_ENC_TXT_PWD_ALLOWED", ACB_ENC_TXT_PWD_ALLOWED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_SMARTCARD_REQUIRED", ACB_SMARTCARD_REQUIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_TRUSTED_FOR_DELEGATION", ACB_TRUSTED_FOR_DELEGATION, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NOT_DELEGATED", ACB_NOT_DELEGATED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_USE_DES_KEY_ONLY", ACB_USE_DES_KEY_ONLY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_DONT_REQUIRE_PREAUTH", ACB_DONT_REQUIRE_PREAUTH, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_PW_EXPIRED", ACB_PW_EXPIRED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ACB_NO_AUTH_DATA_REQD", ACB_NO_AUTH_DATA_REQD, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ConnectAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ConnectAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_CONNECT_TO_SERVER", SAMR_ACCESS_CONNECT_TO_SERVER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_SHUTDOWN_SERVER", SAMR_ACCESS_SHUTDOWN_SERVER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_INITIALIZE_SERVER", SAMR_ACCESS_INITIALIZE_SERVER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_CREATE_DOMAIN", SAMR_ACCESS_CREATE_DOMAIN, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_ENUM_DOMAINS", SAMR_ACCESS_ENUM_DOMAINS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_ACCESS_OPEN_DOMAIN", SAMR_ACCESS_OPEN_DOMAIN, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_NAME_ETC", USER_ACCESS_GET_NAME_ETC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_LOCALE", USER_ACCESS_GET_LOCALE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_LOC_COM", USER_ACCESS_SET_LOC_COM, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_LOGONINFO", USER_ACCESS_GET_LOGONINFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_ATTRIBUTES", USER_ACCESS_GET_ATTRIBUTES, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_ATTRIBUTES", USER_ACCESS_SET_ATTRIBUTES, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_CHANGE_PASSWORD", USER_ACCESS_CHANGE_PASSWORD, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_SET_PASSWORD", USER_ACCESS_SET_PASSWORD, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_GROUPS", USER_ACCESS_GET_GROUPS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_GET_GROUP_MEMBERSHIP", USER_ACCESS_GET_GROUP_MEMBERSHIP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "USER_ACCESS_CHANGE_GROUP_MEMBERSHIP", USER_ACCESS_CHANGE_GROUP_MEMBERSHIP, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomainAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomainAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_INFO_1", DOMAIN_ACCESS_LOOKUP_INFO_1, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_1", DOMAIN_ACCESS_SET_INFO_1, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_INFO_2", DOMAIN_ACCESS_LOOKUP_INFO_2, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_2", DOMAIN_ACCESS_SET_INFO_2, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_USER", DOMAIN_ACCESS_CREATE_USER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_GROUP", DOMAIN_ACCESS_CREATE_GROUP, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_CREATE_ALIAS", DOMAIN_ACCESS_CREATE_ALIAS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_LOOKUP_ALIAS", DOMAIN_ACCESS_LOOKUP_ALIAS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_ENUM_ACCOUNTS", DOMAIN_ACCESS_ENUM_ACCOUNTS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_OPEN_ACCOUNT", DOMAIN_ACCESS_OPEN_ACCOUNT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_ACCESS_SET_INFO_3", DOMAIN_ACCESS_SET_INFO_3, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GroupAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GroupAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_LOOKUP_INFO", GROUP_ACCESS_LOOKUP_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_SET_INFO", GROUP_ACCESS_SET_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_ADD_MEMBER", GROUP_ACCESS_ADD_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_REMOVE_MEMBER", GROUP_ACCESS_REMOVE_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "GROUP_ACCESS_GET_MEMBERS", GROUP_ACCESS_GET_MEMBERS, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AliasAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AliasAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_ADD_MEMBER", ALIAS_ACCESS_ADD_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_REMOVE_MEMBER", ALIAS_ACCESS_REMOVE_MEMBER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_GET_MEMBERS", ALIAS_ACCESS_GET_MEMBERS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_LOOKUP_INFO", ALIAS_ACCESS_LOOKUP_INFO, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "ALIAS_ACCESS_SET_INFO", ALIAS_ACCESS_SET_INFO, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SamEntry(struct ndr_push *ndr, int ndr_flags, const struct samr_SamEntry *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SamEntry(struct ndr_pull *ndr, int ndr_flags, struct samr_SamEntry *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r) +{ + ndr_print_struct(ndr, name, "samr_SamEntry"); + ndr->depth++; + ndr_print_uint32(ndr, "idx", r->idx); + ndr_print_lsa_String(ndr, "name", &r->name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SamArray(struct ndr_push *ndr, int ndr_flags, const struct samr_SamArray *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_SamEntry(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_SamEntry(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SamArray(struct ndr_pull *ndr, int ndr_flags, struct samr_SamArray *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_SamEntry(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_SamEntry(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "samr_SamArray"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_samr_SamEntry(ndr, "entries", &r->entries[cntr_entries_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_Role(struct ndr_push *ndr, int ndr_flags, enum samr_Role r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Role(struct ndr_pull *ndr, int ndr_flags, enum samr_Role *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r) +{ + const char *val = NULL; + + switch (r) { + case SAMR_ROLE_STANDALONE: val = "SAMR_ROLE_STANDALONE"; break; + case SAMR_ROLE_DOMAIN_MEMBER: val = "SAMR_ROLE_DOMAIN_MEMBER"; break; + case SAMR_ROLE_DOMAIN_BDC: val = "SAMR_ROLE_DOMAIN_BDC"; break; + case SAMR_ROLE_DOMAIN_PDC: val = "SAMR_ROLE_DOMAIN_PDC"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_COMPLEX", DOMAIN_PASSWORD_COMPLEX, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_NO_ANON_CHANGE", DOMAIN_PASSWORD_NO_ANON_CHANGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_NO_CLEAR_CHANGE", DOMAIN_PASSWORD_NO_CLEAR_CHANGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_LOCKOUT_ADMINS", DOMAIN_PASSWORD_LOCKOUT_ADMINS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_PASSWORD_STORE_CLEARTEXT", DOMAIN_PASSWORD_STORE_CLEARTEXT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "DOMAIN_REFUSE_PASSWORD_CHANGE", DOMAIN_REFUSE_PASSWORD_CHANGE, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->min_password_length)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->password_history_length)); + NDR_CHECK(ndr_push_samr_PasswordProperties(ndr, NDR_SCALARS, r->password_properties)); + NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->max_password_age)); + NDR_CHECK(ndr_push_dlong(ndr, NDR_SCALARS, r->min_password_age)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->min_password_length)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->password_history_length)); + NDR_CHECK(ndr_pull_samr_PasswordProperties(ndr, NDR_SCALARS, &r->password_properties)); + NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->max_password_age)); + NDR_CHECK(ndr_pull_dlong(ndr, NDR_SCALARS, &r->min_password_age)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo1"); + ndr->depth++; + ndr_print_uint16(ndr, "min_password_length", r->min_password_length); + ndr_print_uint16(ndr, "password_history_length", r->password_history_length); + ndr_print_samr_PasswordProperties(ndr, "password_properties", r->password_properties); + ndr_print_dlong(ndr, "max_password_age", r->max_password_age); + ndr_print_dlong(ndr, "min_password_age", r->min_password_age); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo2(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_logoff_time)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->primary)); + NDR_CHECK(ndr_push_udlong(ndr, NDR_SCALARS, r->sequence_num)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + NDR_CHECK(ndr_push_samr_Role(ndr, NDR_SCALARS, r->role)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown3)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_users)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_groups)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_aliases)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domain_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->primary)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_logoff_time)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->primary)); + NDR_CHECK(ndr_pull_udlong(ndr, NDR_SCALARS, &r->sequence_num)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + NDR_CHECK(ndr_pull_samr_Role(ndr, NDR_SCALARS, &r->role)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown3)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_users)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_groups)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_aliases)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domain_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->primary)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo2"); + ndr->depth++; + ndr_print_NTTIME(ndr, "force_logoff_time", r->force_logoff_time); + ndr_print_lsa_String(ndr, "comment", &r->comment); + ndr_print_lsa_String(ndr, "domain_name", &r->domain_name); + ndr_print_lsa_String(ndr, "primary", &r->primary); + ndr_print_udlong(ndr, "sequence_num", r->sequence_num); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr_print_samr_Role(ndr, "role", r->role); + ndr_print_uint32(ndr, "unknown3", r->unknown3); + ndr_print_uint32(ndr, "num_users", r->num_users); + ndr_print_uint32(ndr, "num_groups", r->num_groups); + ndr_print_uint32(ndr, "num_aliases", r->num_aliases); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo3(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_logoff_time)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_logoff_time)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo3"); + ndr->depth++; + ndr_print_NTTIME(ndr, "force_logoff_time", r->force_logoff_time); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo4(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo4"); + ndr->depth++; + ndr_print_lsa_String(ndr, "comment", &r->comment); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo5(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->domain_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->domain_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->domain_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo5"); + ndr->depth++; + ndr_print_lsa_String(ndr, "domain_name", &r->domain_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo6(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->primary)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->primary)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->primary)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->primary)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo6"); + ndr->depth++; + ndr_print_lsa_String(ndr, "primary", &r->primary); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo7(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_Role(ndr, NDR_SCALARS, r->role)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_Role(ndr, NDR_SCALARS, &r->role)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo7"); + ndr->depth++; + ndr_print_samr_Role(ndr, "role", r->role); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo8(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->sequence_num)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->domain_create_time)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->sequence_num)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->domain_create_time)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo8"); + ndr->depth++; + ndr_print_hyper(ndr, "sequence_num", r->sequence_num); + ndr_print_NTTIME(ndr, "domain_create_time", r->domain_create_time); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo9(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo9"); + ndr->depth++; + ndr_print_uint32(ndr, "unknown", r->unknown); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo11(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo11 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_duration)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_window)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lockout_threshold)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo11 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_duration)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_window)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lockout_threshold)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo11"); + ndr->depth++; + ndr_print_samr_DomInfo2(ndr, "info2", &r->info2); + ndr_print_hyper(ndr, "lockout_duration", r->lockout_duration); + ndr_print_hyper(ndr, "lockout_window", r->lockout_window); + ndr_print_uint16(ndr, "lockout_threshold", r->lockout_threshold); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo12(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo12 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_duration)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->lockout_window)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->lockout_threshold)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo12 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_duration)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->lockout_window)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->lockout_threshold)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo12"); + ndr->depth++; + ndr_print_hyper(ndr, "lockout_duration", r->lockout_duration); + ndr_print_hyper(ndr, "lockout_window", r->lockout_window); + ndr_print_uint16(ndr, "lockout_threshold", r->lockout_threshold); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomInfo13(struct ndr_push *ndr, int ndr_flags, const struct samr_DomInfo13 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->sequence_num)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->domain_create_time)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_DomInfo13 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->sequence_num)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->domain_create_time)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r) +{ + ndr_print_struct(ndr, name, "samr_DomInfo13"); + ndr->depth++; + ndr_print_hyper(ndr, "sequence_num", r->sequence_num); + ndr_print_NTTIME(ndr, "domain_create_time", r->domain_create_time); + ndr_print_uint32(ndr, "unknown1", r->unknown1); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DomainInfo(struct ndr_push *ndr, int ndr_flags, const union samr_DomainInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_DomInfo3(ndr, NDR_SCALARS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_DomInfo5(ndr, NDR_SCALARS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_samr_DomInfo6(ndr, NDR_SCALARS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_push_samr_DomInfo7(ndr, NDR_SCALARS, &r->info7)); + break; + + case 8: + NDR_CHECK(ndr_push_samr_DomInfo8(ndr, NDR_SCALARS, &r->info8)); + break; + + case 9: + NDR_CHECK(ndr_push_samr_DomInfo9(ndr, NDR_SCALARS, &r->info9)); + break; + + case 11: + NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11)); + break; + + case 12: + NDR_CHECK(ndr_push_samr_DomInfo12(ndr, NDR_SCALARS, &r->info12)); + break; + + case 13: + NDR_CHECK(ndr_push_samr_DomInfo13(ndr, NDR_SCALARS, &r->info13)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + break; + + case 2: + NDR_CHECK(ndr_push_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2)); + break; + + case 3: + break; + + case 4: + NDR_CHECK(ndr_push_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_DomInfo5(ndr, NDR_BUFFERS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_samr_DomInfo6(ndr, NDR_BUFFERS, &r->info6)); + break; + + case 7: + break; + + case 8: + break; + + case 9: + break; + + case 11: + NDR_CHECK(ndr_push_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11)); + break; + + case 12: + break; + + case 13: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DomainInfo(struct ndr_pull *ndr, int ndr_flags, union samr_DomainInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, &r->info1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_SCALARS, &r->info2)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_samr_DomInfo3(ndr, NDR_SCALARS, &r->info3)); + break; } + + case 4: { + NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_SCALARS, &r->info4)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_samr_DomInfo5(ndr, NDR_SCALARS, &r->info5)); + break; } + + case 6: { + NDR_CHECK(ndr_pull_samr_DomInfo6(ndr, NDR_SCALARS, &r->info6)); + break; } + + case 7: { + NDR_CHECK(ndr_pull_samr_DomInfo7(ndr, NDR_SCALARS, &r->info7)); + break; } + + case 8: { + NDR_CHECK(ndr_pull_samr_DomInfo8(ndr, NDR_SCALARS, &r->info8)); + break; } + + case 9: { + NDR_CHECK(ndr_pull_samr_DomInfo9(ndr, NDR_SCALARS, &r->info9)); + break; } + + case 11: { + NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_SCALARS, &r->info11)); + break; } + + case 12: { + NDR_CHECK(ndr_pull_samr_DomInfo12(ndr, NDR_SCALARS, &r->info12)); + break; } + + case 13: { + NDR_CHECK(ndr_pull_samr_DomInfo13(ndr, NDR_SCALARS, &r->info13)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + break; + + case 2: + NDR_CHECK(ndr_pull_samr_DomInfo2(ndr, NDR_BUFFERS, &r->info2)); + break; + + case 3: + break; + + case 4: + NDR_CHECK(ndr_pull_samr_DomInfo4(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_pull_samr_DomInfo5(ndr, NDR_BUFFERS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_pull_samr_DomInfo6(ndr, NDR_BUFFERS, &r->info6)); + break; + + case 7: + break; + + case 8: + break; + + case 9: + break; + + case 11: + NDR_CHECK(ndr_pull_samr_DomInfo11(ndr, NDR_BUFFERS, &r->info11)); + break; + + case 12: + break; + + case 13: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_DomainInfo"); + switch (level) { + case 1: + ndr_print_samr_DomInfo1(ndr, "info1", &r->info1); + break; + + case 2: + ndr_print_samr_DomInfo2(ndr, "info2", &r->info2); + break; + + case 3: + ndr_print_samr_DomInfo3(ndr, "info3", &r->info3); + break; + + case 4: + ndr_print_samr_DomInfo4(ndr, "info4", &r->info4); + break; + + case 5: + ndr_print_samr_DomInfo5(ndr, "info5", &r->info5); + break; + + case 6: + ndr_print_samr_DomInfo6(ndr, "info6", &r->info6); + break; + + case 7: + ndr_print_samr_DomInfo7(ndr, "info7", &r->info7); + break; + + case 8: + ndr_print_samr_DomInfo8(ndr, "info8", &r->info8); + break; + + case 9: + ndr_print_samr_DomInfo9(ndr, "info9", &r->info9); + break; + + case 11: + ndr_print_samr_DomInfo11(ndr, "info11", &r->info11); + break; + + case 12: + ndr_print_samr_DomInfo12(ndr, "info12", &r->info12); + break; + + case 13: + ndr_print_samr_DomInfo13(ndr, "info13", &r->info13); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_Ids(struct ndr_push *ndr, int ndr_flags, const struct samr_Ids *r) +{ + uint32_t cntr_ids_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->ids)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->ids) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_ids_1 = 0; cntr_ids_1 < r->count; cntr_ids_1++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->ids[cntr_ids_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Ids(struct ndr_pull *ndr, int ndr_flags, struct samr_Ids *r) +{ + uint32_t _ptr_ids; + uint32_t cntr_ids_1; + TALLOC_CTX *_mem_save_ids_0; + TALLOC_CTX *_mem_save_ids_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + if (r->count < 0 || r->count > 1024) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_ids)); + if (_ptr_ids) { + NDR_PULL_ALLOC(ndr, r->ids); + } else { + r->ids = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->ids) { + _mem_save_ids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->ids, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->ids)); + NDR_PULL_ALLOC_N(ndr, r->ids, ndr_get_array_size(ndr, &r->ids)); + _mem_save_ids_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->ids, 0); + for (cntr_ids_1 = 0; cntr_ids_1 < r->count; cntr_ids_1++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->ids[cntr_ids_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ids_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_ids_0, 0); + } + if (r->ids) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->ids, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r) +{ + uint32_t cntr_ids_1; + ndr_print_struct(ndr, name, "samr_Ids"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "ids", r->ids); + ndr->depth++; + if (r->ids) { + ndr->print(ndr, "%s: ARRAY(%d)", "ids", r->count); + ndr->depth++; + for (cntr_ids_1=0;cntr_ids_1count;cntr_ids_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_ids_1); + if (idx_1) { + ndr_print_uint32(ndr, "ids", r->ids[cntr_ids_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_MANDATORY", SE_GROUP_MANDATORY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_ENABLED_BY_DEFAULT", SE_GROUP_ENABLED_BY_DEFAULT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_ENABLED", SE_GROUP_ENABLED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_OWNER", SE_GROUP_OWNER, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_USE_FOR_DENY_ONLY", SE_GROUP_USE_FOR_DENY_ONLY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_RESOURCE", SE_GROUP_RESOURCE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SE_GROUP_LOGON_ID", SE_GROUP_LOGON_ID, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GroupInfoAll(struct ndr_push *ndr, int ndr_flags, const struct samr_GroupInfoAll *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_members)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAll *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_members)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r) +{ + ndr_print_struct(ndr, name, "samr_GroupInfoAll"); + ndr->depth++; + ndr_print_lsa_String(ndr, "name", &r->name); + ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes); + ndr_print_uint32(ndr, "num_members", r->num_members); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GroupInfoAttributes(struct ndr_push *ndr, int ndr_flags, const struct samr_GroupInfoAttributes *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GroupInfoAttributes(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAttributes *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r) +{ + ndr_print_struct(ndr, name, "samr_GroupInfoAttributes"); + ndr->depth++; + ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GroupInfoEnum(struct ndr_push *ndr, int ndr_flags, enum samr_GroupInfoEnum r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GroupInfoEnum(struct ndr_pull *ndr, int ndr_flags, enum samr_GroupInfoEnum *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r) +{ + const char *val = NULL; + + switch (r) { + case GROUPINFOALL: val = "GROUPINFOALL"; break; + case GROUPINFONAME: val = "GROUPINFONAME"; break; + case GROUPINFOATTRIBUTES: val = "GROUPINFOATTRIBUTES"; break; + case GROUPINFODESCRIPTION: val = "GROUPINFODESCRIPTION"; break; + case GROUPINFOALL2: val = "GROUPINFOALL2"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_samr_GroupInfo(struct ndr_push *ndr, int ndr_flags, const union samr_GroupInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, level)); + switch (level) { + case GROUPINFOALL: + NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all)); + break; + + case GROUPINFONAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name)); + break; + + case GROUPINFOATTRIBUTES: + NDR_CHECK(ndr_push_samr_GroupInfoAttributes(ndr, NDR_SCALARS, &r->attributes)); + break; + + case GROUPINFODESCRIPTION: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + break; + + case GROUPINFOALL2: + NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all2)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case GROUPINFOALL: + NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all)); + break; + + case GROUPINFONAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name)); + break; + + case GROUPINFOATTRIBUTES: + break; + + case GROUPINFODESCRIPTION: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + break; + + case GROUPINFOALL2: + NDR_CHECK(ndr_push_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all2)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, union samr_GroupInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case GROUPINFOALL: { + NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all)); + break; } + + case GROUPINFONAME: { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name)); + break; } + + case GROUPINFOATTRIBUTES: { + NDR_CHECK(ndr_pull_samr_GroupInfoAttributes(ndr, NDR_SCALARS, &r->attributes)); + break; } + + case GROUPINFODESCRIPTION: { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + break; } + + case GROUPINFOALL2: { + NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all2)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case GROUPINFOALL: + NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all)); + break; + + case GROUPINFONAME: + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name)); + break; + + case GROUPINFOATTRIBUTES: + break; + + case GROUPINFODESCRIPTION: + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + break; + + case GROUPINFOALL2: + NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all2)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_GroupInfo"); + switch (level) { + case GROUPINFOALL: + ndr_print_samr_GroupInfoAll(ndr, "all", &r->all); + break; + + case GROUPINFONAME: + ndr_print_lsa_String(ndr, "name", &r->name); + break; + + case GROUPINFOATTRIBUTES: + ndr_print_samr_GroupInfoAttributes(ndr, "attributes", &r->attributes); + break; + + case GROUPINFODESCRIPTION: + ndr_print_lsa_String(ndr, "description", &r->description); + break; + + case GROUPINFOALL2: + ndr_print_samr_GroupInfoAll(ndr, "all2", &r->all2); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_RidTypeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidTypeArray *r) +{ + uint32_t cntr_rids_1; + uint32_t cntr_types_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->rids)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->types)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->rids) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rids[cntr_rids_1])); + } + } + if (r->types) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_types_1 = 0; cntr_types_1 < r->count; cntr_types_1++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->types[cntr_types_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_RidTypeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidTypeArray *r) +{ + uint32_t _ptr_rids; + uint32_t cntr_rids_1; + TALLOC_CTX *_mem_save_rids_0; + TALLOC_CTX *_mem_save_rids_1; + uint32_t _ptr_types; + uint32_t cntr_types_1; + TALLOC_CTX *_mem_save_types_0; + TALLOC_CTX *_mem_save_types_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rids)); + if (_ptr_rids) { + NDR_PULL_ALLOC(ndr, r->rids); + } else { + r->rids = NULL; + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_types)); + if (_ptr_types) { + NDR_PULL_ALLOC(ndr, r->types); + } else { + r->types = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->rids) { + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->rids)); + NDR_PULL_ALLOC_N(ndr, r->rids, ndr_get_array_size(ndr, &r->rids)); + _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0); + for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rids[cntr_rids_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0); + } + if (r->types) { + _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->types, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->types)); + NDR_PULL_ALLOC_N(ndr, r->types, ndr_get_array_size(ndr, &r->types)); + _mem_save_types_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->types, 0); + for (cntr_types_1 = 0; cntr_types_1 < r->count; cntr_types_1++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->types[cntr_types_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, 0); + } + if (r->rids) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->rids, r->count)); + } + if (r->types) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->types, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r) +{ + uint32_t cntr_rids_1; + uint32_t cntr_types_1; + ndr_print_struct(ndr, name, "samr_RidTypeArray"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "rids", r->rids); + ndr->depth++; + if (r->rids) { + ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->count); + ndr->depth++; + for (cntr_rids_1=0;cntr_rids_1count;cntr_rids_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_rids_1); + if (idx_1) { + ndr_print_uint32(ndr, "rids", r->rids[cntr_rids_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr_print_ptr(ndr, "types", r->types); + ndr->depth++; + if (r->types) { + ndr->print(ndr, "%s: ARRAY(%d)", "types", r->count); + ndr->depth++; + for (cntr_types_1=0;cntr_types_1count;cntr_types_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_types_1); + if (idx_1) { + ndr_print_uint32(ndr, "types", r->types[cntr_types_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AliasInfoAll(struct ndr_push *ndr, int ndr_flags, const struct samr_AliasInfoAll *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_members)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AliasInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoAll *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_members)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r) +{ + ndr_print_struct(ndr, name, "samr_AliasInfoAll"); + ndr->depth++; + ndr_print_lsa_String(ndr, "name", &r->name); + ndr_print_uint32(ndr, "num_members", r->num_members); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AliasInfoEnum(struct ndr_push *ndr, int ndr_flags, enum samr_AliasInfoEnum r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AliasInfoEnum(struct ndr_pull *ndr, int ndr_flags, enum samr_AliasInfoEnum *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r) +{ + const char *val = NULL; + + switch (r) { + case ALIASINFOALL: val = "ALIASINFOALL"; break; + case ALIASINFONAME: val = "ALIASINFONAME"; break; + case ALIASINFODESCRIPTION: val = "ALIASINFODESCRIPTION"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_samr_AliasInfo(struct ndr_push *ndr, int ndr_flags, const union samr_AliasInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, level)); + switch (level) { + case ALIASINFOALL: + NDR_CHECK(ndr_push_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all)); + break; + + case ALIASINFONAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name)); + break; + + case ALIASINFODESCRIPTION: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case ALIASINFOALL: + NDR_CHECK(ndr_push_samr_AliasInfoAll(ndr, NDR_BUFFERS, &r->all)); + break; + + case ALIASINFONAME: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name)); + break; + + case ALIASINFODESCRIPTION: + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AliasInfo(struct ndr_pull *ndr, int ndr_flags, union samr_AliasInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case ALIASINFOALL: { + NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all)); + break; } + + case ALIASINFONAME: { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name)); + break; } + + case ALIASINFODESCRIPTION: { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case ALIASINFOALL: + NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_BUFFERS, &r->all)); + break; + + case ALIASINFONAME: + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name)); + break; + + case ALIASINFODESCRIPTION: + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_AliasInfo"); + switch (level) { + case ALIASINFOALL: + ndr_print_samr_AliasInfoAll(ndr, "all", &r->all); + break; + + case ALIASINFONAME: + ndr_print_lsa_String(ndr, "name", &r->name); + break; + + case ALIASINFODESCRIPTION: + ndr_print_lsa_String(ndr, "description", &r->description); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_UserInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo1"); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr_print_lsa_String(ndr, "comment", &r->comment); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo2(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->country_code)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->code_page)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo2(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->country_code)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->code_page)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo2"); + ndr->depth++; + ndr_print_lsa_String(ndr, "comment", &r->comment); + ndr_print_lsa_String(ndr, "unknown", &r->unknown); + ndr_print_uint16(ndr, "country_code", r->country_code); + ndr_print_uint16(ndr, "code_page", r->code_page); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->units_per_week)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->bits)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->bits) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1260)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->units_per_week / 8)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->bits, r->units_per_week / 8)); + } + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r) +{ + uint32_t _ptr_bits; + TALLOC_CTX *_mem_save_bits_0; + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->units_per_week)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_bits)); + if (_ptr_bits) { + NDR_PULL_ALLOC(ndr, r->bits); + } else { + r->bits = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->bits) { + _mem_save_bits_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->bits, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->bits)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->bits)); + if (ndr_get_array_length(ndr, &r->bits) > ndr_get_array_size(ndr, &r->bits)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->bits), ndr_get_array_length(ndr, &r->bits)); + } + NDR_PULL_ALLOC_N(ndr, r->bits, ndr_get_array_size(ndr, &r->bits)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->bits, ndr_get_array_length(ndr, &r->bits))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_bits_0, 0); + } + if (r->bits) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->bits, 1260)); + } + if (r->bits) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->bits, r->units_per_week / 8)); + } + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r) +{ + ndr_print_struct(ndr, name, "samr_LogonHours"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_uint16(ndr, "units_per_week", r->units_per_week); + ndr_print_ptr(ndr, "bits", r->bits); + ndr->depth++; + if (r->bits) { + ndr_print_array_uint8(ndr, "bits", r->bits, r->units_per_week / 8); + } + ndr->depth--; + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_samr_UserInfo3(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->allow_password_change)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_password_change)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo3(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->allow_password_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_password_change)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo3"); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); + ndr_print_lsa_String(ndr, "home_directory", &r->home_directory); + ndr_print_lsa_String(ndr, "home_drive", &r->home_drive); + ndr_print_lsa_String(ndr, "logon_script", &r->logon_script); + ndr_print_lsa_String(ndr, "profile_path", &r->profile_path); + ndr_print_lsa_String(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_password_change", r->last_password_change); + ndr_print_NTTIME(ndr, "allow_password_change", r->allow_password_change); + ndr_print_NTTIME(ndr, "force_password_change", r->force_password_change); + ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours); + ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count); + ndr_print_uint16(ndr, "logon_count", r->logon_count); + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo4(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo4(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo4 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo4"); + ndr->depth++; + ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo5(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo5(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo5 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo5"); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); + ndr_print_lsa_String(ndr, "home_directory", &r->home_directory); + ndr_print_lsa_String(ndr, "home_drive", &r->home_drive); + ndr_print_lsa_String(ndr, "logon_script", &r->logon_script); + ndr_print_lsa_String(ndr, "profile_path", &r->profile_path); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr_print_lsa_String(ndr, "workstations", &r->workstations); + ndr_print_NTTIME(ndr, "last_logon", r->last_logon); + ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff); + ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours); + ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count); + ndr_print_uint16(ndr, "logon_count", r->logon_count); + ndr_print_NTTIME(ndr, "last_password_change", r->last_password_change); + ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry); + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo6(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo6(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo6 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo6"); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo7(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo7(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo7 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo7"); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo8(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo8(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo8 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo8"); + ndr->depth++; + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo9(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo9(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo9 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo9"); + ndr->depth++; + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo10(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo10 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo10(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo10 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo10"); + ndr->depth++; + ndr_print_lsa_String(ndr, "home_directory", &r->home_directory); + ndr_print_lsa_String(ndr, "home_drive", &r->home_drive); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo11(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo11 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo11(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo11 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo11"); + ndr->depth++; + ndr_print_lsa_String(ndr, "logon_script", &r->logon_script); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo12(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo12 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo12(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo12 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo12"); + ndr->depth++; + ndr_print_lsa_String(ndr, "profile_path", &r->profile_path); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo13(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo13 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo13(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo13 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo13"); + ndr->depth++; + ndr_print_lsa_String(ndr, "description", &r->description); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo14(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo14 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo14(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo14 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo14"); + ndr->depth++; + ndr_print_lsa_String(ndr, "workstations", &r->workstations); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo16(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo16 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo16(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo16 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo16"); + ndr->depth++; + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo17(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo17 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo17(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo17 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo17"); + ndr->depth++; + ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo20(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo20 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->parameters)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->parameters)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo20(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo20 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->parameters)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->parameters)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo20"); + ndr->depth++; + ndr_print_lsa_String(ndr, "parameters", &r->parameters); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_FieldsPresent(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_FieldsPresent(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCOUNT_NAME", SAMR_FIELD_ACCOUNT_NAME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_FULL_NAME", SAMR_FIELD_FULL_NAME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_RID", SAMR_FIELD_RID, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PRIMARY_GID", SAMR_FIELD_PRIMARY_GID, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_DESCRIPTION", SAMR_FIELD_DESCRIPTION, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_COMMENT", SAMR_FIELD_COMMENT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_HOME_DIRECTORY", SAMR_FIELD_HOME_DIRECTORY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_HOME_DRIVE", SAMR_FIELD_HOME_DRIVE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LOGON_SCRIPT", SAMR_FIELD_LOGON_SCRIPT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PROFILE_PATH", SAMR_FIELD_PROFILE_PATH, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_WORKSTATIONS", SAMR_FIELD_WORKSTATIONS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_LOGON", SAMR_FIELD_LAST_LOGON, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_LOGOFF", SAMR_FIELD_LAST_LOGOFF, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LOGON_HOURS", SAMR_FIELD_LOGON_HOURS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_BAD_PWD_COUNT", SAMR_FIELD_BAD_PWD_COUNT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_NUM_LOGONS", SAMR_FIELD_NUM_LOGONS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ALLOW_PWD_CHANGE", SAMR_FIELD_ALLOW_PWD_CHANGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_FORCE_PWD_CHANGE", SAMR_FIELD_FORCE_PWD_CHANGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_LAST_PWD_CHANGE", SAMR_FIELD_LAST_PWD_CHANGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCT_EXPIRY", SAMR_FIELD_ACCT_EXPIRY, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_ACCT_FLAGS", SAMR_FIELD_ACCT_FLAGS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PARAMETERS", SAMR_FIELD_PARAMETERS, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_COUNTRY_CODE", SAMR_FIELD_COUNTRY_CODE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_CODE_PAGE", SAMR_FIELD_CODE_PAGE, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PASSWORD", SAMR_FIELD_PASSWORD, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PASSWORD2", SAMR_FIELD_PASSWORD2, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_PRIVATE_DATA", SAMR_FIELD_PRIVATE_DATA, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_EXPIRED_FLAG", SAMR_FIELD_EXPIRED_FLAG, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_SEC_DESC", SAMR_FIELD_SEC_DESC, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_FIELD_OWF_PWD", SAMR_FIELD_OWF_PWD, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo21(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo21 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logon)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_logoff)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->last_password_change)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->acct_expiry)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->allow_password_change)); + NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->force_password_change)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->parameters)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown1)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown2)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->unknown3)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->buf_count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->buffer)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->primary_gid)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + NDR_CHECK(ndr_push_samr_FieldsPresent(ndr, NDR_SCALARS, r->fields_present)); + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->bad_password_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->logon_count)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->country_code)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->code_page)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->nt_password_set)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->lm_password_set)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_expired)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->unknown4)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->parameters)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown1)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown2)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->unknown3)); + if (r->buffer) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->buf_count)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->buffer, r->buf_count)); + } + NDR_CHECK(ndr_push_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo21(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo21 *r) +{ + uint32_t _ptr_buffer; + TALLOC_CTX *_mem_save_buffer_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logon)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_logoff)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->last_password_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->acct_expiry)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->allow_password_change)); + NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->force_password_change)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->workstations)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->parameters)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown1)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown2)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->unknown3)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->buf_count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_buffer)); + if (_ptr_buffer) { + NDR_PULL_ALLOC(ndr, r->buffer); + } else { + r->buffer = NULL; + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->primary_gid)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + NDR_CHECK(ndr_pull_samr_FieldsPresent(ndr, NDR_SCALARS, &r->fields_present)); + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_SCALARS, &r->logon_hours)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->bad_password_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->logon_count)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->country_code)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->code_page)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->nt_password_set)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->lm_password_set)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_expired)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->unknown4)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_directory)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->home_drive)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->logon_script)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->profile_path)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->workstations)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->comment)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->parameters)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown1)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown2)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->unknown3)); + if (r->buffer) { + _mem_save_buffer_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->buffer, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->buffer)); + NDR_PULL_ALLOC_N(ndr, r->buffer, ndr_get_array_size(ndr, &r->buffer)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->buffer, ndr_get_array_size(ndr, &r->buffer))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_buffer_0, 0); + } + NDR_CHECK(ndr_pull_samr_LogonHours(ndr, NDR_BUFFERS, &r->logon_hours)); + if (r->buffer) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->buffer, r->buf_count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo21"); + ndr->depth++; + ndr_print_NTTIME(ndr, "last_logon", r->last_logon); + ndr_print_NTTIME(ndr, "last_logoff", r->last_logoff); + ndr_print_NTTIME(ndr, "last_password_change", r->last_password_change); + ndr_print_NTTIME(ndr, "acct_expiry", r->acct_expiry); + ndr_print_NTTIME(ndr, "allow_password_change", r->allow_password_change); + ndr_print_NTTIME(ndr, "force_password_change", r->force_password_change); + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr_print_lsa_String(ndr, "home_directory", &r->home_directory); + ndr_print_lsa_String(ndr, "home_drive", &r->home_drive); + ndr_print_lsa_String(ndr, "logon_script", &r->logon_script); + ndr_print_lsa_String(ndr, "profile_path", &r->profile_path); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr_print_lsa_String(ndr, "workstations", &r->workstations); + ndr_print_lsa_String(ndr, "comment", &r->comment); + ndr_print_lsa_String(ndr, "parameters", &r->parameters); + ndr_print_lsa_String(ndr, "unknown1", &r->unknown1); + ndr_print_lsa_String(ndr, "unknown2", &r->unknown2); + ndr_print_lsa_String(ndr, "unknown3", &r->unknown3); + ndr_print_uint32(ndr, "buf_count", r->buf_count); + ndr_print_ptr(ndr, "buffer", r->buffer); + ndr->depth++; + if (r->buffer) { + ndr_print_array_uint8(ndr, "buffer", r->buffer, r->buf_count); + } + ndr->depth--; + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_uint32(ndr, "primary_gid", r->primary_gid); + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr_print_samr_FieldsPresent(ndr, "fields_present", r->fields_present); + ndr_print_samr_LogonHours(ndr, "logon_hours", &r->logon_hours); + ndr_print_uint16(ndr, "bad_password_count", r->bad_password_count); + ndr_print_uint16(ndr, "logon_count", r->logon_count); + ndr_print_uint16(ndr, "country_code", r->country_code); + ndr_print_uint16(ndr, "code_page", r->code_page); + ndr_print_uint8(ndr, "nt_password_set", r->nt_password_set); + ndr_print_uint8(ndr, "lm_password_set", r->lm_password_set); + ndr_print_uint8(ndr, "password_expired", r->password_expired); + ndr_print_uint8(ndr, "unknown4", r->unknown4); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, 516)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, 516)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r) +{ + ndr_print_struct(ndr, name, "samr_CryptPassword"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_array_uint8(ndr, "data", r->data, 516); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_samr_UserInfo23(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo23 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo23(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo23 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo23"); + ndr->depth++; + ndr_print_samr_UserInfo21(ndr, "info", &r->info); + ndr_print_samr_CryptPassword(ndr, "password", &r->password); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo24(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo24 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pw_len)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo24(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo24 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pw_len)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo24"); + ndr->depth++; + ndr_print_samr_CryptPassword(ndr, "password", &r->password); + ndr_print_uint8(ndr, "pw_len", r->pw_len); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_CryptPasswordEx(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPasswordEx *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, 532)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_CryptPasswordEx(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPasswordEx *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, 532)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r) +{ + ndr_print_struct(ndr, name, "samr_CryptPasswordEx"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_array_uint8(ndr, "data", r->data, 532); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +static enum ndr_err_code ndr_push_samr_UserInfo25(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo25 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo25(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo25 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo25"); + ndr->depth++; + ndr_print_samr_UserInfo21(ndr, "info", &r->info); + ndr_print_samr_CryptPasswordEx(ndr, "password", &r->password); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo26(struct ndr_push *ndr, int ndr_flags, const struct samr_UserInfo26 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pw_len)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo26(struct ndr_pull *ndr, int ndr_flags, struct samr_UserInfo26 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_samr_CryptPasswordEx(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pw_len)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r) +{ + ndr_print_struct(ndr, name, "samr_UserInfo26"); + ndr->depth++; + ndr_print_samr_CryptPasswordEx(ndr, "password", &r->password); + ndr_print_uint8(ndr, "pw_len", r->pw_len); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_UserInfo(struct ndr_push *ndr, int ndr_flags, const union samr_UserInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_SCALARS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_SCALARS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_SCALARS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7)); + break; + + case 8: + NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8)); + break; + + case 9: + NDR_CHECK(ndr_push_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9)); + break; + + case 10: + NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10)); + break; + + case 11: + NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11)); + break; + + case 12: + NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12)); + break; + + case 13: + NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13)); + break; + + case 14: + NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14)); + break; + + case 16: + NDR_CHECK(ndr_push_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16)); + break; + + case 17: + NDR_CHECK(ndr_push_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17)); + break; + + case 20: + NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20)); + break; + + case 21: + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_SCALARS, &r->info21)); + break; + + case 23: + NDR_CHECK(ndr_push_samr_UserInfo23(ndr, NDR_SCALARS, &r->info23)); + break; + + case 24: + NDR_CHECK(ndr_push_samr_UserInfo24(ndr, NDR_SCALARS, &r->info24)); + break; + + case 25: + NDR_CHECK(ndr_push_samr_UserInfo25(ndr, NDR_SCALARS, &r->info25)); + break; + + case 26: + NDR_CHECK(ndr_push_samr_UserInfo26(ndr, NDR_SCALARS, &r->info26)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_UserInfo1(ndr, NDR_BUFFERS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_UserInfo2(ndr, NDR_BUFFERS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_UserInfo3(ndr, NDR_BUFFERS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_push_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_push_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7)); + break; + + case 8: + NDR_CHECK(ndr_push_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8)); + break; + + case 9: + break; + + case 10: + NDR_CHECK(ndr_push_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10)); + break; + + case 11: + NDR_CHECK(ndr_push_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11)); + break; + + case 12: + NDR_CHECK(ndr_push_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12)); + break; + + case 13: + NDR_CHECK(ndr_push_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13)); + break; + + case 14: + NDR_CHECK(ndr_push_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14)); + break; + + case 16: + break; + + case 17: + break; + + case 20: + NDR_CHECK(ndr_push_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20)); + break; + + case 21: + NDR_CHECK(ndr_push_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info21)); + break; + + case 23: + NDR_CHECK(ndr_push_samr_UserInfo23(ndr, NDR_BUFFERS, &r->info23)); + break; + + case 24: + break; + + case 25: + NDR_CHECK(ndr_push_samr_UserInfo25(ndr, NDR_BUFFERS, &r->info25)); + break; + + case 26: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_UserInfo(struct ndr_pull *ndr, int ndr_flags, union samr_UserInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + 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; } + + case 4: { + NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_SCALARS, &r->info4)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_SCALARS, &r->info5)); + break; } + + case 6: { + NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_SCALARS, &r->info6)); + break; } + + case 7: { + NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_SCALARS, &r->info7)); + break; } + + case 8: { + NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_SCALARS, &r->info8)); + break; } + + case 9: { + NDR_CHECK(ndr_pull_samr_UserInfo9(ndr, NDR_SCALARS, &r->info9)); + break; } + + case 10: { + NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_SCALARS, &r->info10)); + break; } + + case 11: { + NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_SCALARS, &r->info11)); + break; } + + case 12: { + NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_SCALARS, &r->info12)); + break; } + + case 13: { + NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_SCALARS, &r->info13)); + break; } + + case 14: { + NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_SCALARS, &r->info14)); + break; } + + case 16: { + NDR_CHECK(ndr_pull_samr_UserInfo16(ndr, NDR_SCALARS, &r->info16)); + break; } + + case 17: { + NDR_CHECK(ndr_pull_samr_UserInfo17(ndr, NDR_SCALARS, &r->info17)); + break; } + + case 20: { + NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_SCALARS, &r->info20)); + break; } + + case 21: { + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_SCALARS, &r->info21)); + break; } + + case 23: { + NDR_CHECK(ndr_pull_samr_UserInfo23(ndr, NDR_SCALARS, &r->info23)); + break; } + + case 24: { + NDR_CHECK(ndr_pull_samr_UserInfo24(ndr, NDR_SCALARS, &r->info24)); + break; } + + case 25: { + NDR_CHECK(ndr_pull_samr_UserInfo25(ndr, NDR_SCALARS, &r->info25)); + break; } + + case 26: { + NDR_CHECK(ndr_pull_samr_UserInfo26(ndr, NDR_SCALARS, &r->info26)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + 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; + + case 4: + NDR_CHECK(ndr_pull_samr_UserInfo4(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_pull_samr_UserInfo5(ndr, NDR_BUFFERS, &r->info5)); + break; + + case 6: + NDR_CHECK(ndr_pull_samr_UserInfo6(ndr, NDR_BUFFERS, &r->info6)); + break; + + case 7: + NDR_CHECK(ndr_pull_samr_UserInfo7(ndr, NDR_BUFFERS, &r->info7)); + break; + + case 8: + NDR_CHECK(ndr_pull_samr_UserInfo8(ndr, NDR_BUFFERS, &r->info8)); + break; + + case 9: + break; + + case 10: + NDR_CHECK(ndr_pull_samr_UserInfo10(ndr, NDR_BUFFERS, &r->info10)); + break; + + case 11: + NDR_CHECK(ndr_pull_samr_UserInfo11(ndr, NDR_BUFFERS, &r->info11)); + break; + + case 12: + NDR_CHECK(ndr_pull_samr_UserInfo12(ndr, NDR_BUFFERS, &r->info12)); + break; + + case 13: + NDR_CHECK(ndr_pull_samr_UserInfo13(ndr, NDR_BUFFERS, &r->info13)); + break; + + case 14: + NDR_CHECK(ndr_pull_samr_UserInfo14(ndr, NDR_BUFFERS, &r->info14)); + break; + + case 16: + break; + + case 17: + break; + + case 20: + NDR_CHECK(ndr_pull_samr_UserInfo20(ndr, NDR_BUFFERS, &r->info20)); + break; + + case 21: + NDR_CHECK(ndr_pull_samr_UserInfo21(ndr, NDR_BUFFERS, &r->info21)); + break; + + case 23: + NDR_CHECK(ndr_pull_samr_UserInfo23(ndr, NDR_BUFFERS, &r->info23)); + break; + + case 24: + break; + + case 25: + NDR_CHECK(ndr_pull_samr_UserInfo25(ndr, NDR_BUFFERS, &r->info25)); + break; + + case 26: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_UserInfo"); + switch (level) { + case 1: + 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; + + case 4: + ndr_print_samr_UserInfo4(ndr, "info4", &r->info4); + break; + + case 5: + ndr_print_samr_UserInfo5(ndr, "info5", &r->info5); + break; + + case 6: + ndr_print_samr_UserInfo6(ndr, "info6", &r->info6); + break; + + case 7: + ndr_print_samr_UserInfo7(ndr, "info7", &r->info7); + break; + + case 8: + ndr_print_samr_UserInfo8(ndr, "info8", &r->info8); + break; + + case 9: + ndr_print_samr_UserInfo9(ndr, "info9", &r->info9); + break; + + case 10: + ndr_print_samr_UserInfo10(ndr, "info10", &r->info10); + break; + + case 11: + ndr_print_samr_UserInfo11(ndr, "info11", &r->info11); + break; + + case 12: + ndr_print_samr_UserInfo12(ndr, "info12", &r->info12); + break; + + case 13: + ndr_print_samr_UserInfo13(ndr, "info13", &r->info13); + break; + + case 14: + ndr_print_samr_UserInfo14(ndr, "info14", &r->info14); + break; + + case 16: + ndr_print_samr_UserInfo16(ndr, "info16", &r->info16); + break; + + case 17: + ndr_print_samr_UserInfo17(ndr, "info17", &r->info17); + break; + + case 20: + ndr_print_samr_UserInfo20(ndr, "info20", &r->info20); + break; + + case 21: + ndr_print_samr_UserInfo21(ndr, "info21", &r->info21); + break; + + case 23: + ndr_print_samr_UserInfo23(ndr, "info23", &r->info23); + break; + + case 24: + ndr_print_samr_UserInfo24(ndr, "info24", &r->info24); + break; + + case 25: + ndr_print_samr_UserInfo25(ndr, "info25", &r->info25); + break; + + case 26: + ndr_print_samr_UserInfo26(ndr, "info26", &r->info26); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 1)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->hash, 16)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r) +{ + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 1)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->hash, 16)); + } + if (ndr_flags & NDR_BUFFERS) { + } + ndr->flags = _flags_save_STRUCT; + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r) +{ + ndr_print_struct(ndr, name, "samr_Password"); + { + uint32_t _flags_save_STRUCT = ndr->flags; + ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX); + ndr->depth++; + ndr_print_array_uint8(ndr, "hash", r->hash, 16); + ndr->depth--; + ndr->flags = _flags_save_STRUCT; + } +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->attributes)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->attributes)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r) +{ + ndr_print_struct(ndr, name, "samr_RidWithAttribute"); + ndr->depth++; + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_samr_GroupAttrs(ndr, "attributes", r->attributes); + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r) +{ + uint32_t cntr_rids_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->rids)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->rids) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) { + NDR_CHECK(ndr_push_samr_RidWithAttribute(ndr, NDR_SCALARS, &r->rids[cntr_rids_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r) +{ + uint32_t _ptr_rids; + uint32_t cntr_rids_1; + TALLOC_CTX *_mem_save_rids_0; + TALLOC_CTX *_mem_save_rids_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_rids)); + if (_ptr_rids) { + NDR_PULL_ALLOC(ndr, r->rids); + } else { + r->rids = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->rids) { + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->rids)); + NDR_PULL_ALLOC_N(ndr, r->rids, ndr_get_array_size(ndr, &r->rids)); + _mem_save_rids_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->rids, 0); + for (cntr_rids_1 = 0; cntr_rids_1 < r->count; cntr_rids_1++) { + NDR_CHECK(ndr_pull_samr_RidWithAttribute(ndr, NDR_SCALARS, &r->rids[cntr_rids_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0); + } + if (r->rids) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->rids, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r) +{ + uint32_t cntr_rids_1; + ndr_print_struct(ndr, name, "samr_RidWithAttributeArray"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "rids", r->rids); + ndr->depth++; + if (r->rids) { + ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->count); + ndr->depth++; + for (cntr_rids_1=0;cntr_rids_1count;cntr_rids_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_rids_1); + if (idx_1) { + ndr_print_samr_RidWithAttribute(ndr, "rids", &r->rids[cntr_rids_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispEntryGeneral(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryGeneral *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispEntryGeneral(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryGeneral *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->full_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->full_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r) +{ + ndr_print_struct(ndr, name, "samr_DispEntryGeneral"); + ndr->depth++; + ndr_print_uint32(ndr, "idx", r->idx); + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr_print_lsa_String(ndr, "full_name", &r->full_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispInfoGeneral(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoGeneral *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryGeneral(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryGeneral(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispInfoGeneral(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoGeneral *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryGeneral(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryGeneral(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "samr_DispInfoGeneral"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_samr_DispEntryGeneral(ndr, "entries", &r->entries[cntr_entries_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispEntryFull(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryFull *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->acct_flags)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispEntryFull(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryFull *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->acct_flags)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r) +{ + ndr_print_struct(ndr, name, "samr_DispEntryFull"); + ndr->depth++; + ndr_print_uint32(ndr, "idx", r->idx); + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->acct_flags); + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispInfoFull(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoFull *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryFull(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryFull(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispInfoFull(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoFull *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryFull(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryFull(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "samr_DispInfoFull"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_samr_DispEntryFull(ndr, "entries", &r->entries[cntr_entries_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispEntryFullGroup(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryFullGroup *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid)); + NDR_CHECK(ndr_push_samr_GroupAttrs(ndr, NDR_SCALARS, r->acct_flags)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispEntryFullGroup(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryFullGroup *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid)); + NDR_CHECK(ndr_pull_samr_GroupAttrs(ndr, NDR_SCALARS, &r->acct_flags)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->description)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account_name)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->description)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r) +{ + ndr_print_struct(ndr, name, "samr_DispEntryFullGroup"); + ndr->depth++; + ndr_print_uint32(ndr, "idx", r->idx); + ndr_print_uint32(ndr, "rid", r->rid); + ndr_print_samr_GroupAttrs(ndr, "acct_flags", r->acct_flags); + ndr_print_lsa_String(ndr, "account_name", &r->account_name); + ndr_print_lsa_String(ndr, "description", &r->description); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispInfoFullGroups(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoFullGroups *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryFullGroup(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryFullGroup(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispInfoFullGroups(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoFullGroups *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryFullGroup(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryFullGroup(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "samr_DispInfoFullGroups"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_samr_DispEntryFullGroup(ndr, "entries", &r->entries[cntr_entries_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispEntryAscii(struct ndr_push *ndr, int ndr_flags, const struct samr_DispEntryAscii *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->idx)); + NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS, &r->account_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_BUFFERS, &r->account_name)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispEntryAscii(struct ndr_pull *ndr, int ndr_flags, struct samr_DispEntryAscii *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->idx)); + NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS, &r->account_name)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_BUFFERS, &r->account_name)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r) +{ + ndr_print_struct(ndr, name, "samr_DispEntryAscii"); + ndr->depth++; + ndr_print_uint32(ndr, "idx", r->idx); + ndr_print_lsa_AsciiString(ndr, "account_name", &r->account_name); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispInfoAscii(struct ndr_push *ndr, int ndr_flags, const struct samr_DispInfoAscii *r) +{ + uint32_t cntr_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->entries)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count)); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryAscii(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_push_samr_DispEntryAscii(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispInfoAscii(struct ndr_pull *ndr, int ndr_flags, struct samr_DispInfoAscii *r) +{ + uint32_t _ptr_entries; + uint32_t cntr_entries_1; + TALLOC_CTX *_mem_save_entries_0; + TALLOC_CTX *_mem_save_entries_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_entries)); + if (_ptr_entries) { + NDR_PULL_ALLOC(ndr, r->entries); + } else { + r->entries = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->entries) { + _mem_save_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->entries)); + NDR_PULL_ALLOC_N(ndr, r->entries, ndr_get_array_size(ndr, &r->entries)); + _mem_save_entries_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->entries, 0); + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryAscii(ndr, NDR_SCALARS, &r->entries[cntr_entries_1])); + } + for (cntr_entries_1 = 0; cntr_entries_1 < r->count; cntr_entries_1++) { + NDR_CHECK(ndr_pull_samr_DispEntryAscii(ndr, NDR_BUFFERS, &r->entries[cntr_entries_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_entries_0, 0); + } + if (r->entries) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->entries, r->count)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r) +{ + uint32_t cntr_entries_1; + ndr_print_struct(ndr, name, "samr_DispInfoAscii"); + ndr->depth++; + ndr_print_uint32(ndr, "count", r->count); + ndr_print_ptr(ndr, "entries", r->entries); + ndr->depth++; + if (r->entries) { + ndr->print(ndr, "%s: ARRAY(%d)", "entries", r->count); + ndr->depth++; + for (cntr_entries_1=0;cntr_entries_1count;cntr_entries_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_entries_1); + if (idx_1) { + ndr_print_samr_DispEntryAscii(ndr, "entries", &r->entries[cntr_entries_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DispInfo(struct ndr_push *ndr, int ndr_flags, const union samr_DispInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_DispInfoGeneral(ndr, NDR_SCALARS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_DispInfoFull(ndr, NDR_SCALARS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_DispInfoFullGroups(ndr, NDR_SCALARS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info5)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_DispInfoGeneral(ndr, NDR_BUFFERS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_DispInfoFull(ndr, NDR_BUFFERS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_DispInfoFullGroups(ndr, NDR_BUFFERS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_push_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info5)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DispInfo(struct ndr_pull *ndr, int ndr_flags, union samr_DispInfo *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_samr_DispInfoGeneral(ndr, NDR_SCALARS, &r->info1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_samr_DispInfoFull(ndr, NDR_SCALARS, &r->info2)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_samr_DispInfoFullGroups(ndr, NDR_SCALARS, &r->info3)); + break; } + + case 4: { + NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info4)); + break; } + + case 5: { + NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_SCALARS, &r->info5)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + NDR_CHECK(ndr_pull_samr_DispInfoGeneral(ndr, NDR_BUFFERS, &r->info1)); + break; + + case 2: + NDR_CHECK(ndr_pull_samr_DispInfoFull(ndr, NDR_BUFFERS, &r->info2)); + break; + + case 3: + NDR_CHECK(ndr_pull_samr_DispInfoFullGroups(ndr, NDR_BUFFERS, &r->info3)); + break; + + case 4: + NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info4)); + break; + + case 5: + NDR_CHECK(ndr_pull_samr_DispInfoAscii(ndr, NDR_BUFFERS, &r->info5)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_DispInfo"); + switch (level) { + case 1: + ndr_print_samr_DispInfoGeneral(ndr, "info1", &r->info1); + break; + + case 2: + ndr_print_samr_DispInfoFull(ndr, "info2", &r->info2); + break; + + case 3: + ndr_print_samr_DispInfoFullGroups(ndr, "info3", &r->info3); + break; + + case 4: + ndr_print_samr_DispInfoAscii(ndr, "info4", &r->info4); + break; + + case 5: + ndr_print_samr_DispInfoAscii(ndr, "info5", &r->info5); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_PwInfo(struct ndr_push *ndr, int ndr_flags, const struct samr_PwInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->min_password_length)); + NDR_CHECK(ndr_push_samr_PasswordProperties(ndr, NDR_SCALARS, r->password_properties)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_PwInfo(struct ndr_pull *ndr, int ndr_flags, struct samr_PwInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->min_password_length)); + NDR_CHECK(ndr_pull_samr_PasswordProperties(ndr, NDR_SCALARS, &r->password_properties)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r) +{ + ndr_print_struct(ndr, name, "samr_PwInfo"); + ndr->depth++; + ndr_print_uint16(ndr, "min_password_length", r->min_password_length); + ndr_print_samr_PasswordProperties(ndr, "password_properties", r->password_properties); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ChangeReject(struct ndr_push *ndr, int ndr_flags, const struct samr_ChangeReject *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_samr_RejectReason(ndr, NDR_SCALARS, r->reason)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ChangeReject(struct ndr_pull *ndr, int ndr_flags, struct samr_ChangeReject *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_samr_RejectReason(ndr, NDR_SCALARS, &r->reason)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r) +{ + ndr_print_struct(ndr, name, "samr_ChangeReject"); + ndr->depth++; + ndr_print_samr_RejectReason(ndr, "reason", r->reason); + ndr_print_uint32(ndr, "unknown1", r->unknown1); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ConnectInfo1(struct ndr_push *ndr, int ndr_flags, const struct samr_ConnectInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ConnectInfo1(struct ndr_pull *ndr, int ndr_flags, struct samr_ConnectInfo1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown1)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown2)); + } + if (ndr_flags & NDR_BUFFERS) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r) +{ + ndr_print_struct(ndr, name, "samr_ConnectInfo1"); + ndr->depth++; + ndr_print_uint32(ndr, "unknown1", r->unknown1); + ndr_print_uint32(ndr, "unknown2", r->unknown2); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ConnectInfo(struct ndr_push *ndr, int ndr_flags, const union samr_ConnectInfo *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_ConnectInfo1(ndr, NDR_SCALARS, &r->info1)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ConnectInfo(struct ndr_pull *ndr, int ndr_flags, union samr_ConnectInfo *r) +{ + int level; + uint32_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_samr_ConnectInfo1(ndr, NDR_SCALARS, &r->info1)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_ConnectInfo"); + switch (level) { + case 1: + ndr_print_samr_ConnectInfo1(ndr, "info1", &r->info1); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_ValidateFieldsPresent(struct ndr_push *ndr, int ndr_flags, uint32_t r) +{ + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidateFieldsPresent(struct ndr_pull *ndr, int ndr_flags, uint32_t *r) +{ + uint32_t v; + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r) +{ + ndr_print_uint32(ndr, name, r); + ndr->depth++; + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET", SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME", SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_LOCKOUT_TIME", SAMR_VALIDATE_FIELD_LOCKOUT_TIME, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT", SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH", SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "SAMR_VALIDATE_FIELD_PASSWORD_HISTORY", SAMR_VALIDATE_FIELD_PASSWORD_HISTORY, r); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordLevel(struct ndr_push *ndr, int ndr_flags, enum samr_ValidatePasswordLevel r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordLevel(struct ndr_pull *ndr, int ndr_flags, enum samr_ValidatePasswordLevel *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r) +{ + const char *val = NULL; + + switch (r) { + case NetValidateAuthentication: val = "NetValidateAuthentication"; break; + case NetValidatePasswordChange: val = "NetValidatePasswordChange"; break; + case NetValidatePasswordReset: val = "NetValidatePasswordReset"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_samr_ValidationStatus(struct ndr_push *ndr, int ndr_flags, enum samr_ValidationStatus r) +{ + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r)); + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidationStatus(struct ndr_pull *ndr, int ndr_flags, enum samr_ValidationStatus *r) +{ + uint16_t v; + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v)); + *r = v; + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r) +{ + const char *val = NULL; + + switch (r) { + case SAMR_VALIDATION_STATUS_SUCCESS: val = "SAMR_VALIDATION_STATUS_SUCCESS"; break; + case SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE: val = "SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE"; break; + case SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT: val = "SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT"; break; + case SAMR_VALIDATION_STATUS_BAD_PASSWORD: val = "SAMR_VALIDATION_STATUS_BAD_PASSWORD"; break; + case SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT: val = "SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT"; break; + case SAMR_VALIDATION_STATUS_PWD_TOO_SHORT: val = "SAMR_VALIDATION_STATUS_PWD_TOO_SHORT"; break; + case SAMR_VALIDATION_STATUS_PWD_TOO_LONG: val = "SAMR_VALIDATION_STATUS_PWD_TOO_LONG"; break; + case SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH: val = "SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH"; break; + case SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT: val = "SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT"; break; + } + ndr_print_enum(ndr, name, "ENUM", val, r); +} + +static enum ndr_err_code ndr_push_samr_ValidationBlob(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidationBlob *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 4)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->data)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length)); + NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidationBlob(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidationBlob *r) +{ + uint32_t _ptr_data; + TALLOC_CTX *_mem_save_data_0; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 4)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data)); + if (_ptr_data) { + NDR_PULL_ALLOC(ndr, r->data); + } else { + r->data = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->data) { + _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->data, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->data)); + NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data)); + NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data))); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0); + } + if (r->data) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->length)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r) +{ + ndr_print_struct(ndr, name, "samr_ValidationBlob"); + ndr->depth++; + ndr_print_uint32(ndr, "length", r->length); + ndr_print_ptr(ndr, "data", r->data); + ndr->depth++; + if (r->data) { + ndr_print_array_uint8(ndr, "data", r->data, r->length); + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordInfo(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordInfo *r) +{ + uint32_t cntr_pwd_history_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_ValidateFieldsPresent(ndr, NDR_SCALARS, r->fields_present)); + NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->last_password_change)); + NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->bad_password_time)); + NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->lockout_time)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->bad_pwd_count)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pwd_history_len)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->pwd_history)); + } + if (ndr_flags & NDR_BUFFERS) { + if (r->pwd_history) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pwd_history_len)); + for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) { + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->pwd_history[cntr_pwd_history_1])); + } + for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) { + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->pwd_history[cntr_pwd_history_1])); + } + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordInfo(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordInfo *r) +{ + uint32_t _ptr_pwd_history; + uint32_t cntr_pwd_history_1; + TALLOC_CTX *_mem_save_pwd_history_0; + TALLOC_CTX *_mem_save_pwd_history_1; + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_ValidateFieldsPresent(ndr, NDR_SCALARS, &r->fields_present)); + NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->last_password_change)); + NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->bad_password_time)); + NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->lockout_time)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->bad_pwd_count)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pwd_history_len)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_pwd_history)); + if (_ptr_pwd_history) { + NDR_PULL_ALLOC(ndr, r->pwd_history); + } else { + r->pwd_history = NULL; + } + } + if (ndr_flags & NDR_BUFFERS) { + if (r->pwd_history) { + _mem_save_pwd_history_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->pwd_history, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->pwd_history)); + NDR_PULL_ALLOC_N(ndr, r->pwd_history, ndr_get_array_size(ndr, &r->pwd_history)); + _mem_save_pwd_history_1 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->pwd_history, 0); + for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) { + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->pwd_history[cntr_pwd_history_1])); + } + for (cntr_pwd_history_1 = 0; cntr_pwd_history_1 < r->pwd_history_len; cntr_pwd_history_1++) { + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->pwd_history[cntr_pwd_history_1])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pwd_history_1, 0); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pwd_history_0, 0); + } + if (r->pwd_history) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->pwd_history, r->pwd_history_len)); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r) +{ + uint32_t cntr_pwd_history_1; + ndr_print_struct(ndr, name, "samr_ValidatePasswordInfo"); + ndr->depth++; + ndr_print_samr_ValidateFieldsPresent(ndr, "fields_present", r->fields_present); + ndr_print_NTTIME_hyper(ndr, "last_password_change", r->last_password_change); + ndr_print_NTTIME_hyper(ndr, "bad_password_time", r->bad_password_time); + ndr_print_NTTIME_hyper(ndr, "lockout_time", r->lockout_time); + ndr_print_uint32(ndr, "bad_pwd_count", r->bad_pwd_count); + ndr_print_uint32(ndr, "pwd_history_len", r->pwd_history_len); + ndr_print_ptr(ndr, "pwd_history", r->pwd_history); + ndr->depth++; + if (r->pwd_history) { + ndr->print(ndr, "%s: ARRAY(%d)", "pwd_history", r->pwd_history_len); + ndr->depth++; + for (cntr_pwd_history_1=0;cntr_pwd_history_1pwd_history_len;cntr_pwd_history_1++) { + char *idx_1=NULL; + asprintf(&idx_1, "[%d]", cntr_pwd_history_1); + if (idx_1) { + ndr_print_samr_ValidationBlob(ndr, "pwd_history", &r->pwd_history[cntr_pwd_history_1]); + free(idx_1); + } + } + ndr->depth--; + } + ndr->depth--; + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordRepCtr(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordRepCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_samr_ValidationStatus(ndr, NDR_SCALARS, r->status)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordRepCtr(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordRepCtr *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_samr_ValidationStatus(ndr, NDR_SCALARS, &r->status)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r) +{ + ndr_print_struct(ndr, name, "samr_ValidatePasswordRepCtr"); + ndr->depth++; + ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info); + ndr_print_samr_ValidationStatus(ndr, "status", r->status); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordRep(struct ndr_push *ndr, int ndr_flags, const union samr_ValidatePasswordRep *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr3)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr3)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordRep(struct ndr_pull *ndr, int ndr_flags, union samr_ValidatePasswordRep *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr2)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_SCALARS, &r->ctr3)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr1)); + break; + + case 2: + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr2)); + break; + + case 3: + NDR_CHECK(ndr_pull_samr_ValidatePasswordRepCtr(ndr, NDR_BUFFERS, &r->ctr3)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_ValidatePasswordRep"); + switch (level) { + case 1: + ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr1", &r->ctr1); + break; + + case 2: + ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr2", &r->ctr2); + break; + + case 3: + ndr_print_samr_ValidatePasswordRepCtr(ndr, "ctr3", &r->ctr3); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordReq3(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->account)); + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->pwd_must_change_at_next_logon)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->clear_lockout)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account)); + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq3(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq3 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->account)); + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->pwd_must_change_at_next_logon)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->clear_lockout)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account)); + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r) +{ + ndr_print_struct(ndr, name, "samr_ValidatePasswordReq3"); + ndr->depth++; + ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info); + ndr_print_lsa_StringLarge(ndr, "password", &r->password); + ndr_print_lsa_StringLarge(ndr, "account", &r->account); + ndr_print_samr_ValidationBlob(ndr, "hash", &r->hash); + ndr_print_uint8(ndr, "pwd_must_change_at_next_logon", r->pwd_must_change_at_next_logon); + ndr_print_uint8(ndr, "clear_lockout", r->clear_lockout); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordReq2(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->account)); + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_matched)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password)); + NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account)); + NDR_CHECK(ndr_push_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq2(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq2 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->password)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->account)); + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_SCALARS, &r->hash)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_matched)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->password)); + NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->account)); + NDR_CHECK(ndr_pull_samr_ValidationBlob(ndr, NDR_BUFFERS, &r->hash)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r) +{ + ndr_print_struct(ndr, name, "samr_ValidatePasswordReq2"); + ndr->depth++; + ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info); + ndr_print_lsa_StringLarge(ndr, "password", &r->password); + ndr_print_lsa_StringLarge(ndr, "account", &r->account); + ndr_print_samr_ValidationBlob(ndr, "hash", &r->hash); + ndr_print_uint8(ndr, "password_matched", r->password_matched); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordReq1(struct ndr_push *ndr, int ndr_flags, const struct samr_ValidatePasswordReq1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_push_align(ndr, 8)); + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->password_matched)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_push_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq1(struct ndr_pull *ndr, int ndr_flags, struct samr_ValidatePasswordReq1 *r) +{ + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_align(ndr, 8)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_SCALARS, &r->info)); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->password_matched)); + } + if (ndr_flags & NDR_BUFFERS) { + NDR_CHECK(ndr_pull_samr_ValidatePasswordInfo(ndr, NDR_BUFFERS, &r->info)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r) +{ + ndr_print_struct(ndr, name, "samr_ValidatePasswordReq1"); + ndr->depth++; + ndr_print_samr_ValidatePasswordInfo(ndr, "info", &r->info); + ndr_print_uint8(ndr, "password_matched", r->password_matched); + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePasswordReq(struct ndr_push *ndr, int ndr_flags, const union samr_ValidatePasswordReq *r) +{ + if (ndr_flags & NDR_SCALARS) { + int level = ndr_push_get_switch_value(ndr, r); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level)); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq1(ndr, NDR_SCALARS, &r->req1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq2(ndr, NDR_SCALARS, &r->req2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq3(ndr, NDR_SCALARS, &r->req3)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + int level = ndr_push_get_switch_value(ndr, r); + switch (level) { + case 1: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq1(ndr, NDR_BUFFERS, &r->req1)); + break; + + case 2: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq2(ndr, NDR_BUFFERS, &r->req2)); + break; + + case 3: + NDR_CHECK(ndr_push_samr_ValidatePasswordReq3(ndr, NDR_BUFFERS, &r->req3)); + break; + + default: + return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePasswordReq(struct ndr_pull *ndr, int ndr_flags, union samr_ValidatePasswordReq *r) +{ + int level; + uint16_t _level; + level = ndr_pull_get_switch_value(ndr, r); + if (ndr_flags & NDR_SCALARS) { + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level)); + if (_level != level) { + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level); + } + switch (level) { + case 1: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq1(ndr, NDR_SCALARS, &r->req1)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq2(ndr, NDR_SCALARS, &r->req2)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq3(ndr, NDR_SCALARS, &r->req3)); + break; } + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + if (ndr_flags & NDR_BUFFERS) { + switch (level) { + case 1: + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq1(ndr, NDR_BUFFERS, &r->req1)); + break; + + case 2: + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq2(ndr, NDR_BUFFERS, &r->req2)); + break; + + case 3: + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq3(ndr, NDR_BUFFERS, &r->req3)); + break; + + default: + return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level); + } + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r) +{ + int level; + level = ndr_print_get_switch_value(ndr, r); + ndr_print_union(ndr, name, level, "samr_ValidatePasswordReq"); + switch (level) { + case 1: + ndr_print_samr_ValidatePasswordReq1(ndr, "req1", &r->req1); + break; + + case 2: + ndr_print_samr_ValidatePasswordReq2(ndr, "req2", &r->req2); + break; + + case 3: + ndr_print_samr_ValidatePasswordReq3(ndr, "req3", &r->req3); + break; + + default: + ndr_print_bad_level(ndr, name, level); + } +} + +static enum ndr_err_code ndr_push_samr_Connect(struct ndr_push *ndr, int flags, const struct samr_Connect *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.system_name)); + } + NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Connect(struct ndr_pull *ndr, int flags, struct samr_Connect *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.system_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + ZERO_STRUCTP(r->out.connect_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r) +{ + ndr_print_struct(ndr, name, "samr_Connect"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Connect"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_uint16(ndr, "system_name", *r->in.system_name); + } + ndr->depth--; + ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Connect"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + } + if (flags & NDR_OUT) { + if (r->out.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r) +{ + TALLOC_CTX *_mem_save_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.handle); + *r->out.handle = *r->in.handle; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r) +{ + ndr_print_struct(ndr, name, "samr_Close"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Close"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Close"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->out.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->out.handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetSecurity(struct ndr_push *ndr, int flags, const struct samr_SetSecurity *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info)); + if (r->in.sdbuf == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sdbuf)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetSecurity(struct ndr_pull *ndr, int flags, struct samr_SetSecurity *r) +{ + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_sdbuf_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sdbuf); + } + _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sdbuf, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sdbuf)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r) +{ + ndr_print_struct(ndr, name, "samr_SetSecurity"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetSecurity"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info); + ndr_print_ptr(ndr, "sdbuf", r->in.sdbuf); + ndr->depth++; + ndr_print_sec_desc_buf(ndr, "sdbuf", r->in.sdbuf); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetSecurity"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QuerySecurity(struct ndr_push *ndr, int flags, const struct samr_QuerySecurity *r) +{ + if (flags & NDR_IN) { + if (r->in.handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_CHECK(ndr_push_security_secinfo(ndr, NDR_SCALARS, r->in.sec_info)); + } + if (flags & NDR_OUT) { + if (r->out.sdbuf == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sdbuf)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QuerySecurity(struct ndr_pull *ndr, int flags, struct samr_QuerySecurity *r) +{ + TALLOC_CTX *_mem_save_handle_0; + TALLOC_CTX *_mem_save_sdbuf_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.handle); + } + _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_security_secinfo(ndr, NDR_SCALARS, &r->in.sec_info)); + NDR_PULL_ALLOC(ndr, r->out.sdbuf); + ZERO_STRUCTP(r->out.sdbuf); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sdbuf); + } + _mem_save_sdbuf_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sdbuf, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_sec_desc_buf(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sdbuf)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sdbuf_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r) +{ + ndr_print_struct(ndr, name, "samr_QuerySecurity"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QuerySecurity"); + ndr->depth++; + ndr_print_ptr(ndr, "handle", r->in.handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "handle", r->in.handle); + ndr->depth--; + ndr_print_security_secinfo(ndr, "sec_info", r->in.sec_info); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QuerySecurity"); + ndr->depth++; + ndr_print_ptr(ndr, "sdbuf", r->out.sdbuf); + ndr->depth++; + ndr_print_sec_desc_buf(ndr, "sdbuf", r->out.sdbuf); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_Shutdown(struct ndr_push *ndr, int flags, const struct samr_Shutdown *r) +{ + if (flags & NDR_IN) { + if (r->in.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Shutdown(struct ndr_pull *ndr, int flags, struct samr_Shutdown *r) +{ + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r) +{ + ndr_print_struct(ndr, name, "samr_Shutdown"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Shutdown"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Shutdown"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_LookupDomain(struct ndr_push *ndr, int flags, const struct samr_LookupDomain *r) +{ + if (flags & NDR_IN) { + if (r->in.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + if (r->in.domain_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name)); + } + if (flags & NDR_OUT) { + if (r->out.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_LookupDomain(struct ndr_pull *ndr, int flags, struct samr_LookupDomain *r) +{ + TALLOC_CTX *_mem_save_connect_handle_0; + TALLOC_CTX *_mem_save_domain_name_0; + TALLOC_CTX *_mem_save_sid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_name); + } + _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.sid); + ZERO_STRUCTP(r->out.sid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r) +{ + ndr_print_struct(ndr, name, "samr_LookupDomain"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_LookupDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle); + ndr->depth--; + ndr_print_ptr(ndr, "domain_name", r->in.domain_name); + ndr->depth++; + ndr_print_lsa_String(ndr, "domain_name", r->in.domain_name); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_LookupDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "sid", r->out.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->out.sid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_EnumDomains(struct ndr_push *ndr, int flags, const struct samr_EnumDomains *r) +{ + if (flags & NDR_IN) { + if (r->in.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + if (r->in.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size)); + } + if (flags & NDR_OUT) { + if (r->out.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); + if (r->out.sam == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + if (r->out.num_entries == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_EnumDomains(struct ndr_pull *ndr, int flags, struct samr_EnumDomains *r) +{ + TALLOC_CTX *_mem_save_connect_handle_0; + TALLOC_CTX *_mem_save_resume_handle_0; + TALLOC_CTX *_mem_save_sam_0; + TALLOC_CTX *_mem_save_num_entries_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size)); + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + *r->out.resume_handle = *r->in.resume_handle; + NDR_PULL_ALLOC(ndr, r->out.sam); + ZERO_STRUCTP(r->out.sam); + NDR_PULL_ALLOC(ndr, r->out.num_entries); + ZERO_STRUCTP(r->out.num_entries); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sam); + } + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.num_entries); + } + _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r) +{ + ndr_print_struct(ndr, name, "samr_EnumDomains"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_EnumDomains"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle); + ndr->depth--; + ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle); + ndr->depth--; + ndr_print_uint32(ndr, "buf_size", r->in.buf_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_EnumDomains"); + ndr->depth++; + ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sam", r->out.sam); + ndr->depth++; + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + ndr->depth--; + ndr_print_ptr(ndr, "num_entries", r->out.num_entries); + ndr->depth++; + ndr_print_uint32(ndr, "num_entries", *r->out.num_entries); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r) +{ + if (flags & NDR_IN) { + if (r->in.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_CHECK(ndr_push_samr_DomainAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + if (r->in.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + } + if (flags & NDR_OUT) { + if (r->out.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.domain_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r) +{ + TALLOC_CTX *_mem_save_connect_handle_0; + TALLOC_CTX *_mem_save_sid_0; + TALLOC_CTX *_mem_save_domain_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_DomainAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.domain_handle); + ZERO_STRUCTP(r->out.domain_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r) +{ + ndr_print_struct(ndr, name, "samr_OpenDomain"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_OpenDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle); + ndr->depth--; + ndr_print_samr_DomainAccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_ptr(ndr, "sid", r->in.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->in.sid); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_OpenDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->out.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->out.domain_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryDomainInfo(struct ndr_push *ndr, int flags, const struct samr_QueryDomainInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryDomainInfo(struct ndr_pull *ndr, int flags, struct samr_QueryDomainInfo *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r) +{ + ndr_print_struct(ndr, name, "samr_QueryDomainInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryDomainInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryDomainInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_DomainInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetDomainInfo(struct ndr_push *ndr, int flags, const struct samr_SetDomainInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetDomainInfo(struct ndr_pull *ndr, int flags, struct samr_SetDomainInfo *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r) +{ + ndr_print_struct(ndr, name, "samr_SetDomainInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetDomainInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_samr_DomainInfo(ndr, "info", r->in.info); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetDomainInfo"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_CreateDomainGroup(struct ndr_push *ndr, int flags, const struct samr_CreateDomainGroup *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_CHECK(ndr_push_samr_GroupAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_CreateDomainGroup(struct ndr_pull *ndr, int flags, struct samr_CreateDomainGroup *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_group_handle_0; + TALLOC_CTX *_mem_save_rid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.name); + } + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_GroupAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.group_handle); + ZERO_STRUCTP(r->out.group_handle); + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r) +{ + ndr_print_struct(ndr, name, "samr_CreateDomainGroup"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_CreateDomainGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "name", r->in.name); + ndr->depth++; + ndr_print_lsa_String(ndr, "name", r->in.name); + ndr->depth--; + ndr_print_samr_GroupAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_CreateDomainGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->out.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle); + ndr->depth--; + ndr_print_ptr(ndr, "rid", r->out.rid); + ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_EnumDomainGroups(struct ndr_push *ndr, int flags, const struct samr_EnumDomainGroups *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_size)); + } + if (flags & NDR_OUT) { + if (r->out.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); + if (r->out.sam == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + if (r->out.num_entries == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_EnumDomainGroups(struct ndr_pull *ndr, int flags, struct samr_EnumDomainGroups *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_resume_handle_0; + TALLOC_CTX *_mem_save_sam_0; + TALLOC_CTX *_mem_save_num_entries_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size)); + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + *r->out.resume_handle = *r->in.resume_handle; + NDR_PULL_ALLOC(ndr, r->out.sam); + ZERO_STRUCTP(r->out.sam); + NDR_PULL_ALLOC(ndr, r->out.num_entries); + ZERO_STRUCTP(r->out.num_entries); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sam); + } + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.num_entries); + } + _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r) +{ + ndr_print_struct(ndr, name, "samr_EnumDomainGroups"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_EnumDomainGroups"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle); + ndr->depth--; + ndr_print_uint32(ndr, "max_size", r->in.max_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_EnumDomainGroups"); + ndr->depth++; + ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sam", r->out.sam); + ndr->depth++; + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + ndr->depth--; + ndr_print_ptr(ndr, "num_entries", r->out.num_entries); + ndr->depth++; + ndr_print_uint32(ndr, "num_entries", *r->out.num_entries); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_CreateUser(struct ndr_push *ndr, int flags, const struct samr_CreateUser *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.account_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name)); + NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_CreateUser(struct ndr_pull *ndr, int flags, struct samr_CreateUser *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_account_name_0; + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_rid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.account_name); + } + _mem_save_account_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.account_name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.user_handle); + ZERO_STRUCTP(r->out.user_handle); + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r) +{ + ndr_print_struct(ndr, name, "samr_CreateUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_CreateUser"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "account_name", r->in.account_name); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", r->in.account_name); + ndr->depth--; + ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_CreateUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->out.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle); + ndr->depth--; + ndr_print_ptr(ndr, "rid", r->out.rid); + ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_EnumDomainUsers(struct ndr_push *ndr, int flags, const struct samr_EnumDomainUsers *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_size)); + } + if (flags & NDR_OUT) { + if (r->out.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); + if (r->out.sam == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + if (r->out.num_entries == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_EnumDomainUsers(struct ndr_pull *ndr, int flags, struct samr_EnumDomainUsers *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_resume_handle_0; + TALLOC_CTX *_mem_save_sam_0; + TALLOC_CTX *_mem_save_num_entries_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_size)); + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + *r->out.resume_handle = *r->in.resume_handle; + NDR_PULL_ALLOC(ndr, r->out.sam); + ZERO_STRUCTP(r->out.sam); + NDR_PULL_ALLOC(ndr, r->out.num_entries); + ZERO_STRUCTP(r->out.num_entries); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sam); + } + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.num_entries); + } + _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r) +{ + ndr_print_struct(ndr, name, "samr_EnumDomainUsers"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_EnumDomainUsers"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle); + ndr->depth--; + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags); + ndr_print_uint32(ndr, "max_size", r->in.max_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_EnumDomainUsers"); + ndr->depth++; + ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sam", r->out.sam); + ndr->depth++; + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + ndr->depth--; + ndr_print_ptr(ndr, "num_entries", r->out.num_entries); + ndr->depth++; + ndr_print_uint32(ndr, "num_entries", *r->out.num_entries); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_CreateDomAlias(struct ndr_push *ndr, int flags, const struct samr_CreateDomAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.alias_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.alias_name)); + NDR_CHECK(ndr_push_samr_AliasAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_CreateDomAlias(struct ndr_pull *ndr, int flags, struct samr_CreateDomAlias *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_alias_name_0; + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_rid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_name); + } + _mem_save_alias_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.alias_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AliasAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + ZERO_STRUCTP(r->out.alias_handle); + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r) +{ + ndr_print_struct(ndr, name, "samr_CreateDomAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_CreateDomAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "alias_name", r->in.alias_name); + ndr->depth++; + ndr_print_lsa_String(ndr, "alias_name", r->in.alias_name); + ndr->depth--; + ndr_print_samr_AliasAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_CreateDomAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle); + ndr->depth--; + ndr_print_ptr(ndr, "rid", r->out.rid); + ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_EnumDomainAliases(struct ndr_push *ndr, int flags, const struct samr_EnumDomainAliases *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.resume_handle)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags)); + } + if (flags & NDR_OUT) { + if (r->out.resume_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.resume_handle)); + if (r->out.sam == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + if (r->out.num_entries == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.num_entries)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_EnumDomainAliases(struct ndr_pull *ndr, int flags, struct samr_EnumDomainAliases *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_resume_handle_0; + TALLOC_CTX *_mem_save_sam_0; + TALLOC_CTX *_mem_save_num_entries_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags)); + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + *r->out.resume_handle = *r->in.resume_handle; + NDR_PULL_ALLOC(ndr, r->out.sam); + ZERO_STRUCTP(r->out.sam); + NDR_PULL_ALLOC(ndr, r->out.num_entries); + ZERO_STRUCTP(r->out.num_entries); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.resume_handle); + } + _mem_save_resume_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.resume_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.resume_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_resume_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sam); + } + _mem_save_sam_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sam, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_SamArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sam)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sam_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.num_entries); + } + _mem_save_num_entries_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.num_entries, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.num_entries)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_num_entries_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r) +{ + ndr_print_struct(ndr, name, "samr_EnumDomainAliases"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_EnumDomainAliases"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle); + ndr->depth--; + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_EnumDomainAliases"); + ndr->depth++; + ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle); + ndr->depth++; + ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sam", r->out.sam); + ndr->depth++; + ndr_print_samr_SamArray(ndr, "sam", r->out.sam); + ndr->depth--; + ndr_print_ptr(ndr, "num_entries", r->out.num_entries); + ndr->depth++; + ndr_print_uint32(ndr, "num_entries", *r->out.num_entries); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetAliasMembership(struct ndr_push *ndr, int flags, const struct samr_GetAliasMembership *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.sids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + } + if (flags & NDR_OUT) { + if (r->out.rids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetAliasMembership(struct ndr_pull *ndr, int flags, struct samr_GetAliasMembership *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_sids_0; + TALLOC_CTX *_mem_save_rids_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sids); + } + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.rids); + ZERO_STRUCTP(r->out.rids); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rids); + } + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r) +{ + ndr_print_struct(ndr, name, "samr_GetAliasMembership"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetAliasMembership"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sids", r->in.sids); + ndr->depth++; + ndr_print_lsa_SidArray(ndr, "sids", r->in.sids); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetAliasMembership"); + ndr->depth++; + ndr_print_ptr(ndr, "rids", r->out.rids); + ndr->depth++; + ndr_print_samr_Ids(ndr, "rids", r->out.rids); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r) +{ + uint32_t cntr_names_0; + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1000)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_names)); + for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->in.names[cntr_names_0])); + } + for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->in.names[cntr_names_0])); + } + } + if (flags & NDR_OUT) { + if (r->out.rids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + if (r->out.types == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r) +{ + uint32_t cntr_names_0; + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_names_0; + TALLOC_CTX *_mem_save_rids_0; + TALLOC_CTX *_mem_save_types_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_names)); + if (r->in.num_names < 0 || r->in.num_names > 1000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.names)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.names)); + if (ndr_get_array_length(ndr, &r->in.names) > ndr_get_array_size(ndr, &r->in.names)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.names), ndr_get_array_length(ndr, &r->in.names)); + } + NDR_PULL_ALLOC_N(ndr, r->in.names, ndr_get_array_size(ndr, &r->in.names)); + _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.names, 0); + for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->in.names[cntr_names_0])); + } + for (cntr_names_0 = 0; cntr_names_0 < r->in.num_names; cntr_names_0++) { + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->in.names[cntr_names_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0); + NDR_PULL_ALLOC(ndr, r->out.rids); + ZERO_STRUCTP(r->out.rids); + NDR_PULL_ALLOC(ndr, r->out.types); + ZERO_STRUCTP(r->out.types); + if (r->in.names) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.names, 1000)); + } + if (r->in.names) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.names, r->in.num_names)); + } + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rids); + } + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.types); + } + _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.types, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r) +{ + uint32_t cntr_names_0; + ndr_print_struct(ndr, name, "samr_LookupNames"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_LookupNames"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint32(ndr, "num_names", r->in.num_names); + ndr->print(ndr, "%s: ARRAY(%d)", "names", r->in.num_names); + ndr->depth++; + for (cntr_names_0=0;cntr_names_0in.num_names;cntr_names_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_names_0); + if (idx_0) { + ndr_print_lsa_String(ndr, "names", &r->in.names[cntr_names_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_LookupNames"); + ndr->depth++; + ndr_print_ptr(ndr, "rids", r->out.rids); + ndr->depth++; + ndr_print_samr_Ids(ndr, "rids", r->out.rids); + ndr->depth--; + ndr_print_ptr(ndr, "types", r->out.types); + ndr->depth++; + ndr_print_samr_Ids(ndr, "types", r->out.types); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_LookupRids(struct ndr_push *ndr, int flags, const struct samr_LookupRids *r) +{ + uint32_t cntr_rids_0; + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_rids)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 1000)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.num_rids)); + for (cntr_rids_0 = 0; cntr_rids_0 < r->in.num_rids; cntr_rids_0++) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rids[cntr_rids_0])); + } + } + if (flags & NDR_OUT) { + if (r->out.names == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_Strings(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.names)); + if (r->out.types == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_LookupRids(struct ndr_pull *ndr, int flags, struct samr_LookupRids *r) +{ + uint32_t cntr_rids_0; + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_rids_0; + TALLOC_CTX *_mem_save_names_0; + TALLOC_CTX *_mem_save_types_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.num_rids)); + if (r->in.num_rids < 0 || r->in.num_rids > 1000) { + return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range"); + } + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.rids)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.rids)); + if (ndr_get_array_length(ndr, &r->in.rids) > ndr_get_array_size(ndr, &r->in.rids)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.rids), ndr_get_array_length(ndr, &r->in.rids)); + } + NDR_PULL_ALLOC_N(ndr, r->in.rids, ndr_get_array_size(ndr, &r->in.rids)); + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.rids, 0); + for (cntr_rids_0 = 0; cntr_rids_0 < r->in.num_rids; cntr_rids_0++) { + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rids[cntr_rids_0])); + } + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, 0); + NDR_PULL_ALLOC(ndr, r->out.names); + ZERO_STRUCTP(r->out.names); + NDR_PULL_ALLOC(ndr, r->out.types); + ZERO_STRUCTP(r->out.types); + if (r->in.rids) { + NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->in.rids, 1000)); + } + if (r->in.rids) { + NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->in.rids, r->in.num_rids)); + } + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.names); + } + _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.names, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_Strings(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.names)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.types); + } + _mem_save_types_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.types, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_Ids(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.types)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_types_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r) +{ + uint32_t cntr_rids_0; + ndr_print_struct(ndr, name, "samr_LookupRids"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_LookupRids"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint32(ndr, "num_rids", r->in.num_rids); + ndr->print(ndr, "%s: ARRAY(%d)", "rids", r->in.num_rids); + ndr->depth++; + for (cntr_rids_0=0;cntr_rids_0in.num_rids;cntr_rids_0++) { + char *idx_0=NULL; + asprintf(&idx_0, "[%d]", cntr_rids_0); + if (idx_0) { + ndr_print_uint32(ndr, "rids", r->in.rids[cntr_rids_0]); + free(idx_0); + } + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_LookupRids"); + ndr->depth++; + ndr_print_ptr(ndr, "names", r->out.names); + ndr->depth++; + ndr_print_lsa_Strings(ndr, "names", r->out.names); + ndr->depth--; + ndr_print_ptr(ndr, "types", r->out.types); + ndr->depth++; + ndr_print_samr_Ids(ndr, "types", r->out.types); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_OpenGroup(struct ndr_push *ndr, int flags, const struct samr_OpenGroup *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_samr_GroupAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + } + if (flags & NDR_OUT) { + if (r->out.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_OpenGroup(struct ndr_pull *ndr, int flags, struct samr_OpenGroup *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_group_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_GroupAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + NDR_PULL_ALLOC(ndr, r->out.group_handle); + ZERO_STRUCTP(r->out.group_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r) +{ + ndr_print_struct(ndr, name, "samr_OpenGroup"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_OpenGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_samr_GroupAccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_OpenGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->out.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryGroupInfo(struct ndr_push *ndr, int flags, const struct samr_QueryGroupInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryGroupInfo(struct ndr_pull *ndr, int flags, struct samr_QueryGroupInfo *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_GroupInfoEnum(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r) +{ + ndr_print_struct(ndr, name, "samr_QueryGroupInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryGroupInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr_print_samr_GroupInfoEnum(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryGroupInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_GroupInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetGroupInfo(struct ndr_push *ndr, int flags, const struct samr_SetGroupInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_CHECK(ndr_push_samr_GroupInfoEnum(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetGroupInfo(struct ndr_pull *ndr, int flags, struct samr_SetGroupInfo *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_GroupInfoEnum(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r) +{ + ndr_print_struct(ndr, name, "samr_SetGroupInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetGroupInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr_print_samr_GroupInfoEnum(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_samr_GroupInfo(ndr, "info", r->in.info); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetGroupInfo"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AddGroupMember(struct ndr_push *ndr, int flags, const struct samr_AddGroupMember *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AddGroupMember(struct ndr_pull *ndr, int flags, struct samr_AddGroupMember *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r) +{ + ndr_print_struct(ndr, name, "samr_AddGroupMember"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_AddGroupMember"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr_print_uint32(ndr, "flags", r->in.flags); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_AddGroupMember"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DeleteDomainGroup(struct ndr_push *ndr, int flags, const struct samr_DeleteDomainGroup *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + } + if (flags & NDR_OUT) { + if (r->out.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DeleteDomainGroup(struct ndr_pull *ndr, int flags, struct samr_DeleteDomainGroup *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.group_handle); + *r->out.group_handle = *r->in.group_handle; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r) +{ + ndr_print_struct(ndr, name, "samr_DeleteDomainGroup"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_DeleteDomainGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_DeleteDomainGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->out.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->out.group_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DeleteGroupMember(struct ndr_push *ndr, int flags, const struct samr_DeleteGroupMember *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DeleteGroupMember(struct ndr_pull *ndr, int flags, struct samr_DeleteGroupMember *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r) +{ + ndr_print_struct(ndr, name, "samr_DeleteGroupMember"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_DeleteGroupMember"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_DeleteGroupMember"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryGroupMember(struct ndr_push *ndr, int flags, const struct samr_QueryGroupMember *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + } + if (flags & NDR_OUT) { + if (r->out.rids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryGroupMember(struct ndr_pull *ndr, int flags, struct samr_QueryGroupMember *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + TALLOC_CTX *_mem_save_rids_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.rids); + ZERO_STRUCTP(r->out.rids); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rids); + } + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_RidTypeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r) +{ + ndr_print_struct(ndr, name, "samr_QueryGroupMember"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryGroupMember"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryGroupMember"); + ndr->depth++; + ndr_print_ptr(ndr, "rids", r->out.rids); + ndr->depth++; + ndr_print_samr_RidTypeArray(ndr, "rids", r->out.rids); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetMemberAttributesOfGroup(struct ndr_push *ndr, int flags, const struct samr_SetMemberAttributesOfGroup *r) +{ + if (flags & NDR_IN) { + if (r->in.group_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetMemberAttributesOfGroup(struct ndr_pull *ndr, int flags, struct samr_SetMemberAttributesOfGroup *r) +{ + TALLOC_CTX *_mem_save_group_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.group_handle); + } + _mem_save_group_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.group_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.group_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_group_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown1)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r) +{ + ndr_print_struct(ndr, name, "samr_SetMemberAttributesOfGroup"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetMemberAttributesOfGroup"); + ndr->depth++; + ndr_print_ptr(ndr, "group_handle", r->in.group_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "group_handle", r->in.group_handle); + ndr->depth--; + ndr_print_uint32(ndr, "unknown1", r->in.unknown1); + ndr_print_uint32(ndr, "unknown2", r->in.unknown2); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetMemberAttributesOfGroup"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_OpenAlias(struct ndr_push *ndr, int flags, const struct samr_OpenAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_samr_AliasAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + } + if (flags & NDR_OUT) { + if (r->out.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_OpenAlias(struct ndr_pull *ndr, int flags, struct samr_OpenAlias *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_alias_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AliasAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + ZERO_STRUCTP(r->out.alias_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r) +{ + ndr_print_struct(ndr, name, "samr_OpenAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_OpenAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_samr_AliasAccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_OpenAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryAliasInfo(struct ndr_push *ndr, int flags, const struct samr_QueryAliasInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryAliasInfo(struct ndr_pull *ndr, int flags, struct samr_QueryAliasInfo *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AliasInfoEnum(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r) +{ + ndr_print_struct(ndr, name, "samr_QueryAliasInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryAliasInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_samr_AliasInfoEnum(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryAliasInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_AliasInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetAliasInfo(struct ndr_push *ndr, int flags, const struct samr_SetAliasInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_CHECK(ndr_push_samr_AliasInfoEnum(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetAliasInfo(struct ndr_pull *ndr, int flags, struct samr_SetAliasInfo *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AliasInfoEnum(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_AliasInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r) +{ + ndr_print_struct(ndr, name, "samr_SetAliasInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetAliasInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_samr_AliasInfoEnum(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_samr_AliasInfo(ndr, "info", r->in.info); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetAliasInfo"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DeleteDomAlias(struct ndr_push *ndr, int flags, const struct samr_DeleteDomAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + } + if (flags & NDR_OUT) { + if (r->out.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DeleteDomAlias(struct ndr_pull *ndr, int flags, struct samr_DeleteDomAlias *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + *r->out.alias_handle = *r->in.alias_handle; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r) +{ + ndr_print_struct(ndr, name, "samr_DeleteDomAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_DeleteDomAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_DeleteDomAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->out.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->out.alias_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AddAliasMember(struct ndr_push *ndr, int flags, const struct samr_AddAliasMember *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + if (r->in.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AddAliasMember(struct ndr_pull *ndr, int flags, struct samr_AddAliasMember *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_sid_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r) +{ + ndr_print_struct(ndr, name, "samr_AddAliasMember"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_AddAliasMember"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sid", r->in.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->in.sid); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_AddAliasMember"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DeleteAliasMember(struct ndr_push *ndr, int flags, const struct samr_DeleteAliasMember *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + if (r->in.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DeleteAliasMember(struct ndr_pull *ndr, int flags, struct samr_DeleteAliasMember *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_sid_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r) +{ + ndr_print_struct(ndr, name, "samr_DeleteAliasMember"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_DeleteAliasMember"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sid", r->in.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->in.sid); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_DeleteAliasMember"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetMembersInAlias(struct ndr_push *ndr, int flags, const struct samr_GetMembersInAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + } + if (flags & NDR_OUT) { + if (r->out.sids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sids)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetMembersInAlias(struct ndr_pull *ndr, int flags, struct samr_GetMembersInAlias *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_sids_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.sids); + ZERO_STRUCTP(r->out.sids); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sids); + } + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r) +{ + ndr_print_struct(ndr, name, "samr_GetMembersInAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetMembersInAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetMembersInAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "sids", r->out.sids); + ndr->depth++; + ndr_print_lsa_SidArray(ndr, "sids", r->out.sids); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + } + if (flags & NDR_OUT) { + if (r->out.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_user_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + NDR_PULL_ALLOC(ndr, r->out.user_handle); + ZERO_STRUCTP(r->out.user_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r) +{ + ndr_print_struct(ndr, name, "samr_OpenUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_OpenUser"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_OpenUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->out.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_DeleteUser(struct ndr_push *ndr, int flags, const struct samr_DeleteUser *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + } + if (flags & NDR_OUT) { + if (r->out.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_DeleteUser(struct ndr_pull *ndr, int flags, struct samr_DeleteUser *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.user_handle); + *r->out.user_handle = *r->in.user_handle; + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r) +{ + ndr_print_struct(ndr, name, "samr_DeleteUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_DeleteUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_DeleteUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->out.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r) +{ + ndr_print_struct(ndr, name, "samr_QueryUserInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryUserInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryUserInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_UserInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r) +{ + ndr_print_struct(ndr, name, "samr_SetUserInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetUserInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_samr_UserInfo(ndr, "info", r->in.info); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetUserInfo"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ChangePasswordUser(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_present)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.old_lm_crypted)); + if (r->in.old_lm_crypted) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.old_lm_crypted)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_lm_crypted)); + if (r->in.new_lm_crypted) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.new_lm_crypted)); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.nt_present)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.old_nt_crypted)); + if (r->in.old_nt_crypted) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.old_nt_crypted)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.new_nt_crypted)); + if (r->in.new_nt_crypted) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.new_nt_crypted)); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.cross1_present)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_cross)); + if (r->in.nt_cross) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_cross)); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.cross2_present)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_cross)); + if (r->in.lm_cross) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_cross)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ChangePasswordUser(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser *r) +{ + uint32_t _ptr_old_lm_crypted; + uint32_t _ptr_new_lm_crypted; + uint32_t _ptr_old_nt_crypted; + uint32_t _ptr_new_nt_crypted; + uint32_t _ptr_nt_cross; + uint32_t _ptr_lm_cross; + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_old_lm_crypted_0; + TALLOC_CTX *_mem_save_new_lm_crypted_0; + TALLOC_CTX *_mem_save_old_nt_crypted_0; + TALLOC_CTX *_mem_save_new_nt_crypted_0; + TALLOC_CTX *_mem_save_nt_cross_0; + TALLOC_CTX *_mem_save_lm_cross_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_present)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_old_lm_crypted)); + if (_ptr_old_lm_crypted) { + NDR_PULL_ALLOC(ndr, r->in.old_lm_crypted); + } else { + r->in.old_lm_crypted = NULL; + } + if (r->in.old_lm_crypted) { + _mem_save_old_lm_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.old_lm_crypted, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.old_lm_crypted)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_old_lm_crypted_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_lm_crypted)); + if (_ptr_new_lm_crypted) { + NDR_PULL_ALLOC(ndr, r->in.new_lm_crypted); + } else { + r->in.new_lm_crypted = NULL; + } + if (r->in.new_lm_crypted) { + _mem_save_new_lm_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.new_lm_crypted, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.new_lm_crypted)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_lm_crypted_0, 0); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.nt_present)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_old_nt_crypted)); + if (_ptr_old_nt_crypted) { + NDR_PULL_ALLOC(ndr, r->in.old_nt_crypted); + } else { + r->in.old_nt_crypted = NULL; + } + if (r->in.old_nt_crypted) { + _mem_save_old_nt_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.old_nt_crypted, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.old_nt_crypted)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_old_nt_crypted_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_new_nt_crypted)); + if (_ptr_new_nt_crypted) { + NDR_PULL_ALLOC(ndr, r->in.new_nt_crypted); + } else { + r->in.new_nt_crypted = NULL; + } + if (r->in.new_nt_crypted) { + _mem_save_new_nt_crypted_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.new_nt_crypted, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.new_nt_crypted)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_new_nt_crypted_0, 0); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.cross1_present)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_cross)); + if (_ptr_nt_cross) { + NDR_PULL_ALLOC(ndr, r->in.nt_cross); + } else { + r->in.nt_cross = NULL; + } + if (r->in.nt_cross) { + _mem_save_nt_cross_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_cross, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_cross)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_cross_0, 0); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.cross2_present)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_cross)); + if (_ptr_lm_cross) { + NDR_PULL_ALLOC(ndr, r->in.lm_cross); + } else { + r->in.lm_cross = NULL; + } + if (r->in.lm_cross) { + _mem_save_lm_cross_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_cross, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_cross)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_cross_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r) +{ + ndr_print_struct(ndr, name, "samr_ChangePasswordUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_ChangePasswordUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr_print_uint8(ndr, "lm_present", r->in.lm_present); + ndr_print_ptr(ndr, "old_lm_crypted", r->in.old_lm_crypted); + ndr->depth++; + if (r->in.old_lm_crypted) { + ndr_print_samr_Password(ndr, "old_lm_crypted", r->in.old_lm_crypted); + } + ndr->depth--; + ndr_print_ptr(ndr, "new_lm_crypted", r->in.new_lm_crypted); + ndr->depth++; + if (r->in.new_lm_crypted) { + ndr_print_samr_Password(ndr, "new_lm_crypted", r->in.new_lm_crypted); + } + ndr->depth--; + ndr_print_uint8(ndr, "nt_present", r->in.nt_present); + ndr_print_ptr(ndr, "old_nt_crypted", r->in.old_nt_crypted); + ndr->depth++; + if (r->in.old_nt_crypted) { + ndr_print_samr_Password(ndr, "old_nt_crypted", r->in.old_nt_crypted); + } + ndr->depth--; + ndr_print_ptr(ndr, "new_nt_crypted", r->in.new_nt_crypted); + ndr->depth++; + if (r->in.new_nt_crypted) { + ndr_print_samr_Password(ndr, "new_nt_crypted", r->in.new_nt_crypted); + } + ndr->depth--; + ndr_print_uint8(ndr, "cross1_present", r->in.cross1_present); + ndr_print_ptr(ndr, "nt_cross", r->in.nt_cross); + ndr->depth++; + if (r->in.nt_cross) { + ndr_print_samr_Password(ndr, "nt_cross", r->in.nt_cross); + } + ndr->depth--; + ndr_print_uint8(ndr, "cross2_present", r->in.cross2_present); + ndr_print_ptr(ndr, "lm_cross", r->in.lm_cross); + ndr->depth++; + if (r->in.lm_cross) { + ndr_print_samr_Password(ndr, "lm_cross", r->in.lm_cross); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_ChangePasswordUser"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetGroupsForUser(struct ndr_push *ndr, int flags, const struct samr_GetGroupsForUser *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + } + if (flags & NDR_OUT) { + if (r->out.rids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_RidWithAttributeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetGroupsForUser(struct ndr_pull *ndr, int flags, struct samr_GetGroupsForUser *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_rids_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.rids); + ZERO_STRUCTP(r->out.rids); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rids); + } + _mem_save_rids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_RidWithAttributeArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rids_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r) +{ + ndr_print_struct(ndr, name, "samr_GetGroupsForUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetGroupsForUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetGroupsForUser"); + ndr->depth++; + ndr_print_ptr(ndr, "rids", r->out.rids); + ndr->depth++; + ndr_print_samr_RidWithAttributeArray(ndr, "rids", r->out.rids); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryDisplayInfo(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size)); + } + if (flags & NDR_OUT) { + if (r->out.total_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size)); + if (r->out.returned_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_total_size_0; + TALLOC_CTX *_mem_save_returned_size_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size)); + NDR_PULL_ALLOC(ndr, r->out.total_size); + ZERO_STRUCTP(r->out.total_size); + NDR_PULL_ALLOC(ndr, r->out.returned_size); + ZERO_STRUCTP(r->out.returned_size); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.total_size); + } + _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.returned_size); + } + _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r) +{ + ndr_print_struct(ndr, name, "samr_QueryDisplayInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_uint32(ndr, "start_idx", r->in.start_idx); + ndr_print_uint32(ndr, "max_entries", r->in.max_entries); + ndr_print_uint32(ndr, "buf_size", r->in.buf_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "total_size", r->out.total_size); + ndr->depth++; + ndr_print_uint32(ndr, "total_size", *r->out.total_size); + ndr->depth--; + ndr_print_ptr(ndr, "returned_size", r->out.returned_size); + ndr->depth++; + ndr_print_uint32(ndr, "returned_size", *r->out.returned_size); + ndr->depth--; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_DispInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetDisplayEnumerationIndex(struct ndr_push *ndr, int flags, const struct samr_GetDisplayEnumerationIndex *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + } + if (flags & NDR_OUT) { + if (r->out.idx == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.idx)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetDisplayEnumerationIndex(struct ndr_pull *ndr, int flags, struct samr_GetDisplayEnumerationIndex *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_idx_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_PULL_ALLOC(ndr, r->out.idx); + ZERO_STRUCTP(r->out.idx); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.idx); + } + _mem_save_idx_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.idx, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.idx)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_idx_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r) +{ + ndr_print_struct(ndr, name, "samr_GetDisplayEnumerationIndex"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetDisplayEnumerationIndex"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_String(ndr, "name", &r->in.name); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetDisplayEnumerationIndex"); + ndr->depth++; + ndr_print_ptr(ndr, "idx", r->out.idx); + ndr->depth++; + ndr_print_uint32(ndr, "idx", *r->out.idx); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_TestPrivateFunctionsDomain(struct ndr_push *ndr, int flags, const struct samr_TestPrivateFunctionsDomain *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_TestPrivateFunctionsDomain(struct ndr_pull *ndr, int flags, struct samr_TestPrivateFunctionsDomain *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r) +{ + ndr_print_struct(ndr, name, "samr_TestPrivateFunctionsDomain"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_TestPrivateFunctionsDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_TestPrivateFunctionsDomain"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_TestPrivateFunctionsUser(struct ndr_push *ndr, int flags, const struct samr_TestPrivateFunctionsUser *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_TestPrivateFunctionsUser(struct ndr_pull *ndr, int flags, struct samr_TestPrivateFunctionsUser *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r) +{ + ndr_print_struct(ndr, name, "samr_TestPrivateFunctionsUser"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_TestPrivateFunctionsUser"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_TestPrivateFunctionsUser"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_PwInfo(ndr, NDR_SCALARS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_PwInfo(ndr, NDR_SCALARS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r) +{ + ndr_print_struct(ndr, name, "samr_GetUserPwInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetUserPwInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetUserPwInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_samr_PwInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_RemoveMemberFromForeignDomain(struct ndr_push *ndr, int flags, const struct samr_RemoveMemberFromForeignDomain *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_RemoveMemberFromForeignDomain(struct ndr_pull *ndr, int flags, struct samr_RemoveMemberFromForeignDomain *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_sid_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r) +{ + ndr_print_struct(ndr, name, "samr_RemoveMemberFromForeignDomain"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_RemoveMemberFromForeignDomain"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sid", r->in.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->in.sid); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_RemoveMemberFromForeignDomain"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryDomainInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryDomainInfo2 *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryDomainInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryDomainInfo2 *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DomainInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_QueryDomainInfo2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryDomainInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryDomainInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_DomainInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryUserInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo2 *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryUserInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo2 *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_QueryUserInfo2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryUserInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryUserInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_UserInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryDisplayInfo2(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo2 *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size)); + } + if (flags & NDR_OUT) { + if (r->out.total_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size)); + if (r->out.returned_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo2(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo2 *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_total_size_0; + TALLOC_CTX *_mem_save_returned_size_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size)); + NDR_PULL_ALLOC(ndr, r->out.total_size); + ZERO_STRUCTP(r->out.total_size); + NDR_PULL_ALLOC(ndr, r->out.returned_size); + ZERO_STRUCTP(r->out.returned_size); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.total_size); + } + _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.returned_size); + } + _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_QueryDisplayInfo2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_uint32(ndr, "start_idx", r->in.start_idx); + ndr_print_uint32(ndr, "max_entries", r->in.max_entries); + ndr_print_uint32(ndr, "buf_size", r->in.buf_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "total_size", r->out.total_size); + ndr->depth++; + ndr_print_uint32(ndr, "total_size", *r->out.total_size); + ndr->depth--; + ndr_print_ptr(ndr, "returned_size", r->out.returned_size); + ndr->depth++; + ndr_print_uint32(ndr, "returned_size", *r->out.returned_size); + ndr->depth--; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_DispInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetDisplayEnumerationIndex2(struct ndr_push *ndr, int flags, const struct samr_GetDisplayEnumerationIndex2 *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + } + if (flags & NDR_OUT) { + if (r->out.idx == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.idx)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetDisplayEnumerationIndex2(struct ndr_pull *ndr, int flags, struct samr_GetDisplayEnumerationIndex2 *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_idx_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.name)); + NDR_PULL_ALLOC(ndr, r->out.idx); + ZERO_STRUCTP(r->out.idx); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.idx); + } + _mem_save_idx_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.idx, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.idx)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_idx_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r) +{ + ndr_print_struct(ndr, name, "samr_GetDisplayEnumerationIndex2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetDisplayEnumerationIndex2"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_lsa_String(ndr, "name", &r->in.name); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetDisplayEnumerationIndex2"); + ndr->depth++; + ndr_print_ptr(ndr, "idx", r->out.idx); + ndr->depth++; + ndr_print_uint32(ndr, "idx", *r->out.idx); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_CreateUser2(struct ndr_push *ndr, int flags, const struct samr_CreateUser2 *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + if (r->in.account_name == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name)); + NDR_CHECK(ndr_push_samr_AcctFlags(ndr, NDR_SCALARS, r->in.acct_flags)); + NDR_CHECK(ndr_push_samr_UserAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + if (r->out.access_granted == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.access_granted)); + if (r->out.rid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.rid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_CreateUser2(struct ndr_pull *ndr, int flags, struct samr_CreateUser2 *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_account_name_0; + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_access_granted_0; + TALLOC_CTX *_mem_save_rid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.account_name); + } + _mem_save_account_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.account_name, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_name_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_AcctFlags(ndr, NDR_SCALARS, &r->in.acct_flags)); + NDR_CHECK(ndr_pull_samr_UserAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.user_handle); + ZERO_STRUCTP(r->out.user_handle); + NDR_PULL_ALLOC(ndr, r->out.access_granted); + ZERO_STRUCTP(r->out.access_granted); + NDR_PULL_ALLOC(ndr, r->out.rid); + ZERO_STRUCTP(r->out.rid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.access_granted); + } + _mem_save_access_granted_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.access_granted, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.access_granted)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_access_granted_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rid); + } + _mem_save_rid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.rid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r) +{ + ndr_print_struct(ndr, name, "samr_CreateUser2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_CreateUser2"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_ptr(ndr, "account_name", r->in.account_name); + ndr->depth++; + ndr_print_lsa_String(ndr, "account_name", r->in.account_name); + ndr->depth--; + ndr_print_samr_AcctFlags(ndr, "acct_flags", r->in.acct_flags); + ndr_print_samr_UserAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_CreateUser2"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->out.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->out.user_handle); + ndr->depth--; + ndr_print_ptr(ndr, "access_granted", r->out.access_granted); + ndr->depth++; + ndr_print_uint32(ndr, "access_granted", *r->out.access_granted); + ndr->depth--; + ndr_print_ptr(ndr, "rid", r->out.rid); + ndr->depth++; + ndr_print_uint32(ndr, "rid", *r->out.rid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_QueryDisplayInfo3(struct ndr_push *ndr, int flags, const struct samr_QueryDisplayInfo3 *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.start_idx)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.max_entries)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.buf_size)); + } + if (flags & NDR_OUT) { + if (r->out.total_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.total_size)); + if (r->out.returned_size == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.returned_size)); + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_push_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_QueryDisplayInfo3(struct ndr_pull *ndr, int flags, struct samr_QueryDisplayInfo3 *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_total_size_0; + TALLOC_CTX *_mem_save_returned_size_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.start_idx)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.max_entries)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.buf_size)); + NDR_PULL_ALLOC(ndr, r->out.total_size); + ZERO_STRUCTP(r->out.total_size); + NDR_PULL_ALLOC(ndr, r->out.returned_size); + ZERO_STRUCTP(r->out.returned_size); + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.total_size); + } + _mem_save_total_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.total_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.total_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_total_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.returned_size); + } + _mem_save_returned_size_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.returned_size, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.returned_size)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_returned_size_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_DispInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r) +{ + ndr_print_struct(ndr, name, "samr_QueryDisplayInfo3"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_QueryDisplayInfo3"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_uint32(ndr, "start_idx", r->in.start_idx); + ndr_print_uint32(ndr, "max_entries", r->in.max_entries); + ndr_print_uint32(ndr, "buf_size", r->in.buf_size); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_QueryDisplayInfo3"); + ndr->depth++; + ndr_print_ptr(ndr, "total_size", r->out.total_size); + ndr->depth++; + ndr_print_uint32(ndr, "total_size", *r->out.total_size); + ndr->depth--; + ndr_print_ptr(ndr, "returned_size", r->out.returned_size); + ndr->depth++; + ndr_print_uint32(ndr, "returned_size", *r->out.returned_size); + ndr->depth--; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info, r->in.level); + ndr_print_samr_DispInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_AddMultipleMembersToAlias(struct ndr_push *ndr, int flags, const struct samr_AddMultipleMembersToAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + if (r->in.sids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_AddMultipleMembersToAlias(struct ndr_pull *ndr, int flags, struct samr_AddMultipleMembersToAlias *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_sids_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sids); + } + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r) +{ + ndr_print_struct(ndr, name, "samr_AddMultipleMembersToAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_AddMultipleMembersToAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sids", r->in.sids); + ndr->depth++; + ndr_print_lsa_SidArray(ndr, "sids", r->in.sids); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_AddMultipleMembersToAlias"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_RemoveMultipleMembersFromAlias(struct ndr_push *ndr, int flags, const struct samr_RemoveMultipleMembersFromAlias *r) +{ + if (flags & NDR_IN) { + if (r->in.alias_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + if (r->in.sids == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_RemoveMultipleMembersFromAlias(struct ndr_pull *ndr, int flags, struct samr_RemoveMultipleMembersFromAlias *r) +{ + TALLOC_CTX *_mem_save_alias_handle_0; + TALLOC_CTX *_mem_save_sids_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.alias_handle); + } + _mem_save_alias_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.alias_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.alias_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_alias_handle_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.sids); + } + _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.sids, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_SidArray(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sids)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r) +{ + ndr_print_struct(ndr, name, "samr_RemoveMultipleMembersFromAlias"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_RemoveMultipleMembersFromAlias"); + ndr->depth++; + ndr_print_ptr(ndr, "alias_handle", r->in.alias_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "alias_handle", r->in.alias_handle); + ndr->depth--; + ndr_print_ptr(ndr, "sids", r->in.sids); + ndr->depth++; + ndr_print_lsa_SidArray(ndr, "sids", r->in.sids); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_RemoveMultipleMembersFromAlias"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_OemChangePasswordUser2(struct ndr_push *ndr, int flags, const struct samr_OemChangePasswordUser2 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server)); + if (r->in.server) { + NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + } + if (r->in.account == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password)); + if (r->in.password) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hash)); + if (r->in.hash) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.hash)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_OemChangePasswordUser2(struct ndr_pull *ndr, int flags, struct samr_OemChangePasswordUser2 *r) +{ + uint32_t _ptr_server; + uint32_t _ptr_password; + uint32_t _ptr_hash; + TALLOC_CTX *_mem_save_server_0; + TALLOC_CTX *_mem_save_account_0; + TALLOC_CTX *_mem_save_password_0; + TALLOC_CTX *_mem_save_hash_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); + if (_ptr_server) { + NDR_PULL_ALLOC(ndr, r->in.server); + } else { + r->in.server = NULL; + } + if (r->in.server) { + _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0); + NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.account); + } + _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_AsciiString(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password)); + if (_ptr_password) { + NDR_PULL_ALLOC(ndr, r->in.password); + } else { + r->in.password = NULL; + } + if (r->in.password) { + _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.password, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hash)); + if (_ptr_hash) { + NDR_PULL_ALLOC(ndr, r->in.hash); + } else { + r->in.hash = NULL; + } + if (r->in.hash) { + _mem_save_hash_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hash, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.hash)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hash_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r) +{ + ndr_print_struct(ndr, name, "samr_OemChangePasswordUser2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_OemChangePasswordUser2"); + ndr->depth++; + ndr_print_ptr(ndr, "server", r->in.server); + ndr->depth++; + if (r->in.server) { + ndr_print_lsa_AsciiString(ndr, "server", r->in.server); + } + ndr->depth--; + ndr_print_ptr(ndr, "account", r->in.account); + ndr->depth++; + ndr_print_lsa_AsciiString(ndr, "account", r->in.account); + ndr->depth--; + ndr_print_ptr(ndr, "password", r->in.password); + ndr->depth++; + if (r->in.password) { + ndr_print_samr_CryptPassword(ndr, "password", r->in.password); + } + ndr->depth--; + ndr_print_ptr(ndr, "hash", r->in.hash); + ndr->depth++; + if (r->in.hash) { + ndr_print_samr_Password(ndr, "hash", r->in.hash); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_OemChangePasswordUser2"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ChangePasswordUser2(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser2 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server)); + if (r->in.server) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + } + if (r->in.account == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_password)); + if (r->in.nt_password) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_verifier)); + if (r->in.nt_verifier) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier)); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_change)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_password)); + if (r->in.lm_password) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_verifier)); + if (r->in.lm_verifier) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ChangePasswordUser2(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser2 *r) +{ + uint32_t _ptr_server; + uint32_t _ptr_nt_password; + uint32_t _ptr_nt_verifier; + uint32_t _ptr_lm_password; + uint32_t _ptr_lm_verifier; + TALLOC_CTX *_mem_save_server_0; + TALLOC_CTX *_mem_save_account_0; + TALLOC_CTX *_mem_save_nt_password_0; + TALLOC_CTX *_mem_save_nt_verifier_0; + TALLOC_CTX *_mem_save_lm_password_0; + TALLOC_CTX *_mem_save_lm_verifier_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); + if (_ptr_server) { + NDR_PULL_ALLOC(ndr, r->in.server); + } else { + r->in.server = NULL; + } + if (r->in.server) { + _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.account); + } + _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_password)); + if (_ptr_nt_password) { + NDR_PULL_ALLOC(ndr, r->in.nt_password); + } else { + r->in.nt_password = NULL; + } + if (r->in.nt_password) { + _mem_save_nt_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_password, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_password_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_verifier)); + if (_ptr_nt_verifier) { + NDR_PULL_ALLOC(ndr, r->in.nt_verifier); + } else { + r->in.nt_verifier = NULL; + } + if (r->in.nt_verifier) { + _mem_save_nt_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_verifier, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_verifier_0, 0); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_change)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_password)); + if (_ptr_lm_password) { + NDR_PULL_ALLOC(ndr, r->in.lm_password); + } else { + r->in.lm_password = NULL; + } + if (r->in.lm_password) { + _mem_save_lm_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_password, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_password_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_verifier)); + if (_ptr_lm_verifier) { + NDR_PULL_ALLOC(ndr, r->in.lm_verifier); + } else { + r->in.lm_verifier = NULL; + } + if (r->in.lm_verifier) { + _mem_save_lm_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_verifier, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_verifier_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r) +{ + ndr_print_struct(ndr, name, "samr_ChangePasswordUser2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_ChangePasswordUser2"); + ndr->depth++; + ndr_print_ptr(ndr, "server", r->in.server); + ndr->depth++; + if (r->in.server) { + ndr_print_lsa_String(ndr, "server", r->in.server); + } + ndr->depth--; + ndr_print_ptr(ndr, "account", r->in.account); + ndr->depth++; + ndr_print_lsa_String(ndr, "account", r->in.account); + ndr->depth--; + ndr_print_ptr(ndr, "nt_password", r->in.nt_password); + ndr->depth++; + if (r->in.nt_password) { + ndr_print_samr_CryptPassword(ndr, "nt_password", r->in.nt_password); + } + ndr->depth--; + ndr_print_ptr(ndr, "nt_verifier", r->in.nt_verifier); + ndr->depth++; + if (r->in.nt_verifier) { + ndr_print_samr_Password(ndr, "nt_verifier", r->in.nt_verifier); + } + ndr->depth--; + ndr_print_uint8(ndr, "lm_change", r->in.lm_change); + ndr_print_ptr(ndr, "lm_password", r->in.lm_password); + ndr->depth++; + if (r->in.lm_password) { + ndr_print_samr_CryptPassword(ndr, "lm_password", r->in.lm_password); + } + ndr->depth--; + ndr_print_ptr(ndr, "lm_verifier", r->in.lm_verifier); + ndr->depth++; + if (r->in.lm_verifier) { + ndr_print_samr_Password(ndr, "lm_verifier", r->in.lm_verifier); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_ChangePasswordUser2"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetDomPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetDomPwInfo *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.domain_name)); + if (r->in.domain_name) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name)); + } + } + if (flags & NDR_OUT) { + if (r->out.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_PwInfo(ndr, NDR_SCALARS, r->out.info)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetDomPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetDomPwInfo *r) +{ + uint32_t _ptr_domain_name; + TALLOC_CTX *_mem_save_domain_name_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domain_name)); + if (_ptr_domain_name) { + NDR_PULL_ALLOC(ndr, r->in.domain_name); + } else { + r->in.domain_name = NULL; + } + if (r->in.domain_name) { + _mem_save_domain_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_name, 0); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.domain_name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_name_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.info); + ZERO_STRUCTP(r->out.info); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_PwInfo(ndr, NDR_SCALARS, r->out.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r) +{ + ndr_print_struct(ndr, name, "samr_GetDomPwInfo"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetDomPwInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_name", r->in.domain_name); + ndr->depth++; + if (r->in.domain_name) { + ndr_print_lsa_String(ndr, "domain_name", r->in.domain_name); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetDomPwInfo"); + ndr->depth++; + ndr_print_ptr(ndr, "info", r->out.info); + ndr->depth++; + ndr_print_samr_PwInfo(ndr, "info", r->out.info); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_Connect2(struct ndr_push *ndr, int flags, const struct samr_Connect2 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Connect2(struct ndr_pull *ndr, int flags, struct samr_Connect2 *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name)); + if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + ZERO_STRUCTP(r->out.connect_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r) +{ + ndr_print_struct(ndr, name, "samr_Connect2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Connect2"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_string(ndr, "system_name", r->in.system_name); + } + ndr->depth--; + ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Connect2"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r) +{ + if (flags & NDR_IN) { + if (r->in.user_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.level)); + if (r->in.info == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_push_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r) +{ + TALLOC_CTX *_mem_save_user_handle_0; + TALLOC_CTX *_mem_save_info_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.user_handle); + } + _mem_save_user_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.user_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.user_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.level)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info); + } + _mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info, r->in.level)); + NDR_CHECK(ndr_pull_samr_UserInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.info)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, LIBNDR_FLAG_REF_ALLOC); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r) +{ + ndr_print_struct(ndr, name, "samr_SetUserInfo2"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetUserInfo2"); + ndr->depth++; + ndr_print_ptr(ndr, "user_handle", r->in.user_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "user_handle", r->in.user_handle); + ndr->depth--; + ndr_print_uint16(ndr, "level", r->in.level); + ndr_print_ptr(ndr, "info", r->in.info); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info, r->in.level); + ndr_print_samr_UserInfo(ndr, "info", r->in.info); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetUserInfo2"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetBootKeyInformation(struct ndr_push *ndr, int flags, const struct samr_SetBootKeyInformation *r) +{ + if (flags & NDR_IN) { + if (r->in.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown1)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown2)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown3)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetBootKeyInformation(struct ndr_pull *ndr, int flags, struct samr_SetBootKeyInformation *r) +{ + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown1)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown2)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown3)); + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r) +{ + ndr_print_struct(ndr, name, "samr_SetBootKeyInformation"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetBootKeyInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->in.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->in.connect_handle); + ndr->depth--; + ndr_print_uint32(ndr, "unknown1", r->in.unknown1); + ndr_print_uint32(ndr, "unknown2", r->in.unknown2); + ndr_print_uint32(ndr, "unknown3", r->in.unknown3); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetBootKeyInformation"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_GetBootKeyInformation(struct ndr_push *ndr, int flags, const struct samr_GetBootKeyInformation *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + } + if (flags & NDR_OUT) { + if (r->out.unknown == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.unknown)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_GetBootKeyInformation(struct ndr_pull *ndr, int flags, struct samr_GetBootKeyInformation *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_unknown_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.unknown); + ZERO_STRUCTP(r->out.unknown); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.unknown); + } + _mem_save_unknown_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.unknown, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.unknown)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_unknown_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r) +{ + ndr_print_struct(ndr, name, "samr_GetBootKeyInformation"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_GetBootKeyInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_GetBootKeyInformation"); + ndr->depth++; + ndr_print_ptr(ndr, "unknown", r->out.unknown); + ndr->depth++; + ndr_print_uint32(ndr, "unknown", *r->out.unknown); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_Connect3(struct ndr_push *ndr, int flags, const struct samr_Connect3 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); + NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Connect3(struct ndr_pull *ndr, int flags, struct samr_Connect3 *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name)); + if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + ZERO_STRUCTP(r->out.connect_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r) +{ + ndr_print_struct(ndr, name, "samr_Connect3"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Connect3"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_string(ndr, "system_name", r->in.system_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "unknown", r->in.unknown); + ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Connect3"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_Connect4(struct ndr_push *ndr, int flags, const struct samr_Connect4 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); + NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + } + if (flags & NDR_OUT) { + if (r->out.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_Connect4(struct ndr_pull *ndr, int flags, struct samr_Connect4 *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name)); + if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + ZERO_STRUCTP(r->out.connect_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r) +{ + ndr_print_struct(ndr, name, "samr_Connect4"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Connect4"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_string(ndr, "system_name", r->in.system_name); + } + ndr->depth--; + ndr_print_uint32(ndr, "unknown", r->in.unknown); + ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Connect4"); + ndr->depth++; + ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ChangePasswordUser3(struct ndr_push *ndr, int flags, const struct samr_ChangePasswordUser3 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.server)); + if (r->in.server) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + } + if (r->in.account == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_password)); + if (r->in.nt_password) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.nt_verifier)); + if (r->in.nt_verifier) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier)); + } + NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->in.lm_change)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_password)); + if (r->in.lm_password) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.lm_verifier)); + if (r->in.lm_verifier) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier)); + } + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.password3)); + if (r->in.password3) { + NDR_CHECK(ndr_push_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password3)); + } + } + if (flags & NDR_OUT) { + if (r->out.dominfo == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo)); + if (r->out.reject == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ChangePasswordUser3(struct ndr_pull *ndr, int flags, struct samr_ChangePasswordUser3 *r) +{ + uint32_t _ptr_server; + uint32_t _ptr_nt_password; + uint32_t _ptr_nt_verifier; + uint32_t _ptr_lm_password; + uint32_t _ptr_lm_verifier; + uint32_t _ptr_password3; + TALLOC_CTX *_mem_save_server_0; + TALLOC_CTX *_mem_save_account_0; + TALLOC_CTX *_mem_save_nt_password_0; + TALLOC_CTX *_mem_save_nt_verifier_0; + TALLOC_CTX *_mem_save_lm_password_0; + TALLOC_CTX *_mem_save_lm_verifier_0; + TALLOC_CTX *_mem_save_password3_0; + TALLOC_CTX *_mem_save_dominfo_0; + TALLOC_CTX *_mem_save_reject_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_server)); + if (_ptr_server) { + NDR_PULL_ALLOC(ndr, r->in.server); + } else { + r->in.server = NULL; + } + if (r->in.server) { + _mem_save_server_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.server, 0); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.server)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_server_0, 0); + } + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.account); + } + _mem_save_account_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.account, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.account)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_account_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_password)); + if (_ptr_nt_password) { + NDR_PULL_ALLOC(ndr, r->in.nt_password); + } else { + r->in.nt_password = NULL; + } + if (r->in.nt_password) { + _mem_save_nt_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_password, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.nt_password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_password_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_nt_verifier)); + if (_ptr_nt_verifier) { + NDR_PULL_ALLOC(ndr, r->in.nt_verifier); + } else { + r->in.nt_verifier = NULL; + } + if (r->in.nt_verifier) { + _mem_save_nt_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.nt_verifier, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.nt_verifier)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_nt_verifier_0, 0); + } + NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->in.lm_change)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_password)); + if (_ptr_lm_password) { + NDR_PULL_ALLOC(ndr, r->in.lm_password); + } else { + r->in.lm_password = NULL; + } + if (r->in.lm_password) { + _mem_save_lm_password_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_password, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.lm_password)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_password_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_lm_verifier)); + if (_ptr_lm_verifier) { + NDR_PULL_ALLOC(ndr, r->in.lm_verifier); + } else { + r->in.lm_verifier = NULL; + } + if (r->in.lm_verifier) { + _mem_save_lm_verifier_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.lm_verifier, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.lm_verifier)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_lm_verifier_0, 0); + } + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password3)); + if (_ptr_password3) { + NDR_PULL_ALLOC(ndr, r->in.password3); + } else { + r->in.password3 = NULL; + } + if (r->in.password3) { + _mem_save_password3_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.password3, 0); + NDR_CHECK(ndr_pull_samr_CryptPassword(ndr, NDR_SCALARS, r->in.password3)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password3_0, 0); + } + NDR_PULL_ALLOC(ndr, r->out.dominfo); + ZERO_STRUCTP(r->out.dominfo); + NDR_PULL_ALLOC(ndr, r->out.reject); + ZERO_STRUCTP(r->out.reject); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.dominfo); + } + _mem_save_dominfo_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.dominfo, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_DomInfo1(ndr, NDR_SCALARS, r->out.dominfo)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_dominfo_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.reject); + } + _mem_save_reject_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.reject, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_samr_ChangeReject(ndr, NDR_SCALARS, r->out.reject)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_reject_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r) +{ + ndr_print_struct(ndr, name, "samr_ChangePasswordUser3"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_ChangePasswordUser3"); + ndr->depth++; + ndr_print_ptr(ndr, "server", r->in.server); + ndr->depth++; + if (r->in.server) { + ndr_print_lsa_String(ndr, "server", r->in.server); + } + ndr->depth--; + ndr_print_ptr(ndr, "account", r->in.account); + ndr->depth++; + ndr_print_lsa_String(ndr, "account", r->in.account); + ndr->depth--; + ndr_print_ptr(ndr, "nt_password", r->in.nt_password); + ndr->depth++; + if (r->in.nt_password) { + ndr_print_samr_CryptPassword(ndr, "nt_password", r->in.nt_password); + } + ndr->depth--; + ndr_print_ptr(ndr, "nt_verifier", r->in.nt_verifier); + ndr->depth++; + if (r->in.nt_verifier) { + ndr_print_samr_Password(ndr, "nt_verifier", r->in.nt_verifier); + } + ndr->depth--; + ndr_print_uint8(ndr, "lm_change", r->in.lm_change); + ndr_print_ptr(ndr, "lm_password", r->in.lm_password); + ndr->depth++; + if (r->in.lm_password) { + ndr_print_samr_CryptPassword(ndr, "lm_password", r->in.lm_password); + } + ndr->depth--; + ndr_print_ptr(ndr, "lm_verifier", r->in.lm_verifier); + ndr->depth++; + if (r->in.lm_verifier) { + ndr_print_samr_Password(ndr, "lm_verifier", r->in.lm_verifier); + } + ndr->depth--; + ndr_print_ptr(ndr, "password3", r->in.password3); + ndr->depth++; + if (r->in.password3) { + ndr_print_samr_CryptPassword(ndr, "password3", r->in.password3); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_ChangePasswordUser3"); + ndr->depth++; + ndr_print_ptr(ndr, "dominfo", r->out.dominfo); + ndr->depth++; + ndr_print_samr_DomInfo1(ndr, "dominfo", r->out.dominfo); + ndr->depth--; + ndr_print_ptr(ndr, "reject", r->out.reject); + ndr->depth++; + ndr_print_samr_ChangeReject(ndr, "reject", r->out.reject); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +_PUBLIC_ enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.system_name)); + if (r->in.system_name) { + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->in.system_name, CH_UTF16))); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.system_name, ndr_charset_length(r->in.system_name, CH_UTF16), sizeof(uint16_t), CH_UTF16)); + } + NDR_CHECK(ndr_push_samr_ConnectAccessMask(ndr, NDR_SCALARS, r->in.access_mask)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.level_in)); + if (r->in.info_in == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->in.info_in, r->in.level_in)); + NDR_CHECK(ndr_push_samr_ConnectInfo(ndr, NDR_SCALARS, r->in.info_in)); + } + if (flags & NDR_OUT) { + if (r->out.level_out == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.level_out)); + if (r->out.info_out == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.info_out, *r->out.level_out)); + NDR_CHECK(ndr_push_samr_ConnectInfo(ndr, NDR_SCALARS, r->out.info_out)); + if (r->out.connect_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r) +{ + uint32_t _ptr_system_name; + TALLOC_CTX *_mem_save_system_name_0; + TALLOC_CTX *_mem_save_info_in_0; + TALLOC_CTX *_mem_save_level_out_0; + TALLOC_CTX *_mem_save_info_out_0; + TALLOC_CTX *_mem_save_connect_handle_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_system_name)); + if (_ptr_system_name) { + NDR_PULL_ALLOC(ndr, r->in.system_name); + } else { + r->in.system_name = NULL; + } + if (r->in.system_name) { + _mem_save_system_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.system_name, 0); + NDR_CHECK(ndr_pull_array_size(ndr, &r->in.system_name)); + NDR_CHECK(ndr_pull_array_length(ndr, &r->in.system_name)); + if (ndr_get_array_length(ndr, &r->in.system_name) > ndr_get_array_size(ndr, &r->in.system_name)) { + return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.system_name), ndr_get_array_length(ndr, &r->in.system_name)); + } + NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t))); + NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.system_name, ndr_get_array_length(ndr, &r->in.system_name), sizeof(uint16_t), CH_UTF16)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_system_name_0, 0); + } + NDR_CHECK(ndr_pull_samr_ConnectAccessMask(ndr, NDR_SCALARS, &r->in.access_mask)); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.level_in)); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.info_in); + } + _mem_save_info_in_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.info_in, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->in.info_in, r->in.level_in)); + NDR_CHECK(ndr_pull_samr_ConnectInfo(ndr, NDR_SCALARS, r->in.info_in)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_in_0, LIBNDR_FLAG_REF_ALLOC); + NDR_PULL_ALLOC(ndr, r->out.level_out); + ZERO_STRUCTP(r->out.level_out); + NDR_PULL_ALLOC(ndr, r->out.info_out); + ZERO_STRUCTP(r->out.info_out); + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + ZERO_STRUCTP(r->out.connect_handle); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.level_out); + } + _mem_save_level_out_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.level_out, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.level_out)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_level_out_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.info_out); + } + _mem_save_info_out_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.info_out, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.info_out, *r->out.level_out)); + NDR_CHECK(ndr_pull_samr_ConnectInfo(ndr, NDR_SCALARS, r->out.info_out)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_out_0, LIBNDR_FLAG_REF_ALLOC); + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.connect_handle); + } + _mem_save_connect_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.connect_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->out.connect_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_connect_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r) +{ + ndr_print_struct(ndr, name, "samr_Connect5"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_Connect5"); + ndr->depth++; + ndr_print_ptr(ndr, "system_name", r->in.system_name); + ndr->depth++; + if (r->in.system_name) { + ndr_print_string(ndr, "system_name", r->in.system_name); + } + ndr->depth--; + ndr_print_samr_ConnectAccessMask(ndr, "access_mask", r->in.access_mask); + ndr_print_uint32(ndr, "level_in", r->in.level_in); + ndr_print_ptr(ndr, "info_in", r->in.info_in); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->in.info_in, r->in.level_in); + ndr_print_samr_ConnectInfo(ndr, "info_in", r->in.info_in); + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_Connect5"); + ndr->depth++; + ndr_print_ptr(ndr, "level_out", r->out.level_out); + ndr->depth++; + ndr_print_uint32(ndr, "level_out", *r->out.level_out); + ndr->depth--; + ndr_print_ptr(ndr, "info_out", r->out.info_out); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.info_out, *r->out.level_out); + ndr_print_samr_ConnectInfo(ndr, "info_out", r->out.info_out); + ndr->depth--; + ndr_print_ptr(ndr, "connect_handle", r->out.connect_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "connect_handle", r->out.connect_handle); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_RidToSid(struct ndr_push *ndr, int flags, const struct samr_RidToSid *r) +{ + if (flags & NDR_IN) { + if (r->in.domain_handle == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.rid)); + } + if (flags & NDR_OUT) { + if (r->out.sid == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_RidToSid(struct ndr_pull *ndr, int flags, struct samr_RidToSid *r) +{ + TALLOC_CTX *_mem_save_domain_handle_0; + TALLOC_CTX *_mem_save_sid_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->in.domain_handle); + } + _mem_save_domain_handle_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.domain_handle, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS, r->in.domain_handle)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domain_handle_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.rid)); + NDR_PULL_ALLOC(ndr, r->out.sid); + ZERO_STRUCTP(r->out.sid); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.sid); + } + _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.sid, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.sid)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r) +{ + ndr_print_struct(ndr, name, "samr_RidToSid"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_RidToSid"); + ndr->depth++; + ndr_print_ptr(ndr, "domain_handle", r->in.domain_handle); + ndr->depth++; + ndr_print_policy_handle(ndr, "domain_handle", r->in.domain_handle); + ndr->depth--; + ndr_print_uint32(ndr, "rid", r->in.rid); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_RidToSid"); + ndr->depth++; + ndr_print_ptr(ndr, "sid", r->out.sid); + ndr->depth++; + ndr_print_dom_sid2(ndr, "sid", r->out.sid); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_SetDsrmPassword(struct ndr_push *ndr, int flags, const struct samr_SetDsrmPassword *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.name)); + if (r->in.name) { + NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + } + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.unknown)); + NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.hash)); + if (r->in.hash) { + NDR_CHECK(ndr_push_samr_Password(ndr, NDR_SCALARS, r->in.hash)); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_SetDsrmPassword(struct ndr_pull *ndr, int flags, struct samr_SetDsrmPassword *r) +{ + uint32_t _ptr_name; + uint32_t _ptr_hash; + TALLOC_CTX *_mem_save_name_0; + TALLOC_CTX *_mem_save_hash_0; + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_name)); + if (_ptr_name) { + NDR_PULL_ALLOC(ndr, r->in.name); + } else { + r->in.name = NULL; + } + if (r->in.name) { + _mem_save_name_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.name, 0); + NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.name)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_name_0, 0); + } + NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.unknown)); + NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_hash)); + if (_ptr_hash) { + NDR_PULL_ALLOC(ndr, r->in.hash); + } else { + r->in.hash = NULL; + } + if (r->in.hash) { + _mem_save_hash_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->in.hash, 0); + NDR_CHECK(ndr_pull_samr_Password(ndr, NDR_SCALARS, r->in.hash)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_hash_0, 0); + } + } + if (flags & NDR_OUT) { + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r) +{ + ndr_print_struct(ndr, name, "samr_SetDsrmPassword"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_SetDsrmPassword"); + ndr->depth++; + ndr_print_ptr(ndr, "name", r->in.name); + ndr->depth++; + if (r->in.name) { + ndr_print_lsa_String(ndr, "name", r->in.name); + } + ndr->depth--; + ndr_print_uint32(ndr, "unknown", r->in.unknown); + ndr_print_ptr(ndr, "hash", r->in.hash); + ndr->depth++; + if (r->in.hash) { + ndr_print_samr_Password(ndr, "hash", r->in.hash); + } + ndr->depth--; + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_SetDsrmPassword"); + ndr->depth++; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_samr_ValidatePassword(struct ndr_push *ndr, int flags, const struct samr_ValidatePassword *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_samr_ValidatePasswordLevel(ndr, NDR_SCALARS, r->in.level)); + NDR_CHECK(ndr_push_set_switch_value(ndr, &r->in.req, r->in.level)); + NDR_CHECK(ndr_push_samr_ValidatePasswordReq(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.req)); + } + if (flags & NDR_OUT) { + if (r->out.rep == NULL) { + return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer"); + } + NDR_CHECK(ndr_push_set_switch_value(ndr, r->out.rep, r->in.level)); + NDR_CHECK(ndr_push_samr_ValidatePasswordRep(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rep)); + NDR_CHECK(ndr_push_NTSTATUS(ndr, NDR_SCALARS, r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_samr_ValidatePassword(struct ndr_pull *ndr, int flags, struct samr_ValidatePassword *r) +{ + TALLOC_CTX *_mem_save_rep_0; + if (flags & NDR_IN) { + ZERO_STRUCT(r->out); + + NDR_CHECK(ndr_pull_samr_ValidatePasswordLevel(ndr, NDR_SCALARS, &r->in.level)); + NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->in.req, r->in.level)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordReq(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.req)); + NDR_PULL_ALLOC(ndr, r->out.rep); + ZERO_STRUCTP(r->out.rep); + } + if (flags & NDR_OUT) { + if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) { + NDR_PULL_ALLOC(ndr, r->out.rep); + } + _mem_save_rep_0 = NDR_PULL_GET_MEM_CTX(ndr); + NDR_PULL_SET_MEM_CTX(ndr, r->out.rep, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_set_switch_value(ndr, r->out.rep, r->in.level)); + NDR_CHECK(ndr_pull_samr_ValidatePasswordRep(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.rep)); + NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rep_0, LIBNDR_FLAG_REF_ALLOC); + NDR_CHECK(ndr_pull_NTSTATUS(ndr, NDR_SCALARS, &r->out.result)); + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r) +{ + ndr_print_struct(ndr, name, "samr_ValidatePassword"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "samr_ValidatePassword"); + ndr->depth++; + ndr_print_samr_ValidatePasswordLevel(ndr, "level", r->in.level); + ndr_print_set_switch_value(ndr, &r->in.req, r->in.level); + ndr_print_samr_ValidatePasswordReq(ndr, "req", &r->in.req); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "samr_ValidatePassword"); + ndr->depth++; + ndr_print_ptr(ndr, "rep", r->out.rep); + ndr->depth++; + ndr_print_set_switch_value(ndr, r->out.rep, r->in.level); + ndr_print_samr_ValidatePasswordRep(ndr, "rep", r->out.rep); + ndr->depth--; + ndr_print_NTSTATUS(ndr, "result", r->out.result); + ndr->depth--; + } + ndr->depth--; +} + +static const struct ndr_interface_call samr_calls[] = { + { + "samr_Connect", + sizeof(struct samr_Connect), + (ndr_push_flags_fn_t) ndr_push_samr_Connect, + (ndr_pull_flags_fn_t) ndr_pull_samr_Connect, + (ndr_print_function_t) ndr_print_samr_Connect, + false, + }, + { + "samr_Close", + sizeof(struct samr_Close), + (ndr_push_flags_fn_t) ndr_push_samr_Close, + (ndr_pull_flags_fn_t) ndr_pull_samr_Close, + (ndr_print_function_t) ndr_print_samr_Close, + false, + }, + { + "samr_SetSecurity", + sizeof(struct samr_SetSecurity), + (ndr_push_flags_fn_t) ndr_push_samr_SetSecurity, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetSecurity, + (ndr_print_function_t) ndr_print_samr_SetSecurity, + false, + }, + { + "samr_QuerySecurity", + sizeof(struct samr_QuerySecurity), + (ndr_push_flags_fn_t) ndr_push_samr_QuerySecurity, + (ndr_pull_flags_fn_t) ndr_pull_samr_QuerySecurity, + (ndr_print_function_t) ndr_print_samr_QuerySecurity, + false, + }, + { + "samr_Shutdown", + sizeof(struct samr_Shutdown), + (ndr_push_flags_fn_t) ndr_push_samr_Shutdown, + (ndr_pull_flags_fn_t) ndr_pull_samr_Shutdown, + (ndr_print_function_t) ndr_print_samr_Shutdown, + false, + }, + { + "samr_LookupDomain", + sizeof(struct samr_LookupDomain), + (ndr_push_flags_fn_t) ndr_push_samr_LookupDomain, + (ndr_pull_flags_fn_t) ndr_pull_samr_LookupDomain, + (ndr_print_function_t) ndr_print_samr_LookupDomain, + false, + }, + { + "samr_EnumDomains", + sizeof(struct samr_EnumDomains), + (ndr_push_flags_fn_t) ndr_push_samr_EnumDomains, + (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomains, + (ndr_print_function_t) ndr_print_samr_EnumDomains, + false, + }, + { + "samr_OpenDomain", + sizeof(struct samr_OpenDomain), + (ndr_push_flags_fn_t) ndr_push_samr_OpenDomain, + (ndr_pull_flags_fn_t) ndr_pull_samr_OpenDomain, + (ndr_print_function_t) ndr_print_samr_OpenDomain, + false, + }, + { + "samr_QueryDomainInfo", + sizeof(struct samr_QueryDomainInfo), + (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo, + (ndr_print_function_t) ndr_print_samr_QueryDomainInfo, + false, + }, + { + "samr_SetDomainInfo", + sizeof(struct samr_SetDomainInfo), + (ndr_push_flags_fn_t) ndr_push_samr_SetDomainInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetDomainInfo, + (ndr_print_function_t) ndr_print_samr_SetDomainInfo, + false, + }, + { + "samr_CreateDomainGroup", + sizeof(struct samr_CreateDomainGroup), + (ndr_push_flags_fn_t) ndr_push_samr_CreateDomainGroup, + (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomainGroup, + (ndr_print_function_t) ndr_print_samr_CreateDomainGroup, + false, + }, + { + "samr_EnumDomainGroups", + sizeof(struct samr_EnumDomainGroups), + (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainGroups, + (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainGroups, + (ndr_print_function_t) ndr_print_samr_EnumDomainGroups, + false, + }, + { + "samr_CreateUser", + sizeof(struct samr_CreateUser), + (ndr_push_flags_fn_t) ndr_push_samr_CreateUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser, + (ndr_print_function_t) ndr_print_samr_CreateUser, + false, + }, + { + "samr_EnumDomainUsers", + sizeof(struct samr_EnumDomainUsers), + (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainUsers, + (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainUsers, + (ndr_print_function_t) ndr_print_samr_EnumDomainUsers, + false, + }, + { + "samr_CreateDomAlias", + sizeof(struct samr_CreateDomAlias), + (ndr_push_flags_fn_t) ndr_push_samr_CreateDomAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_CreateDomAlias, + (ndr_print_function_t) ndr_print_samr_CreateDomAlias, + false, + }, + { + "samr_EnumDomainAliases", + sizeof(struct samr_EnumDomainAliases), + (ndr_push_flags_fn_t) ndr_push_samr_EnumDomainAliases, + (ndr_pull_flags_fn_t) ndr_pull_samr_EnumDomainAliases, + (ndr_print_function_t) ndr_print_samr_EnumDomainAliases, + false, + }, + { + "samr_GetAliasMembership", + sizeof(struct samr_GetAliasMembership), + (ndr_push_flags_fn_t) ndr_push_samr_GetAliasMembership, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetAliasMembership, + (ndr_print_function_t) ndr_print_samr_GetAliasMembership, + false, + }, + { + "samr_LookupNames", + sizeof(struct samr_LookupNames), + (ndr_push_flags_fn_t) ndr_push_samr_LookupNames, + (ndr_pull_flags_fn_t) ndr_pull_samr_LookupNames, + (ndr_print_function_t) ndr_print_samr_LookupNames, + false, + }, + { + "samr_LookupRids", + sizeof(struct samr_LookupRids), + (ndr_push_flags_fn_t) ndr_push_samr_LookupRids, + (ndr_pull_flags_fn_t) ndr_pull_samr_LookupRids, + (ndr_print_function_t) ndr_print_samr_LookupRids, + false, + }, + { + "samr_OpenGroup", + sizeof(struct samr_OpenGroup), + (ndr_push_flags_fn_t) ndr_push_samr_OpenGroup, + (ndr_pull_flags_fn_t) ndr_pull_samr_OpenGroup, + (ndr_print_function_t) ndr_print_samr_OpenGroup, + false, + }, + { + "samr_QueryGroupInfo", + sizeof(struct samr_QueryGroupInfo), + (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupInfo, + (ndr_print_function_t) ndr_print_samr_QueryGroupInfo, + false, + }, + { + "samr_SetGroupInfo", + sizeof(struct samr_SetGroupInfo), + (ndr_push_flags_fn_t) ndr_push_samr_SetGroupInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetGroupInfo, + (ndr_print_function_t) ndr_print_samr_SetGroupInfo, + false, + }, + { + "samr_AddGroupMember", + sizeof(struct samr_AddGroupMember), + (ndr_push_flags_fn_t) ndr_push_samr_AddGroupMember, + (ndr_pull_flags_fn_t) ndr_pull_samr_AddGroupMember, + (ndr_print_function_t) ndr_print_samr_AddGroupMember, + false, + }, + { + "samr_DeleteDomainGroup", + sizeof(struct samr_DeleteDomainGroup), + (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomainGroup, + (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomainGroup, + (ndr_print_function_t) ndr_print_samr_DeleteDomainGroup, + false, + }, + { + "samr_DeleteGroupMember", + sizeof(struct samr_DeleteGroupMember), + (ndr_push_flags_fn_t) ndr_push_samr_DeleteGroupMember, + (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteGroupMember, + (ndr_print_function_t) ndr_print_samr_DeleteGroupMember, + false, + }, + { + "samr_QueryGroupMember", + sizeof(struct samr_QueryGroupMember), + (ndr_push_flags_fn_t) ndr_push_samr_QueryGroupMember, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryGroupMember, + (ndr_print_function_t) ndr_print_samr_QueryGroupMember, + false, + }, + { + "samr_SetMemberAttributesOfGroup", + sizeof(struct samr_SetMemberAttributesOfGroup), + (ndr_push_flags_fn_t) ndr_push_samr_SetMemberAttributesOfGroup, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetMemberAttributesOfGroup, + (ndr_print_function_t) ndr_print_samr_SetMemberAttributesOfGroup, + false, + }, + { + "samr_OpenAlias", + sizeof(struct samr_OpenAlias), + (ndr_push_flags_fn_t) ndr_push_samr_OpenAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_OpenAlias, + (ndr_print_function_t) ndr_print_samr_OpenAlias, + false, + }, + { + "samr_QueryAliasInfo", + sizeof(struct samr_QueryAliasInfo), + (ndr_push_flags_fn_t) ndr_push_samr_QueryAliasInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryAliasInfo, + (ndr_print_function_t) ndr_print_samr_QueryAliasInfo, + false, + }, + { + "samr_SetAliasInfo", + sizeof(struct samr_SetAliasInfo), + (ndr_push_flags_fn_t) ndr_push_samr_SetAliasInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetAliasInfo, + (ndr_print_function_t) ndr_print_samr_SetAliasInfo, + false, + }, + { + "samr_DeleteDomAlias", + sizeof(struct samr_DeleteDomAlias), + (ndr_push_flags_fn_t) ndr_push_samr_DeleteDomAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteDomAlias, + (ndr_print_function_t) ndr_print_samr_DeleteDomAlias, + false, + }, + { + "samr_AddAliasMember", + sizeof(struct samr_AddAliasMember), + (ndr_push_flags_fn_t) ndr_push_samr_AddAliasMember, + (ndr_pull_flags_fn_t) ndr_pull_samr_AddAliasMember, + (ndr_print_function_t) ndr_print_samr_AddAliasMember, + false, + }, + { + "samr_DeleteAliasMember", + sizeof(struct samr_DeleteAliasMember), + (ndr_push_flags_fn_t) ndr_push_samr_DeleteAliasMember, + (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteAliasMember, + (ndr_print_function_t) ndr_print_samr_DeleteAliasMember, + false, + }, + { + "samr_GetMembersInAlias", + sizeof(struct samr_GetMembersInAlias), + (ndr_push_flags_fn_t) ndr_push_samr_GetMembersInAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetMembersInAlias, + (ndr_print_function_t) ndr_print_samr_GetMembersInAlias, + false, + }, + { + "samr_OpenUser", + sizeof(struct samr_OpenUser), + (ndr_push_flags_fn_t) ndr_push_samr_OpenUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_OpenUser, + (ndr_print_function_t) ndr_print_samr_OpenUser, + false, + }, + { + "samr_DeleteUser", + sizeof(struct samr_DeleteUser), + (ndr_push_flags_fn_t) ndr_push_samr_DeleteUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_DeleteUser, + (ndr_print_function_t) ndr_print_samr_DeleteUser, + false, + }, + { + "samr_QueryUserInfo", + sizeof(struct samr_QueryUserInfo), + (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo, + (ndr_print_function_t) ndr_print_samr_QueryUserInfo, + false, + }, + { + "samr_SetUserInfo", + sizeof(struct samr_SetUserInfo), + (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo, + (ndr_print_function_t) ndr_print_samr_SetUserInfo, + false, + }, + { + "samr_ChangePasswordUser", + sizeof(struct samr_ChangePasswordUser), + (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser, + (ndr_print_function_t) ndr_print_samr_ChangePasswordUser, + false, + }, + { + "samr_GetGroupsForUser", + sizeof(struct samr_GetGroupsForUser), + (ndr_push_flags_fn_t) ndr_push_samr_GetGroupsForUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetGroupsForUser, + (ndr_print_function_t) ndr_print_samr_GetGroupsForUser, + false, + }, + { + "samr_QueryDisplayInfo", + sizeof(struct samr_QueryDisplayInfo), + (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo, + (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo, + false, + }, + { + "samr_GetDisplayEnumerationIndex", + sizeof(struct samr_GetDisplayEnumerationIndex), + (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex, + (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex, + false, + }, + { + "samr_TestPrivateFunctionsDomain", + sizeof(struct samr_TestPrivateFunctionsDomain), + (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsDomain, + (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsDomain, + (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsDomain, + false, + }, + { + "samr_TestPrivateFunctionsUser", + sizeof(struct samr_TestPrivateFunctionsUser), + (ndr_push_flags_fn_t) ndr_push_samr_TestPrivateFunctionsUser, + (ndr_pull_flags_fn_t) ndr_pull_samr_TestPrivateFunctionsUser, + (ndr_print_function_t) ndr_print_samr_TestPrivateFunctionsUser, + false, + }, + { + "samr_GetUserPwInfo", + sizeof(struct samr_GetUserPwInfo), + (ndr_push_flags_fn_t) ndr_push_samr_GetUserPwInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetUserPwInfo, + (ndr_print_function_t) ndr_print_samr_GetUserPwInfo, + false, + }, + { + "samr_RemoveMemberFromForeignDomain", + sizeof(struct samr_RemoveMemberFromForeignDomain), + (ndr_push_flags_fn_t) ndr_push_samr_RemoveMemberFromForeignDomain, + (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMemberFromForeignDomain, + (ndr_print_function_t) ndr_print_samr_RemoveMemberFromForeignDomain, + false, + }, + { + "samr_QueryDomainInfo2", + sizeof(struct samr_QueryDomainInfo2), + (ndr_push_flags_fn_t) ndr_push_samr_QueryDomainInfo2, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDomainInfo2, + (ndr_print_function_t) ndr_print_samr_QueryDomainInfo2, + false, + }, + { + "samr_QueryUserInfo2", + sizeof(struct samr_QueryUserInfo2), + (ndr_push_flags_fn_t) ndr_push_samr_QueryUserInfo2, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryUserInfo2, + (ndr_print_function_t) ndr_print_samr_QueryUserInfo2, + false, + }, + { + "samr_QueryDisplayInfo2", + sizeof(struct samr_QueryDisplayInfo2), + (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo2, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo2, + (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo2, + false, + }, + { + "samr_GetDisplayEnumerationIndex2", + sizeof(struct samr_GetDisplayEnumerationIndex2), + (ndr_push_flags_fn_t) ndr_push_samr_GetDisplayEnumerationIndex2, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetDisplayEnumerationIndex2, + (ndr_print_function_t) ndr_print_samr_GetDisplayEnumerationIndex2, + false, + }, + { + "samr_CreateUser2", + sizeof(struct samr_CreateUser2), + (ndr_push_flags_fn_t) ndr_push_samr_CreateUser2, + (ndr_pull_flags_fn_t) ndr_pull_samr_CreateUser2, + (ndr_print_function_t) ndr_print_samr_CreateUser2, + false, + }, + { + "samr_QueryDisplayInfo3", + sizeof(struct samr_QueryDisplayInfo3), + (ndr_push_flags_fn_t) ndr_push_samr_QueryDisplayInfo3, + (ndr_pull_flags_fn_t) ndr_pull_samr_QueryDisplayInfo3, + (ndr_print_function_t) ndr_print_samr_QueryDisplayInfo3, + false, + }, + { + "samr_AddMultipleMembersToAlias", + sizeof(struct samr_AddMultipleMembersToAlias), + (ndr_push_flags_fn_t) ndr_push_samr_AddMultipleMembersToAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_AddMultipleMembersToAlias, + (ndr_print_function_t) ndr_print_samr_AddMultipleMembersToAlias, + false, + }, + { + "samr_RemoveMultipleMembersFromAlias", + sizeof(struct samr_RemoveMultipleMembersFromAlias), + (ndr_push_flags_fn_t) ndr_push_samr_RemoveMultipleMembersFromAlias, + (ndr_pull_flags_fn_t) ndr_pull_samr_RemoveMultipleMembersFromAlias, + (ndr_print_function_t) ndr_print_samr_RemoveMultipleMembersFromAlias, + false, + }, + { + "samr_OemChangePasswordUser2", + sizeof(struct samr_OemChangePasswordUser2), + (ndr_push_flags_fn_t) ndr_push_samr_OemChangePasswordUser2, + (ndr_pull_flags_fn_t) ndr_pull_samr_OemChangePasswordUser2, + (ndr_print_function_t) ndr_print_samr_OemChangePasswordUser2, + false, + }, + { + "samr_ChangePasswordUser2", + sizeof(struct samr_ChangePasswordUser2), + (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser2, + (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser2, + (ndr_print_function_t) ndr_print_samr_ChangePasswordUser2, + false, + }, + { + "samr_GetDomPwInfo", + sizeof(struct samr_GetDomPwInfo), + (ndr_push_flags_fn_t) ndr_push_samr_GetDomPwInfo, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetDomPwInfo, + (ndr_print_function_t) ndr_print_samr_GetDomPwInfo, + false, + }, + { + "samr_Connect2", + sizeof(struct samr_Connect2), + (ndr_push_flags_fn_t) ndr_push_samr_Connect2, + (ndr_pull_flags_fn_t) ndr_pull_samr_Connect2, + (ndr_print_function_t) ndr_print_samr_Connect2, + false, + }, + { + "samr_SetUserInfo2", + sizeof(struct samr_SetUserInfo2), + (ndr_push_flags_fn_t) ndr_push_samr_SetUserInfo2, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetUserInfo2, + (ndr_print_function_t) ndr_print_samr_SetUserInfo2, + false, + }, + { + "samr_SetBootKeyInformation", + sizeof(struct samr_SetBootKeyInformation), + (ndr_push_flags_fn_t) ndr_push_samr_SetBootKeyInformation, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetBootKeyInformation, + (ndr_print_function_t) ndr_print_samr_SetBootKeyInformation, + false, + }, + { + "samr_GetBootKeyInformation", + sizeof(struct samr_GetBootKeyInformation), + (ndr_push_flags_fn_t) ndr_push_samr_GetBootKeyInformation, + (ndr_pull_flags_fn_t) ndr_pull_samr_GetBootKeyInformation, + (ndr_print_function_t) ndr_print_samr_GetBootKeyInformation, + false, + }, + { + "samr_Connect3", + sizeof(struct samr_Connect3), + (ndr_push_flags_fn_t) ndr_push_samr_Connect3, + (ndr_pull_flags_fn_t) ndr_pull_samr_Connect3, + (ndr_print_function_t) ndr_print_samr_Connect3, + false, + }, + { + "samr_Connect4", + sizeof(struct samr_Connect4), + (ndr_push_flags_fn_t) ndr_push_samr_Connect4, + (ndr_pull_flags_fn_t) ndr_pull_samr_Connect4, + (ndr_print_function_t) ndr_print_samr_Connect4, + false, + }, + { + "samr_ChangePasswordUser3", + sizeof(struct samr_ChangePasswordUser3), + (ndr_push_flags_fn_t) ndr_push_samr_ChangePasswordUser3, + (ndr_pull_flags_fn_t) ndr_pull_samr_ChangePasswordUser3, + (ndr_print_function_t) ndr_print_samr_ChangePasswordUser3, + false, + }, + { + "samr_Connect5", + sizeof(struct samr_Connect5), + (ndr_push_flags_fn_t) ndr_push_samr_Connect5, + (ndr_pull_flags_fn_t) ndr_pull_samr_Connect5, + (ndr_print_function_t) ndr_print_samr_Connect5, + false, + }, + { + "samr_RidToSid", + sizeof(struct samr_RidToSid), + (ndr_push_flags_fn_t) ndr_push_samr_RidToSid, + (ndr_pull_flags_fn_t) ndr_pull_samr_RidToSid, + (ndr_print_function_t) ndr_print_samr_RidToSid, + false, + }, + { + "samr_SetDsrmPassword", + sizeof(struct samr_SetDsrmPassword), + (ndr_push_flags_fn_t) ndr_push_samr_SetDsrmPassword, + (ndr_pull_flags_fn_t) ndr_pull_samr_SetDsrmPassword, + (ndr_print_function_t) ndr_print_samr_SetDsrmPassword, + false, + }, + { + "samr_ValidatePassword", + sizeof(struct samr_ValidatePassword), + (ndr_push_flags_fn_t) ndr_push_samr_ValidatePassword, + (ndr_pull_flags_fn_t) ndr_pull_samr_ValidatePassword, + (ndr_print_function_t) ndr_print_samr_ValidatePassword, + false, + }, + { NULL, 0, NULL, NULL, NULL, false } +}; + +static const char * const samr_endpoint_strings[] = { + "ncacn_np:[\\pipe\\samr]", + "ncacn_ip_tcp:", + "ncalrpc:", +}; + +static const struct ndr_interface_string_array samr_endpoints = { + .count = 3, + .names = samr_endpoint_strings +}; + +static const char * const samr_authservice_strings[] = { + "host", +}; + +static const struct ndr_interface_string_array samr_authservices = { + .count = 3, + .names = samr_authservice_strings +}; + + +const struct ndr_interface_table ndr_table_samr = { + .name = "samr", + .syntax_id = { + {0x12345778,0x1234,0xabcd,{0xef,0x00},{0x01,0x23,0x45,0x67,0x89,0xac}}, + NDR_SAMR_VERSION + }, + .helpstring = NDR_SAMR_HELPSTRING, + .num_calls = 68, + .calls = samr_calls, + .endpoints = &samr_endpoints, + .authservices = &samr_authservices +}; + diff --git a/source3/librpc/gen_ndr/ndr_samr.h b/source3/librpc/gen_ndr/ndr_samr.h new file mode 100644 index 0000000000..96fd59b507 --- /dev/null +++ b/source3/librpc/gen_ndr/ndr_samr.h @@ -0,0 +1,340 @@ +/* header auto-generated by pidl */ + +#include "librpc/ndr/libndr.h" +#include "librpc/gen_ndr/samr.h" + +#ifndef _HEADER_NDR_samr +#define _HEADER_NDR_samr + +#define NDR_SAMR_UUID "12345778-1234-abcd-ef00-0123456789ac" +#define NDR_SAMR_VERSION 1.0 +#define NDR_SAMR_NAME "samr" +#define NDR_SAMR_HELPSTRING NULL +extern const struct ndr_interface_table ndr_table_samr; +#define NDR_SAMR_CONNECT (0x00) + +#define NDR_SAMR_CLOSE (0x01) + +#define NDR_SAMR_SETSECURITY (0x02) + +#define NDR_SAMR_QUERYSECURITY (0x03) + +#define NDR_SAMR_SHUTDOWN (0x04) + +#define NDR_SAMR_LOOKUPDOMAIN (0x05) + +#define NDR_SAMR_ENUMDOMAINS (0x06) + +#define NDR_SAMR_OPENDOMAIN (0x07) + +#define NDR_SAMR_QUERYDOMAININFO (0x08) + +#define NDR_SAMR_SETDOMAININFO (0x09) + +#define NDR_SAMR_CREATEDOMAINGROUP (0x0a) + +#define NDR_SAMR_ENUMDOMAINGROUPS (0x0b) + +#define NDR_SAMR_CREATEUSER (0x0c) + +#define NDR_SAMR_ENUMDOMAINUSERS (0x0d) + +#define NDR_SAMR_CREATEDOMALIAS (0x0e) + +#define NDR_SAMR_ENUMDOMAINALIASES (0x0f) + +#define NDR_SAMR_GETALIASMEMBERSHIP (0x10) + +#define NDR_SAMR_LOOKUPNAMES (0x11) + +#define NDR_SAMR_LOOKUPRIDS (0x12) + +#define NDR_SAMR_OPENGROUP (0x13) + +#define NDR_SAMR_QUERYGROUPINFO (0x14) + +#define NDR_SAMR_SETGROUPINFO (0x15) + +#define NDR_SAMR_ADDGROUPMEMBER (0x16) + +#define NDR_SAMR_DELETEDOMAINGROUP (0x17) + +#define NDR_SAMR_DELETEGROUPMEMBER (0x18) + +#define NDR_SAMR_QUERYGROUPMEMBER (0x19) + +#define NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP (0x1a) + +#define NDR_SAMR_OPENALIAS (0x1b) + +#define NDR_SAMR_QUERYALIASINFO (0x1c) + +#define NDR_SAMR_SETALIASINFO (0x1d) + +#define NDR_SAMR_DELETEDOMALIAS (0x1e) + +#define NDR_SAMR_ADDALIASMEMBER (0x1f) + +#define NDR_SAMR_DELETEALIASMEMBER (0x20) + +#define NDR_SAMR_GETMEMBERSINALIAS (0x21) + +#define NDR_SAMR_OPENUSER (0x22) + +#define NDR_SAMR_DELETEUSER (0x23) + +#define NDR_SAMR_QUERYUSERINFO (0x24) + +#define NDR_SAMR_SETUSERINFO (0x25) + +#define NDR_SAMR_CHANGEPASSWORDUSER (0x26) + +#define NDR_SAMR_GETGROUPSFORUSER (0x27) + +#define NDR_SAMR_QUERYDISPLAYINFO (0x28) + +#define NDR_SAMR_GETDISPLAYENUMERATIONINDEX (0x29) + +#define NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN (0x2a) + +#define NDR_SAMR_TESTPRIVATEFUNCTIONSUSER (0x2b) + +#define NDR_SAMR_GETUSERPWINFO (0x2c) + +#define NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN (0x2d) + +#define NDR_SAMR_QUERYDOMAININFO2 (0x2e) + +#define NDR_SAMR_QUERYUSERINFO2 (0x2f) + +#define NDR_SAMR_QUERYDISPLAYINFO2 (0x30) + +#define NDR_SAMR_GETDISPLAYENUMERATIONINDEX2 (0x31) + +#define NDR_SAMR_CREATEUSER2 (0x32) + +#define NDR_SAMR_QUERYDISPLAYINFO3 (0x33) + +#define NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS (0x34) + +#define NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS (0x35) + +#define NDR_SAMR_OEMCHANGEPASSWORDUSER2 (0x36) + +#define NDR_SAMR_CHANGEPASSWORDUSER2 (0x37) + +#define NDR_SAMR_GETDOMPWINFO (0x38) + +#define NDR_SAMR_CONNECT2 (0x39) + +#define NDR_SAMR_SETUSERINFO2 (0x3a) + +#define NDR_SAMR_SETBOOTKEYINFORMATION (0x3b) + +#define NDR_SAMR_GETBOOTKEYINFORMATION (0x3c) + +#define NDR_SAMR_CONNECT3 (0x3d) + +#define NDR_SAMR_CONNECT4 (0x3e) + +#define NDR_SAMR_CHANGEPASSWORDUSER3 (0x3f) + +#define NDR_SAMR_CONNECT5 (0x40) + +#define NDR_SAMR_RIDTOSID (0x41) + +#define NDR_SAMR_SETDSRMPASSWORD (0x42) + +#define NDR_SAMR_VALIDATEPASSWORD (0x43) + +#define NDR_SAMR_CALL_COUNT (68) +enum ndr_err_code ndr_push_samr_AcctFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r); +enum ndr_err_code ndr_pull_samr_AcctFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +void ndr_print_samr_AcctFlags(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_ConnectAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_UserAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_DomainAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_GroupAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_AliasAccessMask(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_SamEntry(struct ndr_print *ndr, const char *name, const struct samr_SamEntry *r); +void ndr_print_samr_SamArray(struct ndr_print *ndr, const char *name, const struct samr_SamArray *r); +void ndr_print_samr_Role(struct ndr_print *ndr, const char *name, enum samr_Role r); +enum ndr_err_code ndr_push_samr_PasswordProperties(struct ndr_push *ndr, int ndr_flags, uint32_t r); +enum ndr_err_code ndr_pull_samr_PasswordProperties(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +void ndr_print_samr_PasswordProperties(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_DomInfo1(struct ndr_print *ndr, const char *name, const struct samr_DomInfo1 *r); +void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, const struct samr_DomInfo2 *r); +void ndr_print_samr_DomInfo3(struct ndr_print *ndr, const char *name, const struct samr_DomInfo3 *r); +void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, const struct samr_DomInfo4 *r); +void ndr_print_samr_DomInfo5(struct ndr_print *ndr, const char *name, const struct samr_DomInfo5 *r); +void ndr_print_samr_DomInfo6(struct ndr_print *ndr, const char *name, const struct samr_DomInfo6 *r); +void ndr_print_samr_DomInfo7(struct ndr_print *ndr, const char *name, const struct samr_DomInfo7 *r); +void ndr_print_samr_DomInfo8(struct ndr_print *ndr, const char *name, const struct samr_DomInfo8 *r); +void ndr_print_samr_DomInfo9(struct ndr_print *ndr, const char *name, const struct samr_DomInfo9 *r); +void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, const struct samr_DomInfo11 *r); +void ndr_print_samr_DomInfo12(struct ndr_print *ndr, const char *name, const struct samr_DomInfo12 *r); +void ndr_print_samr_DomInfo13(struct ndr_print *ndr, const char *name, const struct samr_DomInfo13 *r); +void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, const union samr_DomainInfo *r); +void ndr_print_samr_Ids(struct ndr_print *ndr, const char *name, const struct samr_Ids *r); +enum ndr_err_code ndr_push_samr_GroupAttrs(struct ndr_push *ndr, int ndr_flags, uint32_t r); +enum ndr_err_code ndr_pull_samr_GroupAttrs(struct ndr_pull *ndr, int ndr_flags, uint32_t *r); +void ndr_print_samr_GroupAttrs(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAll *r); +void ndr_print_samr_GroupInfoAttributes(struct ndr_print *ndr, const char *name, const struct samr_GroupInfoAttributes *r); +void ndr_print_samr_GroupInfoEnum(struct ndr_print *ndr, const char *name, enum samr_GroupInfoEnum r); +void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, const union samr_GroupInfo *r); +void ndr_print_samr_RidTypeArray(struct ndr_print *ndr, const char *name, const struct samr_RidTypeArray *r); +void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, const struct samr_AliasInfoAll *r); +void ndr_print_samr_AliasInfoEnum(struct ndr_print *ndr, const char *name, enum samr_AliasInfoEnum r); +void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, const union samr_AliasInfo *r); +void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, const struct samr_UserInfo1 *r); +void ndr_print_samr_UserInfo2(struct ndr_print *ndr, const char *name, const struct samr_UserInfo2 *r); +enum ndr_err_code ndr_push_samr_LogonHours(struct ndr_push *ndr, int ndr_flags, const struct samr_LogonHours *r); +enum ndr_err_code ndr_pull_samr_LogonHours(struct ndr_pull *ndr, int ndr_flags, struct samr_LogonHours *r); +void ndr_print_samr_LogonHours(struct ndr_print *ndr, const char *name, const struct samr_LogonHours *r); +void ndr_print_samr_UserInfo3(struct ndr_print *ndr, const char *name, const struct samr_UserInfo3 *r); +void ndr_print_samr_UserInfo4(struct ndr_print *ndr, const char *name, const struct samr_UserInfo4 *r); +void ndr_print_samr_UserInfo5(struct ndr_print *ndr, const char *name, const struct samr_UserInfo5 *r); +void ndr_print_samr_UserInfo6(struct ndr_print *ndr, const char *name, const struct samr_UserInfo6 *r); +void ndr_print_samr_UserInfo7(struct ndr_print *ndr, const char *name, const struct samr_UserInfo7 *r); +void ndr_print_samr_UserInfo8(struct ndr_print *ndr, const char *name, const struct samr_UserInfo8 *r); +void ndr_print_samr_UserInfo9(struct ndr_print *ndr, const char *name, const struct samr_UserInfo9 *r); +void ndr_print_samr_UserInfo10(struct ndr_print *ndr, const char *name, const struct samr_UserInfo10 *r); +void ndr_print_samr_UserInfo11(struct ndr_print *ndr, const char *name, const struct samr_UserInfo11 *r); +void ndr_print_samr_UserInfo12(struct ndr_print *ndr, const char *name, const struct samr_UserInfo12 *r); +void ndr_print_samr_UserInfo13(struct ndr_print *ndr, const char *name, const struct samr_UserInfo13 *r); +void ndr_print_samr_UserInfo14(struct ndr_print *ndr, const char *name, const struct samr_UserInfo14 *r); +void ndr_print_samr_UserInfo16(struct ndr_print *ndr, const char *name, const struct samr_UserInfo16 *r); +void ndr_print_samr_UserInfo17(struct ndr_print *ndr, const char *name, const struct samr_UserInfo17 *r); +void ndr_print_samr_UserInfo20(struct ndr_print *ndr, const char *name, const struct samr_UserInfo20 *r); +void ndr_print_samr_FieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_UserInfo21(struct ndr_print *ndr, const char *name, const struct samr_UserInfo21 *r); +enum ndr_err_code ndr_push_samr_CryptPassword(struct ndr_push *ndr, int ndr_flags, const struct samr_CryptPassword *r); +enum ndr_err_code ndr_pull_samr_CryptPassword(struct ndr_pull *ndr, int ndr_flags, struct samr_CryptPassword *r); +void ndr_print_samr_CryptPassword(struct ndr_print *ndr, const char *name, const struct samr_CryptPassword *r); +void ndr_print_samr_UserInfo23(struct ndr_print *ndr, const char *name, const struct samr_UserInfo23 *r); +void ndr_print_samr_UserInfo24(struct ndr_print *ndr, const char *name, const struct samr_UserInfo24 *r); +void ndr_print_samr_CryptPasswordEx(struct ndr_print *ndr, const char *name, const struct samr_CryptPasswordEx *r); +void ndr_print_samr_UserInfo25(struct ndr_print *ndr, const char *name, const struct samr_UserInfo25 *r); +void ndr_print_samr_UserInfo26(struct ndr_print *ndr, const char *name, const struct samr_UserInfo26 *r); +void ndr_print_samr_UserInfo(struct ndr_print *ndr, const char *name, const union samr_UserInfo *r); +enum ndr_err_code ndr_push_samr_Password(struct ndr_push *ndr, int ndr_flags, const struct samr_Password *r); +enum ndr_err_code ndr_pull_samr_Password(struct ndr_pull *ndr, int ndr_flags, struct samr_Password *r); +void ndr_print_samr_Password(struct ndr_print *ndr, const char *name, const struct samr_Password *r); +enum ndr_err_code ndr_push_samr_RidWithAttribute(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttribute *r); +enum ndr_err_code ndr_pull_samr_RidWithAttribute(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttribute *r); +void ndr_print_samr_RidWithAttribute(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttribute *r); +enum ndr_err_code ndr_push_samr_RidWithAttributeArray(struct ndr_push *ndr, int ndr_flags, const struct samr_RidWithAttributeArray *r); +enum ndr_err_code ndr_pull_samr_RidWithAttributeArray(struct ndr_pull *ndr, int ndr_flags, struct samr_RidWithAttributeArray *r); +void ndr_print_samr_RidWithAttributeArray(struct ndr_print *ndr, const char *name, const struct samr_RidWithAttributeArray *r); +void ndr_print_samr_DispEntryGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispEntryGeneral *r); +void ndr_print_samr_DispInfoGeneral(struct ndr_print *ndr, const char *name, const struct samr_DispInfoGeneral *r); +void ndr_print_samr_DispEntryFull(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFull *r); +void ndr_print_samr_DispInfoFull(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFull *r); +void ndr_print_samr_DispEntryFullGroup(struct ndr_print *ndr, const char *name, const struct samr_DispEntryFullGroup *r); +void ndr_print_samr_DispInfoFullGroups(struct ndr_print *ndr, const char *name, const struct samr_DispInfoFullGroups *r); +void ndr_print_samr_DispEntryAscii(struct ndr_print *ndr, const char *name, const struct samr_DispEntryAscii *r); +void ndr_print_samr_DispInfoAscii(struct ndr_print *ndr, const char *name, const struct samr_DispInfoAscii *r); +void ndr_print_samr_DispInfo(struct ndr_print *ndr, const char *name, const union samr_DispInfo *r); +void ndr_print_samr_PwInfo(struct ndr_print *ndr, const char *name, const struct samr_PwInfo *r); +void ndr_print_samr_ChangeReject(struct ndr_print *ndr, const char *name, const struct samr_ChangeReject *r); +void ndr_print_samr_ConnectInfo1(struct ndr_print *ndr, const char *name, const struct samr_ConnectInfo1 *r); +void ndr_print_samr_ConnectInfo(struct ndr_print *ndr, const char *name, const union samr_ConnectInfo *r); +void ndr_print_samr_ValidateFieldsPresent(struct ndr_print *ndr, const char *name, uint32_t r); +void ndr_print_samr_ValidatePasswordLevel(struct ndr_print *ndr, const char *name, enum samr_ValidatePasswordLevel r); +void ndr_print_samr_ValidationStatus(struct ndr_print *ndr, const char *name, enum samr_ValidationStatus r); +void ndr_print_samr_ValidationBlob(struct ndr_print *ndr, const char *name, const struct samr_ValidationBlob *r); +void ndr_print_samr_ValidatePasswordInfo(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordInfo *r); +void ndr_print_samr_ValidatePasswordRepCtr(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordRepCtr *r); +void ndr_print_samr_ValidatePasswordRep(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordRep *r); +void ndr_print_samr_ValidatePasswordReq3(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq3 *r); +void ndr_print_samr_ValidatePasswordReq2(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq2 *r); +void ndr_print_samr_ValidatePasswordReq1(struct ndr_print *ndr, const char *name, const struct samr_ValidatePasswordReq1 *r); +void ndr_print_samr_ValidatePasswordReq(struct ndr_print *ndr, const char *name, const union samr_ValidatePasswordReq *r); +void ndr_print_samr_Connect(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect *r); +enum ndr_err_code ndr_push_samr_Close(struct ndr_push *ndr, int flags, const struct samr_Close *r); +enum ndr_err_code ndr_pull_samr_Close(struct ndr_pull *ndr, int flags, struct samr_Close *r); +void ndr_print_samr_Close(struct ndr_print *ndr, const char *name, int flags, const struct samr_Close *r); +void ndr_print_samr_SetSecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetSecurity *r); +void ndr_print_samr_QuerySecurity(struct ndr_print *ndr, const char *name, int flags, const struct samr_QuerySecurity *r); +void ndr_print_samr_Shutdown(struct ndr_print *ndr, const char *name, int flags, const struct samr_Shutdown *r); +void ndr_print_samr_LookupDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupDomain *r); +void ndr_print_samr_EnumDomains(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomains *r); +enum ndr_err_code ndr_push_samr_OpenDomain(struct ndr_push *ndr, int flags, const struct samr_OpenDomain *r); +enum ndr_err_code ndr_pull_samr_OpenDomain(struct ndr_pull *ndr, int flags, struct samr_OpenDomain *r); +void ndr_print_samr_OpenDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenDomain *r); +void ndr_print_samr_QueryDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo *r); +void ndr_print_samr_SetDomainInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDomainInfo *r); +void ndr_print_samr_CreateDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomainGroup *r); +void ndr_print_samr_EnumDomainGroups(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainGroups *r); +void ndr_print_samr_CreateUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser *r); +void ndr_print_samr_EnumDomainUsers(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainUsers *r); +void ndr_print_samr_CreateDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateDomAlias *r); +void ndr_print_samr_EnumDomainAliases(struct ndr_print *ndr, const char *name, int flags, const struct samr_EnumDomainAliases *r); +void ndr_print_samr_GetAliasMembership(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetAliasMembership *r); +enum ndr_err_code ndr_push_samr_LookupNames(struct ndr_push *ndr, int flags, const struct samr_LookupNames *r); +enum ndr_err_code ndr_pull_samr_LookupNames(struct ndr_pull *ndr, int flags, struct samr_LookupNames *r); +void ndr_print_samr_LookupNames(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupNames *r); +void ndr_print_samr_LookupRids(struct ndr_print *ndr, const char *name, int flags, const struct samr_LookupRids *r); +void ndr_print_samr_OpenGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenGroup *r); +void ndr_print_samr_QueryGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupInfo *r); +void ndr_print_samr_SetGroupInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetGroupInfo *r); +void ndr_print_samr_AddGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddGroupMember *r); +void ndr_print_samr_DeleteDomainGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomainGroup *r); +void ndr_print_samr_DeleteGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteGroupMember *r); +void ndr_print_samr_QueryGroupMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryGroupMember *r); +void ndr_print_samr_SetMemberAttributesOfGroup(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetMemberAttributesOfGroup *r); +void ndr_print_samr_OpenAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenAlias *r); +void ndr_print_samr_QueryAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryAliasInfo *r); +void ndr_print_samr_SetAliasInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetAliasInfo *r); +void ndr_print_samr_DeleteDomAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteDomAlias *r); +void ndr_print_samr_AddAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddAliasMember *r); +void ndr_print_samr_DeleteAliasMember(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteAliasMember *r); +void ndr_print_samr_GetMembersInAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetMembersInAlias *r); +enum ndr_err_code ndr_push_samr_OpenUser(struct ndr_push *ndr, int flags, const struct samr_OpenUser *r); +enum ndr_err_code ndr_pull_samr_OpenUser(struct ndr_pull *ndr, int flags, struct samr_OpenUser *r); +void ndr_print_samr_OpenUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_OpenUser *r); +void ndr_print_samr_DeleteUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_DeleteUser *r); +enum ndr_err_code ndr_push_samr_QueryUserInfo(struct ndr_push *ndr, int flags, const struct samr_QueryUserInfo *r); +enum ndr_err_code ndr_pull_samr_QueryUserInfo(struct ndr_pull *ndr, int flags, struct samr_QueryUserInfo *r); +void ndr_print_samr_QueryUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo *r); +enum ndr_err_code ndr_push_samr_SetUserInfo(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo *r); +enum ndr_err_code ndr_pull_samr_SetUserInfo(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo *r); +void ndr_print_samr_SetUserInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo *r); +void ndr_print_samr_ChangePasswordUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser *r); +void ndr_print_samr_GetGroupsForUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetGroupsForUser *r); +void ndr_print_samr_QueryDisplayInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo *r); +void ndr_print_samr_GetDisplayEnumerationIndex(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex *r); +void ndr_print_samr_TestPrivateFunctionsDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsDomain *r); +void ndr_print_samr_TestPrivateFunctionsUser(struct ndr_print *ndr, const char *name, int flags, const struct samr_TestPrivateFunctionsUser *r); +enum ndr_err_code ndr_push_samr_GetUserPwInfo(struct ndr_push *ndr, int flags, const struct samr_GetUserPwInfo *r); +enum ndr_err_code ndr_pull_samr_GetUserPwInfo(struct ndr_pull *ndr, int flags, struct samr_GetUserPwInfo *r); +void ndr_print_samr_GetUserPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetUserPwInfo *r); +void ndr_print_samr_RemoveMemberFromForeignDomain(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMemberFromForeignDomain *r); +void ndr_print_samr_QueryDomainInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDomainInfo2 *r); +void ndr_print_samr_QueryUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryUserInfo2 *r); +void ndr_print_samr_QueryDisplayInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo2 *r); +void ndr_print_samr_GetDisplayEnumerationIndex2(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDisplayEnumerationIndex2 *r); +void ndr_print_samr_CreateUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_CreateUser2 *r); +void ndr_print_samr_QueryDisplayInfo3(struct ndr_print *ndr, const char *name, int flags, const struct samr_QueryDisplayInfo3 *r); +void ndr_print_samr_AddMultipleMembersToAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_AddMultipleMembersToAlias *r); +void ndr_print_samr_RemoveMultipleMembersFromAlias(struct ndr_print *ndr, const char *name, int flags, const struct samr_RemoveMultipleMembersFromAlias *r); +void ndr_print_samr_OemChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_OemChangePasswordUser2 *r); +void ndr_print_samr_ChangePasswordUser2(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser2 *r); +void ndr_print_samr_GetDomPwInfo(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetDomPwInfo *r); +void ndr_print_samr_Connect2(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect2 *r); +enum ndr_err_code ndr_push_samr_SetUserInfo2(struct ndr_push *ndr, int flags, const struct samr_SetUserInfo2 *r); +enum ndr_err_code ndr_pull_samr_SetUserInfo2(struct ndr_pull *ndr, int flags, struct samr_SetUserInfo2 *r); +void ndr_print_samr_SetUserInfo2(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetUserInfo2 *r); +void ndr_print_samr_SetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetBootKeyInformation *r); +void ndr_print_samr_GetBootKeyInformation(struct ndr_print *ndr, const char *name, int flags, const struct samr_GetBootKeyInformation *r); +void ndr_print_samr_Connect3(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect3 *r); +void ndr_print_samr_Connect4(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect4 *r); +void ndr_print_samr_ChangePasswordUser3(struct ndr_print *ndr, const char *name, int flags, const struct samr_ChangePasswordUser3 *r); +enum ndr_err_code ndr_push_samr_Connect5(struct ndr_push *ndr, int flags, const struct samr_Connect5 *r); +enum ndr_err_code ndr_pull_samr_Connect5(struct ndr_pull *ndr, int flags, struct samr_Connect5 *r); +void ndr_print_samr_Connect5(struct ndr_print *ndr, const char *name, int flags, const struct samr_Connect5 *r); +void ndr_print_samr_RidToSid(struct ndr_print *ndr, const char *name, int flags, const struct samr_RidToSid *r); +void ndr_print_samr_SetDsrmPassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_SetDsrmPassword *r); +void ndr_print_samr_ValidatePassword(struct ndr_print *ndr, const char *name, int flags, const struct samr_ValidatePassword *r); +#endif /* _HEADER_NDR_samr */ diff --git a/source3/librpc/gen_ndr/samr.h b/source3/librpc/gen_ndr/samr.h new file mode 100644 index 0000000000..a512a64380 --- /dev/null +++ b/source3/librpc/gen_ndr/samr.h @@ -0,0 +1,1754 @@ +/* header auto-generated by pidl */ + +#include + +#include "librpc/gen_ndr/misc.h" +#include "librpc/gen_ndr/lsa.h" +#include "librpc/gen_ndr/security.h" +#ifndef _HEADER_samr +#define _HEADER_samr + +#define SAMR_ENUM_USERS_MULTIPLIER ( 54 ) +; + +/* bitmap samr_AcctFlags */ +#define ACB_DISABLED ( 0x00000001 ) +#define ACB_HOMDIRREQ ( 0x00000002 ) +#define ACB_PWNOTREQ ( 0x00000004 ) +#define ACB_TEMPDUP ( 0x00000008 ) +#define ACB_NORMAL ( 0x00000010 ) +#define ACB_MNS ( 0x00000020 ) +#define ACB_DOMTRUST ( 0x00000040 ) +#define ACB_WSTRUST ( 0x00000080 ) +#define ACB_SVRTRUST ( 0x00000100 ) +#define ACB_PWNOEXP ( 0x00000200 ) +#define ACB_AUTOLOCK ( 0x00000400 ) +#define ACB_ENC_TXT_PWD_ALLOWED ( 0x00000800 ) +#define ACB_SMARTCARD_REQUIRED ( 0x00001000 ) +#define ACB_TRUSTED_FOR_DELEGATION ( 0x00002000 ) +#define ACB_NOT_DELEGATED ( 0x00004000 ) +#define ACB_USE_DES_KEY_ONLY ( 0x00008000 ) +#define ACB_DONT_REQUIRE_PREAUTH ( 0x00010000 ) +#define ACB_PW_EXPIRED ( 0x00020000 ) +#define ACB_NO_AUTH_DATA_REQD ( 0x00080000 ) + +; + +/* bitmap samr_ConnectAccessMask */ +#define SAMR_ACCESS_CONNECT_TO_SERVER ( 0x00000001 ) +#define SAMR_ACCESS_SHUTDOWN_SERVER ( 0x00000002 ) +#define SAMR_ACCESS_INITIALIZE_SERVER ( 0x00000004 ) +#define SAMR_ACCESS_CREATE_DOMAIN ( 0x00000008 ) +#define SAMR_ACCESS_ENUM_DOMAINS ( 0x00000010 ) +#define SAMR_ACCESS_OPEN_DOMAIN ( 0x00000020 ) + +; + +/* bitmap samr_UserAccessMask */ +#define USER_ACCESS_GET_NAME_ETC ( 0x00000001 ) +#define USER_ACCESS_GET_LOCALE ( 0x00000002 ) +#define USER_ACCESS_SET_LOC_COM ( 0x00000004 ) +#define USER_ACCESS_GET_LOGONINFO ( 0x00000008 ) +#define USER_ACCESS_GET_ATTRIBUTES ( 0x00000010 ) +#define USER_ACCESS_SET_ATTRIBUTES ( 0x00000020 ) +#define USER_ACCESS_CHANGE_PASSWORD ( 0x00000040 ) +#define USER_ACCESS_SET_PASSWORD ( 0x00000080 ) +#define USER_ACCESS_GET_GROUPS ( 0x00000100 ) +#define USER_ACCESS_GET_GROUP_MEMBERSHIP ( 0x00000200 ) +#define USER_ACCESS_CHANGE_GROUP_MEMBERSHIP ( 0x00000400 ) + +; + +/* bitmap samr_DomainAccessMask */ +#define DOMAIN_ACCESS_LOOKUP_INFO_1 ( 0x00000001 ) +#define DOMAIN_ACCESS_SET_INFO_1 ( 0x00000002 ) +#define DOMAIN_ACCESS_LOOKUP_INFO_2 ( 0x00000004 ) +#define DOMAIN_ACCESS_SET_INFO_2 ( 0x00000008 ) +#define DOMAIN_ACCESS_CREATE_USER ( 0x00000010 ) +#define DOMAIN_ACCESS_CREATE_GROUP ( 0x00000020 ) +#define DOMAIN_ACCESS_CREATE_ALIAS ( 0x00000040 ) +#define DOMAIN_ACCESS_LOOKUP_ALIAS ( 0x00000080 ) +#define DOMAIN_ACCESS_ENUM_ACCOUNTS ( 0x00000100 ) +#define DOMAIN_ACCESS_OPEN_ACCOUNT ( 0x00000200 ) +#define DOMAIN_ACCESS_SET_INFO_3 ( 0x00000400 ) + +; + +/* bitmap samr_GroupAccessMask */ +#define GROUP_ACCESS_LOOKUP_INFO ( 0x00000001 ) +#define GROUP_ACCESS_SET_INFO ( 0x00000002 ) +#define GROUP_ACCESS_ADD_MEMBER ( 0x00000004 ) +#define GROUP_ACCESS_REMOVE_MEMBER ( 0x00000008 ) +#define GROUP_ACCESS_GET_MEMBERS ( 0x00000010 ) + +; + +/* bitmap samr_AliasAccessMask */ +#define ALIAS_ACCESS_ADD_MEMBER ( 0x00000001 ) +#define ALIAS_ACCESS_REMOVE_MEMBER ( 0x00000002 ) +#define ALIAS_ACCESS_GET_MEMBERS ( 0x00000004 ) +#define ALIAS_ACCESS_LOOKUP_INFO ( 0x00000008 ) +#define ALIAS_ACCESS_SET_INFO ( 0x00000010 ) + +; + +struct samr_SamEntry { + uint32_t idx; + struct lsa_String name; +}; + +struct samr_SamArray { + uint32_t count; + struct samr_SamEntry *entries;/* [unique,size_is(count)] */ +}; + +enum samr_Role +#ifndef USE_UINT_ENUMS + { + SAMR_ROLE_STANDALONE=0, + SAMR_ROLE_DOMAIN_MEMBER=1, + SAMR_ROLE_DOMAIN_BDC=2, + SAMR_ROLE_DOMAIN_PDC=3 +} +#else + { __donnot_use_enum_samr_Role=0x7FFFFFFF} +#define SAMR_ROLE_STANDALONE ( 0 ) +#define SAMR_ROLE_DOMAIN_MEMBER ( 1 ) +#define SAMR_ROLE_DOMAIN_BDC ( 2 ) +#define SAMR_ROLE_DOMAIN_PDC ( 3 ) +#endif +; + +/* bitmap samr_PasswordProperties */ +#define DOMAIN_PASSWORD_COMPLEX ( 0x00000001 ) +#define DOMAIN_PASSWORD_NO_ANON_CHANGE ( 0x00000002 ) +#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE ( 0x00000004 ) +#define DOMAIN_PASSWORD_LOCKOUT_ADMINS ( 0x00000008 ) +#define DOMAIN_PASSWORD_STORE_CLEARTEXT ( 0x00000010 ) +#define DOMAIN_REFUSE_PASSWORD_CHANGE ( 0x00000020 ) + +; + +struct samr_DomInfo1 { + uint16_t min_password_length; + uint16_t password_history_length; + uint32_t password_properties; + int64_t max_password_age; + int64_t min_password_age; +}; + +struct samr_DomInfo2 { + NTTIME force_logoff_time; + struct lsa_String comment; + struct lsa_String domain_name; + struct lsa_String primary; + uint64_t sequence_num; + uint32_t unknown2; + enum samr_Role role; + uint32_t unknown3; + uint32_t num_users; + uint32_t num_groups; + uint32_t num_aliases; +}; + +struct samr_DomInfo3 { + NTTIME force_logoff_time; +}; + +struct samr_DomInfo4 { + struct lsa_String comment; +}; + +struct samr_DomInfo5 { + struct lsa_String domain_name; +}; + +struct samr_DomInfo6 { + struct lsa_String primary; +}; + +struct samr_DomInfo7 { + enum samr_Role role; +}; + +struct samr_DomInfo8 { + uint64_t sequence_num; + NTTIME domain_create_time; +}; + +struct samr_DomInfo9 { + uint32_t unknown; +}; + +struct samr_DomInfo11 { + struct samr_DomInfo2 info2; + uint64_t lockout_duration; + uint64_t lockout_window; + uint16_t lockout_threshold; +}; + +struct samr_DomInfo12 { + uint64_t lockout_duration; + uint64_t lockout_window; + uint16_t lockout_threshold; +}; + +struct samr_DomInfo13 { + uint64_t sequence_num; + NTTIME domain_create_time; + uint32_t unknown1; + uint32_t unknown2; +}; + +union samr_DomainInfo { + struct samr_DomInfo1 info1;/* [case] */ + struct samr_DomInfo2 info2;/* [case(2)] */ + struct samr_DomInfo3 info3;/* [case(3)] */ + struct samr_DomInfo4 info4;/* [case(4)] */ + struct samr_DomInfo5 info5;/* [case(5)] */ + struct samr_DomInfo6 info6;/* [case(6)] */ + struct samr_DomInfo7 info7;/* [case(7)] */ + struct samr_DomInfo8 info8;/* [case(8)] */ + struct samr_DomInfo9 info9;/* [case(9)] */ + struct samr_DomInfo11 info11;/* [case(11)] */ + struct samr_DomInfo12 info12;/* [case(12)] */ + struct samr_DomInfo13 info13;/* [case(13)] */ +}/* [switch_type(uint16)] */; + +struct samr_Ids { + uint32_t count;/* [range(0 1024)] */ + uint32_t *ids;/* [unique,size_is(count)] */ +}; + +/* bitmap samr_GroupAttrs */ +#define SE_GROUP_MANDATORY ( 0x00000001 ) +#define SE_GROUP_ENABLED_BY_DEFAULT ( 0x00000002 ) +#define SE_GROUP_ENABLED ( 0x00000004 ) +#define SE_GROUP_OWNER ( 0x00000008 ) +#define SE_GROUP_USE_FOR_DENY_ONLY ( 0x00000010 ) +#define SE_GROUP_RESOURCE ( 0x20000000 ) +#define SE_GROUP_LOGON_ID ( 0xC0000000 ) + +; + +struct samr_GroupInfoAll { + struct lsa_String name; + uint32_t attributes; + uint32_t num_members; + struct lsa_String description; +}; + +struct samr_GroupInfoAttributes { + uint32_t attributes; +}; + +struct samr_GroupInfoDescription { + struct lsa_String description; +}; + +enum samr_GroupInfoEnum +#ifndef USE_UINT_ENUMS + { + GROUPINFOALL=1, + GROUPINFONAME=2, + GROUPINFOATTRIBUTES=3, + GROUPINFODESCRIPTION=4, + GROUPINFOALL2=5 +} +#else + { __donnot_use_enum_samr_GroupInfoEnum=0x7FFFFFFF} +#define GROUPINFOALL ( 1 ) +#define GROUPINFONAME ( 2 ) +#define GROUPINFOATTRIBUTES ( 3 ) +#define GROUPINFODESCRIPTION ( 4 ) +#define GROUPINFOALL2 ( 5 ) +#endif +; + +union samr_GroupInfo { + struct samr_GroupInfoAll all;/* [case(GROUPINFOALL)] */ + struct lsa_String name;/* [case(GROUPINFONAME)] */ + struct samr_GroupInfoAttributes attributes;/* [case(GROUPINFOATTRIBUTES)] */ + struct lsa_String description;/* [case(GROUPINFODESCRIPTION)] */ + struct samr_GroupInfoAll all2;/* [case(GROUPINFOALL2)] */ +}/* [switch_type(samr_GroupInfoEnum)] */; + +struct samr_RidTypeArray { + uint32_t count; + uint32_t *rids;/* [unique,size_is(count)] */ + uint32_t *types;/* [unique,size_is(count)] */ +}; + +struct samr_AliasInfoAll { + struct lsa_String name; + uint32_t num_members; + struct lsa_String description; +}; + +enum samr_AliasInfoEnum +#ifndef USE_UINT_ENUMS + { + ALIASINFOALL=1, + ALIASINFONAME=2, + ALIASINFODESCRIPTION=3 +} +#else + { __donnot_use_enum_samr_AliasInfoEnum=0x7FFFFFFF} +#define ALIASINFOALL ( 1 ) +#define ALIASINFONAME ( 2 ) +#define ALIASINFODESCRIPTION ( 3 ) +#endif +; + +union samr_AliasInfo { + struct samr_AliasInfoAll all;/* [case(ALIASINFOALL)] */ + struct lsa_String name;/* [case(ALIASINFONAME)] */ + struct lsa_String description;/* [case(ALIASINFODESCRIPTION)] */ +}/* [switch_type(samr_AliasInfoEnum)] */; + +struct samr_UserInfo1 { + struct lsa_String account_name; + struct lsa_String full_name; + uint32_t primary_gid; + struct lsa_String description; + struct lsa_String comment; +}; + +struct samr_UserInfo2 { + struct lsa_String comment; + struct lsa_String unknown; + uint16_t country_code; + uint16_t code_page; +}; + +struct samr_LogonHours { + uint16_t units_per_week; + uint8_t *bits;/* [unique,length_is(units_per_week/8),size_is(1260)] */ +}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct samr_UserInfo3 { + struct lsa_String account_name; + struct lsa_String full_name; + uint32_t rid; + uint32_t primary_gid; + struct lsa_String home_directory; + struct lsa_String home_drive; + struct lsa_String logon_script; + struct lsa_String profile_path; + struct lsa_String workstations; + NTTIME last_logon; + NTTIME last_logoff; + NTTIME last_password_change; + NTTIME allow_password_change; + NTTIME force_password_change; + struct samr_LogonHours logon_hours; + uint16_t bad_password_count; + uint16_t logon_count; + uint32_t acct_flags; +}; + +struct samr_UserInfo4 { + struct samr_LogonHours logon_hours; +}; + +struct samr_UserInfo5 { + struct lsa_String account_name; + struct lsa_String full_name; + uint32_t rid; + uint32_t primary_gid; + struct lsa_String home_directory; + struct lsa_String home_drive; + struct lsa_String logon_script; + struct lsa_String profile_path; + struct lsa_String description; + struct lsa_String workstations; + NTTIME last_logon; + NTTIME last_logoff; + struct samr_LogonHours logon_hours; + uint16_t bad_password_count; + uint16_t logon_count; + NTTIME last_password_change; + NTTIME acct_expiry; + uint32_t acct_flags; +}; + +struct samr_UserInfo6 { + struct lsa_String account_name; + struct lsa_String full_name; +}; + +struct samr_UserInfo7 { + struct lsa_String account_name; +}; + +struct samr_UserInfo8 { + struct lsa_String full_name; +}; + +struct samr_UserInfo9 { + uint32_t primary_gid; +}; + +struct samr_UserInfo10 { + struct lsa_String home_directory; + struct lsa_String home_drive; +}; + +struct samr_UserInfo11 { + struct lsa_String logon_script; +}; + +struct samr_UserInfo12 { + struct lsa_String profile_path; +}; + +struct samr_UserInfo13 { + struct lsa_String description; +}; + +struct samr_UserInfo14 { + struct lsa_String workstations; +}; + +struct samr_UserInfo16 { + uint32_t acct_flags; +}; + +struct samr_UserInfo17 { + NTTIME acct_expiry; +}; + +struct samr_UserInfo20 { + struct lsa_String parameters; +}; + +/* bitmap samr_FieldsPresent */ +#define SAMR_FIELD_ACCOUNT_NAME ( 0x00000001 ) +#define SAMR_FIELD_FULL_NAME ( 0x00000002 ) +#define SAMR_FIELD_RID ( 0x00000004 ) +#define SAMR_FIELD_PRIMARY_GID ( 0x00000008 ) +#define SAMR_FIELD_DESCRIPTION ( 0x00000010 ) +#define SAMR_FIELD_COMMENT ( 0x00000020 ) +#define SAMR_FIELD_HOME_DIRECTORY ( 0x00000040 ) +#define SAMR_FIELD_HOME_DRIVE ( 0x00000080 ) +#define SAMR_FIELD_LOGON_SCRIPT ( 0x00000100 ) +#define SAMR_FIELD_PROFILE_PATH ( 0x00000200 ) +#define SAMR_FIELD_WORKSTATIONS ( 0x00000400 ) +#define SAMR_FIELD_LAST_LOGON ( 0x00000800 ) +#define SAMR_FIELD_LAST_LOGOFF ( 0x00001000 ) +#define SAMR_FIELD_LOGON_HOURS ( 0x00002000 ) +#define SAMR_FIELD_BAD_PWD_COUNT ( 0x00004000 ) +#define SAMR_FIELD_NUM_LOGONS ( 0x00008000 ) +#define SAMR_FIELD_ALLOW_PWD_CHANGE ( 0x00010000 ) +#define SAMR_FIELD_FORCE_PWD_CHANGE ( 0x00020000 ) +#define SAMR_FIELD_LAST_PWD_CHANGE ( 0x00040000 ) +#define SAMR_FIELD_ACCT_EXPIRY ( 0x00080000 ) +#define SAMR_FIELD_ACCT_FLAGS ( 0x00100000 ) +#define SAMR_FIELD_PARAMETERS ( 0x00200000 ) +#define SAMR_FIELD_COUNTRY_CODE ( 0x00400000 ) +#define SAMR_FIELD_CODE_PAGE ( 0x00800000 ) +#define SAMR_FIELD_PASSWORD ( 0x01000000 ) +#define SAMR_FIELD_PASSWORD2 ( 0x02000000 ) +#define SAMR_FIELD_PRIVATE_DATA ( 0x04000000 ) +#define SAMR_FIELD_EXPIRED_FLAG ( 0x08000000 ) +#define SAMR_FIELD_SEC_DESC ( 0x10000000 ) +#define SAMR_FIELD_OWF_PWD ( 0x20000000 ) + +; + +struct samr_UserInfo21 { + NTTIME last_logon; + NTTIME last_logoff; + NTTIME last_password_change; + NTTIME acct_expiry; + NTTIME allow_password_change; + NTTIME force_password_change; + struct lsa_String account_name; + struct lsa_String full_name; + struct lsa_String home_directory; + struct lsa_String home_drive; + struct lsa_String logon_script; + struct lsa_String profile_path; + struct lsa_String description; + struct lsa_String workstations; + struct lsa_String comment; + struct lsa_String parameters; + struct lsa_String unknown1; + struct lsa_String unknown2; + struct lsa_String unknown3; + uint32_t buf_count; + uint8_t *buffer;/* [unique,size_is(buf_count)] */ + uint32_t rid; + uint32_t primary_gid; + uint32_t acct_flags; + uint32_t fields_present; + struct samr_LogonHours logon_hours; + uint16_t bad_password_count; + uint16_t logon_count; + uint16_t country_code; + uint16_t code_page; + uint8_t nt_password_set; + uint8_t lm_password_set; + uint8_t password_expired; + uint8_t unknown4; +}; + +struct samr_CryptPassword { + uint8_t data[516]; +}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct samr_UserInfo23 { + struct samr_UserInfo21 info; + struct samr_CryptPassword password; +}; + +struct samr_UserInfo24 { + struct samr_CryptPassword password; + uint8_t pw_len; +}; + +struct samr_CryptPasswordEx { + uint8_t data[532]; +}/* [flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct samr_UserInfo25 { + struct samr_UserInfo21 info; + struct samr_CryptPasswordEx password; +}; + +struct samr_UserInfo26 { + struct samr_CryptPasswordEx password; + uint8_t pw_len; +}; + +union samr_UserInfo { + struct samr_UserInfo1 info1;/* [case] */ + struct samr_UserInfo2 info2;/* [case(2)] */ + struct samr_UserInfo3 info3;/* [case(3)] */ + struct samr_UserInfo4 info4;/* [case(4)] */ + struct samr_UserInfo5 info5;/* [case(5)] */ + struct samr_UserInfo6 info6;/* [case(6)] */ + struct samr_UserInfo7 info7;/* [case(7)] */ + struct samr_UserInfo8 info8;/* [case(8)] */ + struct samr_UserInfo9 info9;/* [case(9)] */ + struct samr_UserInfo10 info10;/* [case(10)] */ + struct samr_UserInfo11 info11;/* [case(11)] */ + struct samr_UserInfo12 info12;/* [case(12)] */ + struct samr_UserInfo13 info13;/* [case(13)] */ + struct samr_UserInfo14 info14;/* [case(14)] */ + struct samr_UserInfo16 info16;/* [case(16)] */ + struct samr_UserInfo17 info17;/* [case(17)] */ + struct samr_UserInfo20 info20;/* [case(20)] */ + struct samr_UserInfo21 info21;/* [case(21)] */ + struct samr_UserInfo23 info23;/* [case(23)] */ + struct samr_UserInfo24 info24;/* [case(24)] */ + struct samr_UserInfo25 info25;/* [case(25)] */ + struct samr_UserInfo26 info26;/* [case(26)] */ +}/* [switch_type(uint16)] */; + +struct samr_Password { + uint8_t hash[16]; +}/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct samr_RidWithAttribute { + uint32_t rid; + uint32_t attributes; +}/* [public] */; + +struct samr_RidWithAttributeArray { + uint32_t count; + struct samr_RidWithAttribute *rids;/* [unique,size_is(count)] */ +}/* [public] */; + +struct samr_DispEntryGeneral { + uint32_t idx; + uint32_t rid; + uint32_t acct_flags; + struct lsa_String account_name; + struct lsa_String description; + struct lsa_String full_name; +}; + +struct samr_DispInfoGeneral { + uint32_t count; + struct samr_DispEntryGeneral *entries;/* [unique,size_is(count)] */ +}; + +struct samr_DispEntryFull { + uint32_t idx; + uint32_t rid; + uint32_t acct_flags; + struct lsa_String account_name; + struct lsa_String description; +}; + +struct samr_DispInfoFull { + uint32_t count; + struct samr_DispEntryFull *entries;/* [unique,size_is(count)] */ +}; + +struct samr_DispEntryFullGroup { + uint32_t idx; + uint32_t rid; + uint32_t acct_flags; + struct lsa_String account_name; + struct lsa_String description; +}; + +struct samr_DispInfoFullGroups { + uint32_t count; + struct samr_DispEntryFullGroup *entries;/* [unique,size_is(count)] */ +}; + +struct samr_DispEntryAscii { + uint32_t idx; + struct lsa_AsciiString account_name; +}; + +struct samr_DispInfoAscii { + uint32_t count; + struct samr_DispEntryAscii *entries;/* [unique,size_is(count)] */ +}; + +union samr_DispInfo { + struct samr_DispInfoGeneral info1;/* [case] */ + struct samr_DispInfoFull info2;/* [case(2)] */ + struct samr_DispInfoFullGroups info3;/* [case(3)] */ + struct samr_DispInfoAscii info4;/* [case(4)] */ + struct samr_DispInfoAscii info5;/* [case(5)] */ +}/* [switch_type(uint16)] */; + +struct samr_PwInfo { + uint16_t min_password_length; + uint32_t password_properties; +}; + +enum samr_RejectReason; + +struct samr_ChangeReject { + enum samr_RejectReason reason; + uint32_t unknown1; + uint32_t unknown2; +}; + +struct samr_ConnectInfo1 { + uint32_t unknown1; + uint32_t unknown2; +}; + +union samr_ConnectInfo { + struct samr_ConnectInfo1 info1;/* [case] */ +}; + +/* bitmap samr_ValidateFieldsPresent */ +#define SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET ( 0x00000001 ) +#define SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME ( 0x00000002 ) +#define SAMR_VALIDATE_FIELD_LOCKOUT_TIME ( 0x00000004 ) +#define SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT ( 0x00000008 ) +#define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH ( 0x00000010 ) +#define SAMR_VALIDATE_FIELD_PASSWORD_HISTORY ( 0x00000020 ) + +; + +enum samr_ValidatePasswordLevel +#ifndef USE_UINT_ENUMS + { + NetValidateAuthentication=1, + NetValidatePasswordChange=2, + NetValidatePasswordReset=3 +} +#else + { __donnot_use_enum_samr_ValidatePasswordLevel=0x7FFFFFFF} +#define NetValidateAuthentication ( 1 ) +#define NetValidatePasswordChange ( 2 ) +#define NetValidatePasswordReset ( 3 ) +#endif +; + +enum samr_ValidationStatus +#ifndef USE_UINT_ENUMS + { + SAMR_VALIDATION_STATUS_SUCCESS=0, + SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE=1, + SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT=2, + SAMR_VALIDATION_STATUS_BAD_PASSWORD=4, + SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT=5, + SAMR_VALIDATION_STATUS_PWD_TOO_SHORT=6, + SAMR_VALIDATION_STATUS_PWD_TOO_LONG=7, + SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH=8, + SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT=9 +} +#else + { __donnot_use_enum_samr_ValidationStatus=0x7FFFFFFF} +#define SAMR_VALIDATION_STATUS_SUCCESS ( 0 ) +#define SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE ( 1 ) +#define SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT ( 2 ) +#define SAMR_VALIDATION_STATUS_BAD_PASSWORD ( 4 ) +#define SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT ( 5 ) +#define SAMR_VALIDATION_STATUS_PWD_TOO_SHORT ( 6 ) +#define SAMR_VALIDATION_STATUS_PWD_TOO_LONG ( 7 ) +#define SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH ( 8 ) +#define SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT ( 9 ) +#endif +; + +struct samr_ValidationBlob { + uint32_t length; + uint8_t *data;/* [unique,size_is(length)] */ +}; + +struct samr_ValidatePasswordInfo { + uint32_t fields_present; + NTTIME last_password_change; + NTTIME bad_password_time; + NTTIME lockout_time; + uint32_t bad_pwd_count; + uint32_t pwd_history_len; + struct samr_ValidationBlob *pwd_history;/* [unique,size_is(pwd_history_len)] */ +}; + +struct samr_ValidatePasswordRepCtr { + struct samr_ValidatePasswordInfo info; + enum samr_ValidationStatus status; +}; + +union samr_ValidatePasswordRep { + struct samr_ValidatePasswordRepCtr ctr1;/* [case] */ + struct samr_ValidatePasswordRepCtr ctr2;/* [case(2)] */ + struct samr_ValidatePasswordRepCtr ctr3;/* [case(3)] */ +}/* [switch_type(uint16)] */; + +struct samr_ValidatePasswordReq3 { + struct samr_ValidatePasswordInfo info; + struct lsa_StringLarge password; + struct lsa_StringLarge account; + struct samr_ValidationBlob hash; + uint8_t pwd_must_change_at_next_logon; + uint8_t clear_lockout; +}; + +struct samr_ValidatePasswordReq2 { + struct samr_ValidatePasswordInfo info; + struct lsa_StringLarge password; + struct lsa_StringLarge account; + struct samr_ValidationBlob hash; + uint8_t password_matched; +}; + +struct samr_ValidatePasswordReq1 { + struct samr_ValidatePasswordInfo info; + uint8_t password_matched; +}; + +union samr_ValidatePasswordReq { + struct samr_ValidatePasswordReq1 req1;/* [case] */ + struct samr_ValidatePasswordReq2 req2;/* [case(2)] */ + struct samr_ValidatePasswordReq3 req3;/* [case(3)] */ +}/* [switch_type(uint16)] */; + + +struct samr_Connect { + struct { + uint16_t *system_name;/* [unique] */ + uint32_t access_mask; + } in; + + struct { + struct policy_handle *connect_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Close { + struct { + struct policy_handle *handle;/* [ref] */ + } in; + + struct { + struct policy_handle *handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetSecurity { + struct { + struct policy_handle *handle;/* [ref] */ + uint32_t sec_info; + struct sec_desc_buf *sdbuf;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_QuerySecurity { + struct { + struct policy_handle *handle;/* [ref] */ + uint32_t sec_info; + } in; + + struct { + struct sec_desc_buf *sdbuf;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Shutdown { + struct { + struct policy_handle *connect_handle;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_LookupDomain { + struct { + struct policy_handle *connect_handle;/* [ref] */ + struct lsa_String *domain_name;/* [ref] */ + } in; + + struct { + struct dom_sid2 *sid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_EnumDomains { + struct { + struct policy_handle *connect_handle;/* [ref] */ + uint32_t buf_size; + uint32_t *resume_handle;/* [ref] */ + } in; + + struct { + struct samr_SamArray *sam;/* [ref] */ + uint32_t *num_entries;/* [ref] */ + uint32_t *resume_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_OpenDomain { + struct { + struct policy_handle *connect_handle;/* [ref] */ + uint32_t access_mask; + struct dom_sid2 *sid;/* [ref] */ + } in; + + struct { + struct policy_handle *domain_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryDomainInfo { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + } in; + + struct { + union samr_DomainInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetDomainInfo { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + union samr_DomainInfo *info;/* [ref,switch_is(level)] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_CreateDomainGroup { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct lsa_String *name;/* [ref] */ + uint32_t access_mask; + } in; + + struct { + struct policy_handle *group_handle;/* [ref] */ + uint32_t *rid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_EnumDomainGroups { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t max_size; + uint32_t *resume_handle;/* [ref] */ + } in; + + struct { + struct samr_SamArray *sam;/* [ref] */ + uint32_t *num_entries;/* [ref] */ + uint32_t *resume_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_CreateUser { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct lsa_String *account_name;/* [ref] */ + uint32_t access_mask; + } in; + + struct { + struct policy_handle *user_handle;/* [ref] */ + uint32_t *rid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_EnumDomainUsers { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t acct_flags; + uint32_t max_size; + uint32_t *resume_handle;/* [ref] */ + } in; + + struct { + struct samr_SamArray *sam;/* [ref] */ + uint32_t *num_entries;/* [ref] */ + uint32_t *resume_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_CreateDomAlias { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct lsa_String *alias_name;/* [ref] */ + uint32_t access_mask; + } in; + + struct { + struct policy_handle *alias_handle;/* [ref] */ + uint32_t *rid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_EnumDomainAliases { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t acct_flags; + uint32_t *resume_handle;/* [ref] */ + } in; + + struct { + struct samr_SamArray *sam;/* [ref] */ + uint32_t *num_entries;/* [ref] */ + uint32_t *resume_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_GetAliasMembership { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct lsa_SidArray *sids;/* [ref] */ + } in; + + struct { + struct samr_Ids *rids;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_LookupNames { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t num_names;/* [range(0 1000)] */ + struct lsa_String *names;/* [length_is(num_names),size_is(1000)] */ + } in; + + struct { + struct samr_Ids *rids;/* [ref] */ + struct samr_Ids *types;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_LookupRids { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t num_rids;/* [range(0 1000)] */ + uint32_t *rids;/* [length_is(num_rids),size_is(1000)] */ + } in; + + struct { + struct lsa_Strings *names;/* [ref] */ + struct samr_Ids *types;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_OpenGroup { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t access_mask; + uint32_t rid; + } in; + + struct { + struct policy_handle *group_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryGroupInfo { + struct { + struct policy_handle *group_handle;/* [ref] */ + enum samr_GroupInfoEnum level; + } in; + + struct { + union samr_GroupInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetGroupInfo { + struct { + struct policy_handle *group_handle;/* [ref] */ + enum samr_GroupInfoEnum level; + union samr_GroupInfo *info;/* [ref,switch_is(level)] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_AddGroupMember { + struct { + struct policy_handle *group_handle;/* [ref] */ + uint32_t rid; + uint32_t flags; + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_DeleteDomainGroup { + struct { + struct policy_handle *group_handle;/* [ref] */ + } in; + + struct { + struct policy_handle *group_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_DeleteGroupMember { + struct { + struct policy_handle *group_handle;/* [ref] */ + uint32_t rid; + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_QueryGroupMember { + struct { + struct policy_handle *group_handle;/* [ref] */ + } in; + + struct { + struct samr_RidTypeArray *rids;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetMemberAttributesOfGroup { + struct { + struct policy_handle *group_handle;/* [ref] */ + uint32_t unknown1; + uint32_t unknown2; + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_OpenAlias { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t access_mask; + uint32_t rid; + } in; + + struct { + struct policy_handle *alias_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryAliasInfo { + struct { + struct policy_handle *alias_handle;/* [ref] */ + enum samr_AliasInfoEnum level; + } in; + + struct { + union samr_AliasInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetAliasInfo { + struct { + struct policy_handle *alias_handle;/* [ref] */ + enum samr_AliasInfoEnum level; + union samr_AliasInfo *info;/* [ref,switch_is(level)] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_DeleteDomAlias { + struct { + struct policy_handle *alias_handle;/* [ref] */ + } in; + + struct { + struct policy_handle *alias_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_AddAliasMember { + struct { + struct policy_handle *alias_handle;/* [ref] */ + struct dom_sid2 *sid;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_DeleteAliasMember { + struct { + struct policy_handle *alias_handle;/* [ref] */ + struct dom_sid2 *sid;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_GetMembersInAlias { + struct { + struct policy_handle *alias_handle;/* [ref] */ + } in; + + struct { + struct lsa_SidArray *sids;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_OpenUser { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t access_mask; + uint32_t rid; + } in; + + struct { + struct policy_handle *user_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_DeleteUser { + struct { + struct policy_handle *user_handle;/* [ref] */ + } in; + + struct { + struct policy_handle *user_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryUserInfo { + struct { + struct policy_handle *user_handle;/* [ref] */ + uint16_t level; + } in; + + struct { + union samr_UserInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetUserInfo { + struct { + struct policy_handle *user_handle;/* [ref] */ + uint16_t level; + union samr_UserInfo *info;/* [ref,switch_is(level)] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_ChangePasswordUser { + struct { + struct policy_handle *user_handle;/* [ref] */ + uint8_t lm_present; + struct samr_Password *old_lm_crypted;/* [unique] */ + struct samr_Password *new_lm_crypted;/* [unique] */ + uint8_t nt_present; + struct samr_Password *old_nt_crypted;/* [unique] */ + struct samr_Password *new_nt_crypted;/* [unique] */ + uint8_t cross1_present; + struct samr_Password *nt_cross;/* [unique] */ + uint8_t cross2_present; + struct samr_Password *lm_cross;/* [unique] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_GetGroupsForUser { + struct { + struct policy_handle *user_handle;/* [ref] */ + } in; + + struct { + struct samr_RidWithAttributeArray *rids;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryDisplayInfo { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + uint32_t start_idx; + uint32_t max_entries; + uint32_t buf_size; + } in; + + struct { + uint32_t *total_size;/* [ref] */ + uint32_t *returned_size;/* [ref] */ + union samr_DispInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_GetDisplayEnumerationIndex { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + struct lsa_String name; + } in; + + struct { + uint32_t *idx;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_TestPrivateFunctionsDomain { + struct { + struct policy_handle *domain_handle;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_TestPrivateFunctionsUser { + struct { + struct policy_handle *user_handle;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_GetUserPwInfo { + struct { + struct policy_handle *user_handle;/* [ref] */ + } in; + + struct { + struct samr_PwInfo *info;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_RemoveMemberFromForeignDomain { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct dom_sid2 *sid;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_QueryDomainInfo2 { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + } in; + + struct { + union samr_DomainInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryUserInfo2 { + struct { + struct policy_handle *user_handle;/* [ref] */ + uint16_t level; + } in; + + struct { + union samr_UserInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryDisplayInfo2 { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + uint32_t start_idx; + uint32_t max_entries; + uint32_t buf_size; + } in; + + struct { + uint32_t *total_size;/* [ref] */ + uint32_t *returned_size;/* [ref] */ + union samr_DispInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_GetDisplayEnumerationIndex2 { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + struct lsa_String name; + } in; + + struct { + uint32_t *idx;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_CreateUser2 { + struct { + struct policy_handle *domain_handle;/* [ref] */ + struct lsa_String *account_name;/* [ref] */ + uint32_t acct_flags; + uint32_t access_mask; + } in; + + struct { + struct policy_handle *user_handle;/* [ref] */ + uint32_t *access_granted;/* [ref] */ + uint32_t *rid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_QueryDisplayInfo3 { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint16_t level; + uint32_t start_idx; + uint32_t max_entries; + uint32_t buf_size; + } in; + + struct { + uint32_t *total_size;/* [ref] */ + uint32_t *returned_size;/* [ref] */ + union samr_DispInfo *info;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + + +struct samr_AddMultipleMembersToAlias { + struct { + struct policy_handle *alias_handle;/* [ref] */ + struct lsa_SidArray *sids;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_RemoveMultipleMembersFromAlias { + struct { + struct policy_handle *alias_handle;/* [ref] */ + struct lsa_SidArray *sids;/* [ref] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_OemChangePasswordUser2 { + struct { + struct lsa_AsciiString *server;/* [unique] */ + struct lsa_AsciiString *account;/* [ref] */ + struct samr_CryptPassword *password;/* [unique] */ + struct samr_Password *hash;/* [unique] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_ChangePasswordUser2 { + struct { + struct lsa_String *server;/* [unique] */ + struct lsa_String *account;/* [ref] */ + struct samr_CryptPassword *nt_password;/* [unique] */ + struct samr_Password *nt_verifier;/* [unique] */ + uint8_t lm_change; + struct samr_CryptPassword *lm_password;/* [unique] */ + struct samr_Password *lm_verifier;/* [unique] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_GetDomPwInfo { + struct { + struct lsa_String *domain_name;/* [unique] */ + } in; + + struct { + struct samr_PwInfo *info;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Connect2 { + struct { + const char *system_name;/* [unique,charset(UTF16)] */ + uint32_t access_mask; + } in; + + struct { + struct policy_handle *connect_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetUserInfo2 { + struct { + struct policy_handle *user_handle;/* [ref] */ + uint16_t level; + union samr_UserInfo *info;/* [ref,switch_is(level)] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_SetBootKeyInformation { + struct { + struct policy_handle *connect_handle;/* [ref] */ + uint32_t unknown1; + uint32_t unknown2; + uint32_t unknown3; + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_GetBootKeyInformation { + struct { + struct policy_handle *domain_handle;/* [ref] */ + } in; + + struct { + uint32_t *unknown;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Connect3 { + struct { + const char *system_name;/* [unique,charset(UTF16)] */ + uint32_t unknown; + uint32_t access_mask; + } in; + + struct { + struct policy_handle *connect_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Connect4 { + struct { + const char *system_name;/* [unique,charset(UTF16)] */ + uint32_t unknown; + uint32_t access_mask; + } in; + + struct { + struct policy_handle *connect_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_ChangePasswordUser3 { + struct { + struct lsa_String *server;/* [unique] */ + struct lsa_String *account;/* [ref] */ + struct samr_CryptPassword *nt_password;/* [unique] */ + struct samr_Password *nt_verifier;/* [unique] */ + uint8_t lm_change; + struct samr_CryptPassword *lm_password;/* [unique] */ + struct samr_Password *lm_verifier;/* [unique] */ + struct samr_CryptPassword *password3;/* [unique] */ + } in; + + struct { + struct samr_DomInfo1 *dominfo;/* [ref] */ + struct samr_ChangeReject *reject;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_Connect5 { + struct { + const char *system_name;/* [unique,charset(UTF16)] */ + uint32_t access_mask; + uint32_t level_in; + union samr_ConnectInfo *info_in;/* [ref,switch_is(level_in)] */ + } in; + + struct { + uint32_t *level_out;/* [ref] */ + union samr_ConnectInfo *info_out;/* [ref,switch_is(*level_out)] */ + struct policy_handle *connect_handle;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_RidToSid { + struct { + struct policy_handle *domain_handle;/* [ref] */ + uint32_t rid; + } in; + + struct { + struct dom_sid2 *sid;/* [ref] */ + NTSTATUS result; + } out; + +}; + + +struct samr_SetDsrmPassword { + struct { + struct lsa_String *name;/* [unique] */ + uint32_t unknown; + struct samr_Password *hash;/* [unique] */ + } in; + + struct { + NTSTATUS result; + } out; + +}; + + +struct samr_ValidatePassword { + struct { + enum samr_ValidatePasswordLevel level; + union samr_ValidatePasswordReq req;/* [switch_is(level)] */ + } in; + + struct { + union samr_ValidatePasswordRep *rep;/* [ref,switch_is(level)] */ + NTSTATUS result; + } out; + +}; + +#endif /* _HEADER_samr */ diff --git a/source3/librpc/gen_ndr/srv_samr.c b/source3/librpc/gen_ndr/srv_samr.c new file mode 100644 index 0000000000..72116f355b --- /dev/null +++ b/source3/librpc/gen_ndr/srv_samr.c @@ -0,0 +1,5482 @@ +/* + * Unix SMB/CIFS implementation. + * server auto-generated by pidl. DO NOT MODIFY! + */ + +#include "includes.h" +#include "librpc/gen_ndr/srv_samr.h" + +static bool api_samr_Connect(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Connect *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CONNECT]; + + r = talloc(NULL, struct samr_Connect); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect, r); + } + + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(r, struct policy_handle); + if (r->out.connect_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_Connect(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Close(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Close *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CLOSE]; + + r = talloc(NULL, struct samr_Close); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Close, r); + } + + ZERO_STRUCT(r->out); + r->out.handle = r->in.handle; + r->out.result = _samr_Close(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Close, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetSecurity(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetSecurity *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETSECURITY]; + + r = talloc(NULL, struct samr_SetSecurity); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetSecurity, r); + } + + r->out.result = _samr_SetSecurity(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetSecurity, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QuerySecurity(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QuerySecurity *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYSECURITY]; + + r = talloc(NULL, struct samr_QuerySecurity); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QuerySecurity, r); + } + + ZERO_STRUCT(r->out); + r->out.sdbuf = talloc_zero(r, struct sec_desc_buf); + if (r->out.sdbuf == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QuerySecurity(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QuerySecurity, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Shutdown(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Shutdown *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SHUTDOWN]; + + r = talloc(NULL, struct samr_Shutdown); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Shutdown, r); + } + + r->out.result = _samr_Shutdown(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Shutdown, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_LookupDomain(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_LookupDomain *r; + + call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPDOMAIN]; + + r = talloc(NULL, struct samr_LookupDomain); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupDomain, r); + } + + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(r, struct dom_sid2); + if (r->out.sid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_LookupDomain(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupDomain, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_EnumDomains(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_EnumDomains *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINS]; + + r = talloc(NULL, struct samr_EnumDomains); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomains, r); + } + + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(r, struct samr_SamArray); + if (r->out.sam == NULL) { + talloc_free(r); + return false; + } + + r->out.num_entries = talloc_zero(r, uint32_t); + if (r->out.num_entries == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_EnumDomains(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomains, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_OpenDomain(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_OpenDomain *r; + + call = &ndr_table_samr.calls[NDR_SAMR_OPENDOMAIN]; + + r = talloc(NULL, struct samr_OpenDomain); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenDomain, r); + } + + ZERO_STRUCT(r->out); + r->out.domain_handle = talloc_zero(r, struct policy_handle); + if (r->out.domain_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_OpenDomain(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenDomain, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryDomainInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryDomainInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYDOMAININFO]; + + r = talloc(NULL, struct samr_QueryDomainInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_DomainInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryDomainInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetDomainInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetDomainInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETDOMAININFO]; + + r = talloc(NULL, struct samr_SetDomainInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetDomainInfo, r); + } + + r->out.result = _samr_SetDomainInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetDomainInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_CreateDomainGroup(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_CreateDomainGroup *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CREATEDOMAINGROUP]; + + r = talloc(NULL, struct samr_CreateDomainGroup); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateDomainGroup, r); + } + + ZERO_STRUCT(r->out); + r->out.group_handle = talloc_zero(r, struct policy_handle); + if (r->out.group_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_CreateDomainGroup(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateDomainGroup, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_EnumDomainGroups(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_EnumDomainGroups *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINGROUPS]; + + r = talloc(NULL, struct samr_EnumDomainGroups); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainGroups, r); + } + + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(r, struct samr_SamArray); + if (r->out.sam == NULL) { + talloc_free(r); + return false; + } + + r->out.num_entries = talloc_zero(r, uint32_t); + if (r->out.num_entries == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_EnumDomainGroups(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainGroups, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_CreateUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_CreateUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CREATEUSER]; + + r = talloc(NULL, struct samr_CreateUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateUser, r); + } + + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(r, struct policy_handle); + if (r->out.user_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_CreateUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_EnumDomainUsers(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_EnumDomainUsers *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINUSERS]; + + r = talloc(NULL, struct samr_EnumDomainUsers); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainUsers, r); + } + + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(r, struct samr_SamArray); + if (r->out.sam == NULL) { + talloc_free(r); + return false; + } + + r->out.num_entries = talloc_zero(r, uint32_t); + if (r->out.num_entries == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_EnumDomainUsers(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainUsers, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_CreateDomAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_CreateDomAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CREATEDOMALIAS]; + + r = talloc(NULL, struct samr_CreateDomAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateDomAlias, r); + } + + ZERO_STRUCT(r->out); + r->out.alias_handle = talloc_zero(r, struct policy_handle); + if (r->out.alias_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_CreateDomAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateDomAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_EnumDomainAliases(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_EnumDomainAliases *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ENUMDOMAINALIASES]; + + r = talloc(NULL, struct samr_EnumDomainAliases); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_EnumDomainAliases, r); + } + + ZERO_STRUCT(r->out); + r->out.resume_handle = r->in.resume_handle; + r->out.sam = talloc_zero(r, struct samr_SamArray); + if (r->out.sam == NULL) { + talloc_free(r); + return false; + } + + r->out.num_entries = talloc_zero(r, uint32_t); + if (r->out.num_entries == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_EnumDomainAliases(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_EnumDomainAliases, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetAliasMembership(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetAliasMembership *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETALIASMEMBERSHIP]; + + r = talloc(NULL, struct samr_GetAliasMembership); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetAliasMembership, r); + } + + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(r, struct samr_Ids); + if (r->out.rids == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetAliasMembership(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetAliasMembership, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_LookupNames(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_LookupNames *r; + + call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPNAMES]; + + r = talloc(NULL, struct samr_LookupNames); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupNames, r); + } + + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(r, struct samr_Ids); + if (r->out.rids == NULL) { + talloc_free(r); + return false; + } + + r->out.types = talloc_zero(r, struct samr_Ids); + if (r->out.types == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_LookupNames(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupNames, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_LookupRids(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_LookupRids *r; + + call = &ndr_table_samr.calls[NDR_SAMR_LOOKUPRIDS]; + + r = talloc(NULL, struct samr_LookupRids); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_LookupRids, r); + } + + ZERO_STRUCT(r->out); + r->out.names = talloc_zero(r, struct lsa_Strings); + if (r->out.names == NULL) { + talloc_free(r); + return false; + } + + r->out.types = talloc_zero(r, struct samr_Ids); + if (r->out.types == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_LookupRids(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_LookupRids, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_OpenGroup(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_OpenGroup *r; + + call = &ndr_table_samr.calls[NDR_SAMR_OPENGROUP]; + + r = talloc(NULL, struct samr_OpenGroup); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenGroup, r); + } + + ZERO_STRUCT(r->out); + r->out.group_handle = talloc_zero(r, struct policy_handle); + if (r->out.group_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_OpenGroup(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenGroup, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryGroupInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryGroupInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYGROUPINFO]; + + r = talloc(NULL, struct samr_QueryGroupInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryGroupInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_GroupInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryGroupInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryGroupInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetGroupInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetGroupInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETGROUPINFO]; + + r = talloc(NULL, struct samr_SetGroupInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetGroupInfo, r); + } + + r->out.result = _samr_SetGroupInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetGroupInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_AddGroupMember(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_AddGroupMember *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ADDGROUPMEMBER]; + + r = talloc(NULL, struct samr_AddGroupMember); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddGroupMember, r); + } + + r->out.result = _samr_AddGroupMember(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddGroupMember, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_DeleteDomainGroup(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_DeleteDomainGroup *r; + + call = &ndr_table_samr.calls[NDR_SAMR_DELETEDOMAINGROUP]; + + r = talloc(NULL, struct samr_DeleteDomainGroup); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteDomainGroup, r); + } + + ZERO_STRUCT(r->out); + r->out.group_handle = r->in.group_handle; + r->out.result = _samr_DeleteDomainGroup(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteDomainGroup, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_DeleteGroupMember(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_DeleteGroupMember *r; + + call = &ndr_table_samr.calls[NDR_SAMR_DELETEGROUPMEMBER]; + + r = talloc(NULL, struct samr_DeleteGroupMember); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteGroupMember, r); + } + + r->out.result = _samr_DeleteGroupMember(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteGroupMember, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryGroupMember(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryGroupMember *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYGROUPMEMBER]; + + r = talloc(NULL, struct samr_QueryGroupMember); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryGroupMember, r); + } + + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(r, struct samr_RidTypeArray); + if (r->out.rids == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryGroupMember(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryGroupMember, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetMemberAttributesOfGroup(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetMemberAttributesOfGroup *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP]; + + r = talloc(NULL, struct samr_SetMemberAttributesOfGroup); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetMemberAttributesOfGroup, r); + } + + r->out.result = _samr_SetMemberAttributesOfGroup(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetMemberAttributesOfGroup, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_OpenAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_OpenAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_OPENALIAS]; + + r = talloc(NULL, struct samr_OpenAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenAlias, r); + } + + ZERO_STRUCT(r->out); + r->out.alias_handle = talloc_zero(r, struct policy_handle); + if (r->out.alias_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_OpenAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryAliasInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryAliasInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYALIASINFO]; + + r = talloc(NULL, struct samr_QueryAliasInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryAliasInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_AliasInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryAliasInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryAliasInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetAliasInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetAliasInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETALIASINFO]; + + r = talloc(NULL, struct samr_SetAliasInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetAliasInfo, r); + } + + r->out.result = _samr_SetAliasInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetAliasInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_DeleteDomAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_DeleteDomAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_DELETEDOMALIAS]; + + r = talloc(NULL, struct samr_DeleteDomAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteDomAlias, r); + } + + ZERO_STRUCT(r->out); + r->out.alias_handle = r->in.alias_handle; + r->out.result = _samr_DeleteDomAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteDomAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_AddAliasMember(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_AddAliasMember *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ADDALIASMEMBER]; + + r = talloc(NULL, struct samr_AddAliasMember); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddAliasMember, r); + } + + r->out.result = _samr_AddAliasMember(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddAliasMember, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_DeleteAliasMember(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_DeleteAliasMember *r; + + call = &ndr_table_samr.calls[NDR_SAMR_DELETEALIASMEMBER]; + + r = talloc(NULL, struct samr_DeleteAliasMember); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteAliasMember, r); + } + + r->out.result = _samr_DeleteAliasMember(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteAliasMember, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetMembersInAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetMembersInAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETMEMBERSINALIAS]; + + r = talloc(NULL, struct samr_GetMembersInAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetMembersInAlias, r); + } + + ZERO_STRUCT(r->out); + r->out.sids = talloc_zero(r, struct lsa_SidArray); + if (r->out.sids == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetMembersInAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetMembersInAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_OpenUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_OpenUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_OPENUSER]; + + r = talloc(NULL, struct samr_OpenUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OpenUser, r); + } + + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(r, struct policy_handle); + if (r->out.user_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_OpenUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OpenUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_DeleteUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_DeleteUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_DELETEUSER]; + + r = talloc(NULL, struct samr_DeleteUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_DeleteUser, r); + } + + ZERO_STRUCT(r->out); + r->out.user_handle = r->in.user_handle; + r->out.result = _samr_DeleteUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_DeleteUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryUserInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryUserInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYUSERINFO]; + + r = talloc(NULL, struct samr_QueryUserInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryUserInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_UserInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryUserInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetUserInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetUserInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETUSERINFO]; + + r = talloc(NULL, struct samr_SetUserInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetUserInfo, r); + } + + r->out.result = _samr_SetUserInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetUserInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_ChangePasswordUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_ChangePasswordUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER]; + + r = talloc(NULL, struct samr_ChangePasswordUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser, r); + } + + r->out.result = _samr_ChangePasswordUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetGroupsForUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetGroupsForUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETGROUPSFORUSER]; + + r = talloc(NULL, struct samr_GetGroupsForUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetGroupsForUser, r); + } + + ZERO_STRUCT(r->out); + r->out.rids = talloc_zero(r, struct samr_RidWithAttributeArray); + if (r->out.rids == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetGroupsForUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetGroupsForUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryDisplayInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryDisplayInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO]; + + r = talloc(NULL, struct samr_QueryDisplayInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(r, uint32_t); + if (r->out.total_size == NULL) { + talloc_free(r); + return false; + } + + r->out.returned_size = talloc_zero(r, uint32_t); + if (r->out.returned_size == NULL) { + talloc_free(r); + return false; + } + + r->out.info = talloc_zero(r, union samr_DispInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryDisplayInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetDisplayEnumerationIndex(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetDisplayEnumerationIndex *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETDISPLAYENUMERATIONINDEX]; + + r = talloc(NULL, struct samr_GetDisplayEnumerationIndex); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex, r); + } + + ZERO_STRUCT(r->out); + r->out.idx = talloc_zero(r, uint32_t); + if (r->out.idx == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetDisplayEnumerationIndex(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_TestPrivateFunctionsDomain(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_TestPrivateFunctionsDomain *r; + + call = &ndr_table_samr.calls[NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN]; + + r = talloc(NULL, struct samr_TestPrivateFunctionsDomain); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsDomain, r); + } + + r->out.result = _samr_TestPrivateFunctionsDomain(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsDomain, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_TestPrivateFunctionsUser(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_TestPrivateFunctionsUser *r; + + call = &ndr_table_samr.calls[NDR_SAMR_TESTPRIVATEFUNCTIONSUSER]; + + r = talloc(NULL, struct samr_TestPrivateFunctionsUser); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_TestPrivateFunctionsUser, r); + } + + r->out.result = _samr_TestPrivateFunctionsUser(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_TestPrivateFunctionsUser, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetUserPwInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetUserPwInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETUSERPWINFO]; + + r = talloc(NULL, struct samr_GetUserPwInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetUserPwInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct samr_PwInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetUserPwInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetUserPwInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_RemoveMemberFromForeignDomain(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_RemoveMemberFromForeignDomain *r; + + call = &ndr_table_samr.calls[NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN]; + + r = talloc(NULL, struct samr_RemoveMemberFromForeignDomain); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RemoveMemberFromForeignDomain, r); + } + + r->out.result = _samr_RemoveMemberFromForeignDomain(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RemoveMemberFromForeignDomain, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryDomainInfo2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryDomainInfo2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYDOMAININFO2]; + + r = talloc(NULL, struct samr_QueryDomainInfo2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDomainInfo2, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_DomainInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryDomainInfo2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDomainInfo2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryUserInfo2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryUserInfo2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYUSERINFO2]; + + r = talloc(NULL, struct samr_QueryUserInfo2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryUserInfo2, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, union samr_UserInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryUserInfo2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryUserInfo2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryDisplayInfo2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryDisplayInfo2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO2]; + + r = talloc(NULL, struct samr_QueryDisplayInfo2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo2, r); + } + + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(r, uint32_t); + if (r->out.total_size == NULL) { + talloc_free(r); + return false; + } + + r->out.returned_size = talloc_zero(r, uint32_t); + if (r->out.returned_size == NULL) { + talloc_free(r); + return false; + } + + r->out.info = talloc_zero(r, union samr_DispInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryDisplayInfo2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetDisplayEnumerationIndex2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetDisplayEnumerationIndex2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETDISPLAYENUMERATIONINDEX2]; + + r = talloc(NULL, struct samr_GetDisplayEnumerationIndex2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDisplayEnumerationIndex2, r); + } + + ZERO_STRUCT(r->out); + r->out.idx = talloc_zero(r, uint32_t); + if (r->out.idx == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetDisplayEnumerationIndex2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDisplayEnumerationIndex2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_CreateUser2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_CreateUser2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CREATEUSER2]; + + r = talloc(NULL, struct samr_CreateUser2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_CreateUser2, r); + } + + ZERO_STRUCT(r->out); + r->out.user_handle = talloc_zero(r, struct policy_handle); + if (r->out.user_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.access_granted = talloc_zero(r, uint32_t); + if (r->out.access_granted == NULL) { + talloc_free(r); + return false; + } + + r->out.rid = talloc_zero(r, uint32_t); + if (r->out.rid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_CreateUser2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_CreateUser2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_QueryDisplayInfo3(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_QueryDisplayInfo3 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_QUERYDISPLAYINFO3]; + + r = talloc(NULL, struct samr_QueryDisplayInfo3); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_QueryDisplayInfo3, r); + } + + ZERO_STRUCT(r->out); + r->out.total_size = talloc_zero(r, uint32_t); + if (r->out.total_size == NULL) { + talloc_free(r); + return false; + } + + r->out.returned_size = talloc_zero(r, uint32_t); + if (r->out.returned_size == NULL) { + talloc_free(r); + return false; + } + + r->out.info = talloc_zero(r, union samr_DispInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_QueryDisplayInfo3(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_QueryDisplayInfo3, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_AddMultipleMembersToAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_AddMultipleMembersToAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS]; + + r = talloc(NULL, struct samr_AddMultipleMembersToAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_AddMultipleMembersToAlias, r); + } + + r->out.result = _samr_AddMultipleMembersToAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_AddMultipleMembersToAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_RemoveMultipleMembersFromAlias(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_RemoveMultipleMembersFromAlias *r; + + call = &ndr_table_samr.calls[NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS]; + + r = talloc(NULL, struct samr_RemoveMultipleMembersFromAlias); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RemoveMultipleMembersFromAlias, r); + } + + r->out.result = _samr_RemoveMultipleMembersFromAlias(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RemoveMultipleMembersFromAlias, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_OemChangePasswordUser2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_OemChangePasswordUser2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_OEMCHANGEPASSWORDUSER2]; + + r = talloc(NULL, struct samr_OemChangePasswordUser2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_OemChangePasswordUser2, r); + } + + r->out.result = _samr_OemChangePasswordUser2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_OemChangePasswordUser2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_ChangePasswordUser2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_ChangePasswordUser2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER2]; + + r = talloc(NULL, struct samr_ChangePasswordUser2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser2, r); + } + + r->out.result = _samr_ChangePasswordUser2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetDomPwInfo(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetDomPwInfo *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETDOMPWINFO]; + + r = talloc(NULL, struct samr_GetDomPwInfo); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetDomPwInfo, r); + } + + ZERO_STRUCT(r->out); + r->out.info = talloc_zero(r, struct samr_PwInfo); + if (r->out.info == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetDomPwInfo(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetDomPwInfo, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Connect2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Connect2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CONNECT2]; + + r = talloc(NULL, struct samr_Connect2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect2, r); + } + + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(r, struct policy_handle); + if (r->out.connect_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_Connect2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetUserInfo2(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetUserInfo2 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETUSERINFO2]; + + r = talloc(NULL, struct samr_SetUserInfo2); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetUserInfo2, r); + } + + r->out.result = _samr_SetUserInfo2(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetUserInfo2, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetBootKeyInformation(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetBootKeyInformation *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETBOOTKEYINFORMATION]; + + r = talloc(NULL, struct samr_SetBootKeyInformation); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetBootKeyInformation, r); + } + + r->out.result = _samr_SetBootKeyInformation(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetBootKeyInformation, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_GetBootKeyInformation(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_GetBootKeyInformation *r; + + call = &ndr_table_samr.calls[NDR_SAMR_GETBOOTKEYINFORMATION]; + + r = talloc(NULL, struct samr_GetBootKeyInformation); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_GetBootKeyInformation, r); + } + + ZERO_STRUCT(r->out); + r->out.unknown = talloc_zero(r, uint32_t); + if (r->out.unknown == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_GetBootKeyInformation(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_GetBootKeyInformation, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Connect3(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Connect3 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CONNECT3]; + + r = talloc(NULL, struct samr_Connect3); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect3, r); + } + + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(r, struct policy_handle); + if (r->out.connect_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_Connect3(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect3, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Connect4(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Connect4 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CONNECT4]; + + r = talloc(NULL, struct samr_Connect4); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect4, r); + } + + ZERO_STRUCT(r->out); + r->out.connect_handle = talloc_zero(r, struct policy_handle); + if (r->out.connect_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_Connect4(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect4, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_ChangePasswordUser3(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_ChangePasswordUser3 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CHANGEPASSWORDUSER3]; + + r = talloc(NULL, struct samr_ChangePasswordUser3); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ChangePasswordUser3, r); + } + + ZERO_STRUCT(r->out); + r->out.dominfo = talloc_zero(r, struct samr_DomInfo1); + if (r->out.dominfo == NULL) { + talloc_free(r); + return false; + } + + r->out.reject = talloc_zero(r, struct samr_ChangeReject); + if (r->out.reject == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_ChangePasswordUser3(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ChangePasswordUser3, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_Connect5(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_Connect5 *r; + + call = &ndr_table_samr.calls[NDR_SAMR_CONNECT5]; + + r = talloc(NULL, struct samr_Connect5); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_Connect5, r); + } + + ZERO_STRUCT(r->out); + r->out.level_out = talloc_zero(r, uint32_t); + if (r->out.level_out == NULL) { + talloc_free(r); + return false; + } + + r->out.info_out = talloc_zero(r, union samr_ConnectInfo); + if (r->out.info_out == NULL) { + talloc_free(r); + return false; + } + + r->out.connect_handle = talloc_zero(r, struct policy_handle); + if (r->out.connect_handle == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_Connect5(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_Connect5, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_RidToSid(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_RidToSid *r; + + call = &ndr_table_samr.calls[NDR_SAMR_RIDTOSID]; + + r = talloc(NULL, struct samr_RidToSid); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_RidToSid, r); + } + + ZERO_STRUCT(r->out); + r->out.sid = talloc_zero(r, struct dom_sid2); + if (r->out.sid == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_RidToSid(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_RidToSid, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_SetDsrmPassword(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_SetDsrmPassword *r; + + call = &ndr_table_samr.calls[NDR_SAMR_SETDSRMPASSWORD]; + + r = talloc(NULL, struct samr_SetDsrmPassword); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_SetDsrmPassword, r); + } + + r->out.result = _samr_SetDsrmPassword(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_SetDsrmPassword, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + +static bool api_samr_ValidatePassword(pipes_struct *p) +{ + const struct ndr_interface_call *call; + struct ndr_pull *pull; + struct ndr_push *push; + enum ndr_err_code ndr_err; + DATA_BLOB blob; + struct samr_ValidatePassword *r; + + call = &ndr_table_samr.calls[NDR_SAMR_VALIDATEPASSWORD]; + + r = talloc(NULL, struct samr_ValidatePassword); + if (r == NULL) { + return false; + } + + if (!prs_data_blob(&p->in_data.data, &blob, r)) { + talloc_free(r); + return false; + } + + pull = ndr_pull_init_blob(&blob, r); + if (pull == NULL) { + talloc_free(r); + return false; + } + + pull->flags |= LIBNDR_FLAG_REF_ALLOC; + ndr_err = call->ndr_pull(pull, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_IN_DEBUG(samr_ValidatePassword, r); + } + + ZERO_STRUCT(r->out); + r->out.rep = talloc_zero(r, union samr_ValidatePasswordRep); + if (r->out.rep == NULL) { + talloc_free(r); + return false; + } + + r->out.result = _samr_ValidatePassword(p, r); + + if (p->rng_fault_state) { + talloc_free(r); + /* Return true here, srv_pipe_hnd.c will take care */ + return true; + } + + if (DEBUGLEVEL >= 10) { + NDR_PRINT_OUT_DEBUG(samr_ValidatePassword, r); + } + + push = ndr_push_init_ctx(r); + if (push == NULL) { + talloc_free(r); + return false; + } + + ndr_err = call->ndr_push(push, NDR_OUT, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + talloc_free(r); + return false; + } + + blob = ndr_push_blob(push); + if (!prs_copy_data_in(&p->out_data.rdata, (const char *)blob.data, (uint32_t)blob.length)) { + talloc_free(r); + return false; + } + + talloc_free(r); + + return true; +} + + +/* Tables */ +static struct api_struct api_samr_cmds[] = +{ + {"SAMR_CONNECT", NDR_SAMR_CONNECT, api_samr_Connect}, + {"SAMR_CLOSE", NDR_SAMR_CLOSE, api_samr_Close}, + {"SAMR_SETSECURITY", NDR_SAMR_SETSECURITY, api_samr_SetSecurity}, + {"SAMR_QUERYSECURITY", NDR_SAMR_QUERYSECURITY, api_samr_QuerySecurity}, + {"SAMR_SHUTDOWN", NDR_SAMR_SHUTDOWN, api_samr_Shutdown}, + {"SAMR_LOOKUPDOMAIN", NDR_SAMR_LOOKUPDOMAIN, api_samr_LookupDomain}, + {"SAMR_ENUMDOMAINS", NDR_SAMR_ENUMDOMAINS, api_samr_EnumDomains}, + {"SAMR_OPENDOMAIN", NDR_SAMR_OPENDOMAIN, api_samr_OpenDomain}, + {"SAMR_QUERYDOMAININFO", NDR_SAMR_QUERYDOMAININFO, api_samr_QueryDomainInfo}, + {"SAMR_SETDOMAININFO", NDR_SAMR_SETDOMAININFO, api_samr_SetDomainInfo}, + {"SAMR_CREATEDOMAINGROUP", NDR_SAMR_CREATEDOMAINGROUP, api_samr_CreateDomainGroup}, + {"SAMR_ENUMDOMAINGROUPS", NDR_SAMR_ENUMDOMAINGROUPS, api_samr_EnumDomainGroups}, + {"SAMR_CREATEUSER", NDR_SAMR_CREATEUSER, api_samr_CreateUser}, + {"SAMR_ENUMDOMAINUSERS", NDR_SAMR_ENUMDOMAINUSERS, api_samr_EnumDomainUsers}, + {"SAMR_CREATEDOMALIAS", NDR_SAMR_CREATEDOMALIAS, api_samr_CreateDomAlias}, + {"SAMR_ENUMDOMAINALIASES", NDR_SAMR_ENUMDOMAINALIASES, api_samr_EnumDomainAliases}, + {"SAMR_GETALIASMEMBERSHIP", NDR_SAMR_GETALIASMEMBERSHIP, api_samr_GetAliasMembership}, + {"SAMR_LOOKUPNAMES", NDR_SAMR_LOOKUPNAMES, api_samr_LookupNames}, + {"SAMR_LOOKUPRIDS", NDR_SAMR_LOOKUPRIDS, api_samr_LookupRids}, + {"SAMR_OPENGROUP", NDR_SAMR_OPENGROUP, api_samr_OpenGroup}, + {"SAMR_QUERYGROUPINFO", NDR_SAMR_QUERYGROUPINFO, api_samr_QueryGroupInfo}, + {"SAMR_SETGROUPINFO", NDR_SAMR_SETGROUPINFO, api_samr_SetGroupInfo}, + {"SAMR_ADDGROUPMEMBER", NDR_SAMR_ADDGROUPMEMBER, api_samr_AddGroupMember}, + {"SAMR_DELETEDOMAINGROUP", NDR_SAMR_DELETEDOMAINGROUP, api_samr_DeleteDomainGroup}, + {"SAMR_DELETEGROUPMEMBER", NDR_SAMR_DELETEGROUPMEMBER, api_samr_DeleteGroupMember}, + {"SAMR_QUERYGROUPMEMBER", NDR_SAMR_QUERYGROUPMEMBER, api_samr_QueryGroupMember}, + {"SAMR_SETMEMBERATTRIBUTESOFGROUP", NDR_SAMR_SETMEMBERATTRIBUTESOFGROUP, api_samr_SetMemberAttributesOfGroup}, + {"SAMR_OPENALIAS", NDR_SAMR_OPENALIAS, api_samr_OpenAlias}, + {"SAMR_QUERYALIASINFO", NDR_SAMR_QUERYALIASINFO, api_samr_QueryAliasInfo}, + {"SAMR_SETALIASINFO", NDR_SAMR_SETALIASINFO, api_samr_SetAliasInfo}, + {"SAMR_DELETEDOMALIAS", NDR_SAMR_DELETEDOMALIAS, api_samr_DeleteDomAlias}, + {"SAMR_ADDALIASMEMBER", NDR_SAMR_ADDALIASMEMBER, api_samr_AddAliasMember}, + {"SAMR_DELETEALIASMEMBER", NDR_SAMR_DELETEALIASMEMBER, api_samr_DeleteAliasMember}, + {"SAMR_GETMEMBERSINALIAS", NDR_SAMR_GETMEMBERSINALIAS, api_samr_GetMembersInAlias}, + {"SAMR_OPENUSER", NDR_SAMR_OPENUSER, api_samr_OpenUser}, + {"SAMR_DELETEUSER", NDR_SAMR_DELETEUSER, api_samr_DeleteUser}, + {"SAMR_QUERYUSERINFO", NDR_SAMR_QUERYUSERINFO, api_samr_QueryUserInfo}, + {"SAMR_SETUSERINFO", NDR_SAMR_SETUSERINFO, api_samr_SetUserInfo}, + {"SAMR_CHANGEPASSWORDUSER", NDR_SAMR_CHANGEPASSWORDUSER, api_samr_ChangePasswordUser}, + {"SAMR_GETGROUPSFORUSER", NDR_SAMR_GETGROUPSFORUSER, api_samr_GetGroupsForUser}, + {"SAMR_QUERYDISPLAYINFO", NDR_SAMR_QUERYDISPLAYINFO, api_samr_QueryDisplayInfo}, + {"SAMR_GETDISPLAYENUMERATIONINDEX", NDR_SAMR_GETDISPLAYENUMERATIONINDEX, api_samr_GetDisplayEnumerationIndex}, + {"SAMR_TESTPRIVATEFUNCTIONSDOMAIN", NDR_SAMR_TESTPRIVATEFUNCTIONSDOMAIN, api_samr_TestPrivateFunctionsDomain}, + {"SAMR_TESTPRIVATEFUNCTIONSUSER", NDR_SAMR_TESTPRIVATEFUNCTIONSUSER, api_samr_TestPrivateFunctionsUser}, + {"SAMR_GETUSERPWINFO", NDR_SAMR_GETUSERPWINFO, api_samr_GetUserPwInfo}, + {"SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN", NDR_SAMR_REMOVEMEMBERFROMFOREIGNDOMAIN, api_samr_RemoveMemberFromForeignDomain}, + {"SAMR_QUERYDOMAININFO2", NDR_SAMR_QUERYDOMAININFO2, api_samr_QueryDomainInfo2}, + {"SAMR_QUERYUSERINFO2", NDR_SAMR_QUERYUSERINFO2, api_samr_QueryUserInfo2}, + {"SAMR_QUERYDISPLAYINFO2", NDR_SAMR_QUERYDISPLAYINFO2, api_samr_QueryDisplayInfo2}, + {"SAMR_GETDISPLAYENUMERATIONINDEX2", NDR_SAMR_GETDISPLAYENUMERATIONINDEX2, api_samr_GetDisplayEnumerationIndex2}, + {"SAMR_CREATEUSER2", NDR_SAMR_CREATEUSER2, api_samr_CreateUser2}, + {"SAMR_QUERYDISPLAYINFO3", NDR_SAMR_QUERYDISPLAYINFO3, api_samr_QueryDisplayInfo3}, + {"SAMR_ADDMULTIPLEMEMBERSTOALIAS", NDR_SAMR_ADDMULTIPLEMEMBERSTOALIAS, api_samr_AddMultipleMembersToAlias}, + {"SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS", NDR_SAMR_REMOVEMULTIPLEMEMBERSFROMALIAS, api_samr_RemoveMultipleMembersFromAlias}, + {"SAMR_OEMCHANGEPASSWORDUSER2", NDR_SAMR_OEMCHANGEPASSWORDUSER2, api_samr_OemChangePasswordUser2}, + {"SAMR_CHANGEPASSWORDUSER2", NDR_SAMR_CHANGEPASSWORDUSER2, api_samr_ChangePasswordUser2}, + {"SAMR_GETDOMPWINFO", NDR_SAMR_GETDOMPWINFO, api_samr_GetDomPwInfo}, + {"SAMR_CONNECT2", NDR_SAMR_CONNECT2, api_samr_Connect2}, + {"SAMR_SETUSERINFO2", NDR_SAMR_SETUSERINFO2, api_samr_SetUserInfo2}, + {"SAMR_SETBOOTKEYINFORMATION", NDR_SAMR_SETBOOTKEYINFORMATION, api_samr_SetBootKeyInformation}, + {"SAMR_GETBOOTKEYINFORMATION", NDR_SAMR_GETBOOTKEYINFORMATION, api_samr_GetBootKeyInformation}, + {"SAMR_CONNECT3", NDR_SAMR_CONNECT3, api_samr_Connect3}, + {"SAMR_CONNECT4", NDR_SAMR_CONNECT4, api_samr_Connect4}, + {"SAMR_CHANGEPASSWORDUSER3", NDR_SAMR_CHANGEPASSWORDUSER3, api_samr_ChangePasswordUser3}, + {"SAMR_CONNECT5", NDR_SAMR_CONNECT5, api_samr_Connect5}, + {"SAMR_RIDTOSID", NDR_SAMR_RIDTOSID, api_samr_RidToSid}, + {"SAMR_SETDSRMPASSWORD", NDR_SAMR_SETDSRMPASSWORD, api_samr_SetDsrmPassword}, + {"SAMR_VALIDATEPASSWORD", NDR_SAMR_VALIDATEPASSWORD, api_samr_ValidatePassword}, +}; + +void samr_get_pipe_fns(struct api_struct **fns, int *n_fns) +{ + *fns = api_samr_cmds; + *n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct); +} + +NTSTATUS rpc_samr_init(void) +{ + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "samr", api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct)); +} diff --git a/source3/librpc/gen_ndr/srv_samr.h b/source3/librpc/gen_ndr/srv_samr.h new file mode 100644 index 0000000000..7d5cdd745d --- /dev/null +++ b/source3/librpc/gen_ndr/srv_samr.h @@ -0,0 +1,74 @@ +#include "librpc/gen_ndr/ndr_samr.h" +#ifndef __SRV_SAMR__ +#define __SRV_SAMR__ +NTSTATUS _samr_Connect(pipes_struct *p, struct samr_Connect *r); +NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r); +NTSTATUS _samr_SetSecurity(pipes_struct *p, struct samr_SetSecurity *r); +NTSTATUS _samr_QuerySecurity(pipes_struct *p, struct samr_QuerySecurity *r); +NTSTATUS _samr_Shutdown(pipes_struct *p, struct samr_Shutdown *r); +NTSTATUS _samr_LookupDomain(pipes_struct *p, struct samr_LookupDomain *r); +NTSTATUS _samr_EnumDomains(pipes_struct *p, struct samr_EnumDomains *r); +NTSTATUS _samr_OpenDomain(pipes_struct *p, struct samr_OpenDomain *r); +NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, struct samr_QueryDomainInfo *r); +NTSTATUS _samr_SetDomainInfo(pipes_struct *p, struct samr_SetDomainInfo *r); +NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, struct samr_CreateDomainGroup *r); +NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, struct samr_EnumDomainGroups *r); +NTSTATUS _samr_CreateUser(pipes_struct *p, struct samr_CreateUser *r); +NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, struct samr_EnumDomainUsers *r); +NTSTATUS _samr_CreateDomAlias(pipes_struct *p, struct samr_CreateDomAlias *r); +NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, struct samr_EnumDomainAliases *r); +NTSTATUS _samr_GetAliasMembership(pipes_struct *p, struct samr_GetAliasMembership *r); +NTSTATUS _samr_LookupNames(pipes_struct *p, struct samr_LookupNames *r); +NTSTATUS _samr_LookupRids(pipes_struct *p, struct samr_LookupRids *r); +NTSTATUS _samr_OpenGroup(pipes_struct *p, struct samr_OpenGroup *r); +NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, struct samr_QueryGroupInfo *r); +NTSTATUS _samr_SetGroupInfo(pipes_struct *p, struct samr_SetGroupInfo *r); +NTSTATUS _samr_AddGroupMember(pipes_struct *p, struct samr_AddGroupMember *r); +NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, struct samr_DeleteDomainGroup *r); +NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, struct samr_DeleteGroupMember *r); +NTSTATUS _samr_QueryGroupMember(pipes_struct *p, struct samr_QueryGroupMember *r); +NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, struct samr_SetMemberAttributesOfGroup *r); +NTSTATUS _samr_OpenAlias(pipes_struct *p, struct samr_OpenAlias *r); +NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, struct samr_QueryAliasInfo *r); +NTSTATUS _samr_SetAliasInfo(pipes_struct *p, struct samr_SetAliasInfo *r); +NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, struct samr_DeleteDomAlias *r); +NTSTATUS _samr_AddAliasMember(pipes_struct *p, struct samr_AddAliasMember *r); +NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, struct samr_DeleteAliasMember *r); +NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, struct samr_GetMembersInAlias *r); +NTSTATUS _samr_OpenUser(pipes_struct *p, struct samr_OpenUser *r); +NTSTATUS _samr_DeleteUser(pipes_struct *p, struct samr_DeleteUser *r); +NTSTATUS _samr_QueryUserInfo(pipes_struct *p, struct samr_QueryUserInfo *r); +NTSTATUS _samr_SetUserInfo(pipes_struct *p, struct samr_SetUserInfo *r); +NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, struct samr_ChangePasswordUser *r); +NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, struct samr_GetGroupsForUser *r); +NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, struct samr_QueryDisplayInfo *r); +NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, struct samr_GetDisplayEnumerationIndex *r); +NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, struct samr_TestPrivateFunctionsDomain *r); +NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, struct samr_TestPrivateFunctionsUser *r); +NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, struct samr_GetUserPwInfo *r); +NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, struct samr_RemoveMemberFromForeignDomain *r); +NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, struct samr_QueryDomainInfo2 *r); +NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, struct samr_QueryUserInfo2 *r); +NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, struct samr_QueryDisplayInfo2 *r); +NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, struct samr_GetDisplayEnumerationIndex2 *r); +NTSTATUS _samr_CreateUser2(pipes_struct *p, struct samr_CreateUser2 *r); +NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, struct samr_QueryDisplayInfo3 *r); +NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, struct samr_AddMultipleMembersToAlias *r); +NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, struct samr_RemoveMultipleMembersFromAlias *r); +NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, struct samr_OemChangePasswordUser2 *r); +NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, struct samr_ChangePasswordUser2 *r); +NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, struct samr_GetDomPwInfo *r); +NTSTATUS _samr_Connect2(pipes_struct *p, struct samr_Connect2 *r); +NTSTATUS _samr_SetUserInfo2(pipes_struct *p, struct samr_SetUserInfo2 *r); +NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, struct samr_SetBootKeyInformation *r); +NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, struct samr_GetBootKeyInformation *r); +NTSTATUS _samr_Connect3(pipes_struct *p, struct samr_Connect3 *r); +NTSTATUS _samr_Connect4(pipes_struct *p, struct samr_Connect4 *r); +NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, struct samr_ChangePasswordUser3 *r); +NTSTATUS _samr_Connect5(pipes_struct *p, struct samr_Connect5 *r); +NTSTATUS _samr_RidToSid(pipes_struct *p, struct samr_RidToSid *r); +NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, struct samr_SetDsrmPassword *r); +NTSTATUS _samr_ValidatePassword(pipes_struct *p, struct samr_ValidatePassword *r); +void samr_get_pipe_fns(struct api_struct **fns, int *n_fns); +NTSTATUS rpc_samr_init(void); +#endif /* __SRV_SAMR__ */ -- cgit From 89759b1d03d735e00b80b186390c284eb3b95ff6 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:19:15 +0100 Subject: Add NETLOGON_GRACE_LOGON flag to netr_UserFlags. Guenther (This used to be commit 9097846466a8dea171f4d241661083f896591292) --- source3/librpc/idl/netlogon.idl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 87b1d5f90d..51efebd6ab 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -141,16 +141,17 @@ interface netlogon /* Flags for user_flags below */ typedef [public,bitmap32bit] bitmap { - NETLOGON_GUEST = 0x0001, - NETLOGON_NOENCRYPTION = 0x0002, - NETLOGON_CACHED_ACCOUNT = 0x0004, - NETLOGON_USED_LM_PASSWORD = 0x0008, - NETLOGON_EXTRA_SIDS = 0x0020, - NETLOGON_SUBAUTH_SESSION_KEY = 0x0040, - NETLOGON_SERVER_TRUST_ACCOUNT = 0x0080, - NETLOGON_NTLMV2_ENABLED = 0x0100, - NETLOGON_RESOURCE_GROUPS = 0x0200, - NETLOGON_PROFILE_PATH_RETURNED = 0x0400 + NETLOGON_GUEST = 0x00000001, + NETLOGON_NOENCRYPTION = 0x00000002, + NETLOGON_CACHED_ACCOUNT = 0x00000004, + NETLOGON_USED_LM_PASSWORD = 0x00000008, + NETLOGON_EXTRA_SIDS = 0x00000020, + NETLOGON_SUBAUTH_SESSION_KEY = 0x00000040, + NETLOGON_SERVER_TRUST_ACCOUNT = 0x00000080, + NETLOGON_NTLMV2_ENABLED = 0x00000100, + NETLOGON_RESOURCE_GROUPS = 0x00000200, + NETLOGON_PROFILE_PATH_RETURNED = 0x00000400, + NETLOGON_GRACE_LOGON = 0x01000000 } netr_UserFlags; typedef struct { -- cgit From a2b0e355e5cd8d0799ef77988e08ac7776e1cc92 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:20:50 +0100 Subject: Re-run make idl to regnerated netlogon. Guenther (This used to be commit 0230284cfa83477ad5a084a7970db1ea0cfe8563) --- source3/librpc/gen_ndr/ndr_netlogon.c | 1 + source3/librpc/gen_ndr/netlogon.h | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/source3/librpc/gen_ndr/ndr_netlogon.c b/source3/librpc/gen_ndr/ndr_netlogon.c index 1ceca9d8d4..8a5ac4726f 100644 --- a/source3/librpc/gen_ndr/ndr_netlogon.c +++ b/source3/librpc/gen_ndr/ndr_netlogon.c @@ -965,6 +965,7 @@ _PUBLIC_ void ndr_print_netr_UserFlags(struct ndr_print *ndr, const char *name, ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_NTLMV2_ENABLED", NETLOGON_NTLMV2_ENABLED, r); ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_RESOURCE_GROUPS", NETLOGON_RESOURCE_GROUPS, r); ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_PROFILE_PATH_RETURNED", NETLOGON_PROFILE_PATH_RETURNED, r); + ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NETLOGON_GRACE_LOGON", NETLOGON_GRACE_LOGON, r); ndr->depth--; } diff --git a/source3/librpc/gen_ndr/netlogon.h b/source3/librpc/gen_ndr/netlogon.h index 2ced17405d..1dcc363742 100644 --- a/source3/librpc/gen_ndr/netlogon.h +++ b/source3/librpc/gen_ndr/netlogon.h @@ -94,16 +94,17 @@ struct netr_LMSessionKey { }/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; /* bitmap netr_UserFlags */ -#define NETLOGON_GUEST ( 0x0001 ) -#define NETLOGON_NOENCRYPTION ( 0x0002 ) -#define NETLOGON_CACHED_ACCOUNT ( 0x0004 ) -#define NETLOGON_USED_LM_PASSWORD ( 0x0008 ) -#define NETLOGON_EXTRA_SIDS ( 0x0020 ) -#define NETLOGON_SUBAUTH_SESSION_KEY ( 0x0040 ) -#define NETLOGON_SERVER_TRUST_ACCOUNT ( 0x0080 ) -#define NETLOGON_NTLMV2_ENABLED ( 0x0100 ) -#define NETLOGON_RESOURCE_GROUPS ( 0x0200 ) -#define NETLOGON_PROFILE_PATH_RETURNED ( 0x0400 ) +#define NETLOGON_GUEST ( 0x00000001 ) +#define NETLOGON_NOENCRYPTION ( 0x00000002 ) +#define NETLOGON_CACHED_ACCOUNT ( 0x00000004 ) +#define NETLOGON_USED_LM_PASSWORD ( 0x00000008 ) +#define NETLOGON_EXTRA_SIDS ( 0x00000020 ) +#define NETLOGON_SUBAUTH_SESSION_KEY ( 0x00000040 ) +#define NETLOGON_SERVER_TRUST_ACCOUNT ( 0x00000080 ) +#define NETLOGON_NTLMV2_ENABLED ( 0x00000100 ) +#define NETLOGON_RESOURCE_GROUPS ( 0x00000200 ) +#define NETLOGON_PROFILE_PATH_RETURNED ( 0x00000400 ) +#define NETLOGON_GRACE_LOGON ( 0x01000000 ) ; -- cgit From a92eb76688600efbf4a4056c2543f348e2fee8aa Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:24:34 +0100 Subject: Finally enable pidl generated SAMR & NETLOGON headers and clients. Guenther (This used to be commit f7100156a7df7ac3ae84e45a47153b38d9375215) --- source3/Makefile.in | 4 +++ source3/include/rpc_dce.h | 5 ---- source3/include/rpc_netlogon.h | 53 +++----------------------------------- source3/include/rpc_samr.h | 12 --------- source3/include/smb.h | 27 ++----------------- source3/libads/authdata.c | 12 ++++----- source3/nsswitch/pam_winbind.c | 8 +++--- source3/nsswitch/pam_winbind.h | 23 +++++++++-------- source3/nsswitch/wbinfo.c | 4 +-- source3/rpc_parse/parse_net.c | 32 +++++++++++------------ source3/rpc_server/srv_netlog_nt.c | 2 +- source3/rpcclient/cmd_samr.c | 20 +++++++------- source3/smbd/chgpasswd.c | 12 ++++----- source3/winbindd/winbindd_creds.c | 2 +- source3/winbindd/winbindd_pam.c | 6 ++--- 15 files changed, 70 insertions(+), 152 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index dd49b9b33b..227650027a 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -273,6 +273,8 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \ librpc/gen_ndr/ndr_srvsvc.o \ librpc/gen_ndr/ndr_svcctl.o \ librpc/gen_ndr/ndr_eventlog.o \ + librpc/gen_ndr/ndr_netlogon.o \ + librpc/gen_ndr/ndr_samr.o \ librpc/gen_ndr/ndr_notify.o \ librpc/gen_ndr/ndr_libnet_join.o @@ -403,6 +405,8 @@ LIBMSRPC_GEN_OBJ = librpc/gen_ndr/cli_lsa.o \ librpc/gen_ndr/cli_initshutdown.o \ librpc/gen_ndr/cli_eventlog.o \ librpc/gen_ndr/cli_wkssvc.o \ + librpc/gen_ndr/cli_netlogon.o \ + librpc/gen_ndr/cli_samr.o \ $(LIBNDR_GEN_OBJ) \ $(RPCCLIENT_NDR_OBJ) diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 7ea3fcbc23..f162196524 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -98,11 +98,6 @@ enum RPC_PKT_TYPE { #define RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN 0x20 #define RPC_AUTH_SCHANNEL_SIGN_ONLY_CHK_LEN 0x18 - -#define NETLOGON_NEG_ARCFOUR 0x00000004 -#define NETLOGON_NEG_128BIT 0x00004000 -#define NETLOGON_NEG_SCHANNEL 0x40000000 - /* The 7 here seems to be required to get Win2k not to downgrade us to NT4. Actually, anything other than 1ff would seem to do... */ #define NETLOGON_NEG_AUTH2_FLAGS 0x000701ff diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index a82b977a5b..48a2a32bf6 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -45,11 +45,6 @@ #define NET_DSR_GETDCNAMEEX2 0x22 #define NET_SAMLOGON_EX 0x27 -/* Secure Channel types. used in NetrServerAuthenticate negotiation */ -#define SEC_CHAN_WKSTA 2 -#define SEC_CHAN_DOMAIN 4 -#define SEC_CHAN_BDC 6 - /* Returned delta types */ #define SAM_DELTA_DOMAIN_INFO 0x01 #define SAM_DELTA_GROUP_INFO 0x02 @@ -89,32 +84,15 @@ #define NL_CTRL_REPL_IN_PROGRESS 0x0002 #define NL_CTRL_FULL_SYNC 0x0004 -#define LOGON_GUEST 0x00000001 -#define LOGON_NOENCRYPTION 0x00000002 -#define LOGON_CACHED_ACCOUNT 0x00000004 -#define LOGON_USED_LM_PASSWORD 0x00000008 -#define LOGON_EXTRA_SIDS 0x00000020 -#define LOGON_SUBAUTH_SESSION_KEY 0x00000040 -#define LOGON_SERVER_TRUST_ACCOUNT 0x00000080 -#define LOGON_NTLMV2_ENABLED 0x00000100 -#define LOGON_RESOURCE_GROUPS 0x00000200 -#define LOGON_PROFILE_PATH_RETURNED 0x00000400 -#define LOGON_GRACE_LOGON 0x01000000 #define LOGON_KRB5_FAIL_CLOCK_SKEW 0x02000000 -#define SE_GROUP_MANDATORY 0x00000001 -#define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002 -#define SE_GROUP_ENABLED 0x00000004 -#define SE_GROUP_OWNER 0x00000008 -#define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010 -#define SE_GROUP_LOGON_ID 0xC0000000 -#define SE_GROUP_RESOURCE 0x20000000 /* Domain Local Group */ - /* Flags for controlling the behaviour of a particular logon */ -/* sets LOGON_SERVER_TRUST_ACCOUNT user_flag */ +/* sets NETLOGON_SERVER_TRUST_ACCOUNT user_flag */ +#if 0 #define MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT 0x00000020 #define MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT 0x00000800 +#endif /* updates the "logon time" on network logon */ #define MSV1_0_UPDATE_LOGON_STATISTICS 0x00000004 @@ -1054,31 +1032,6 @@ typedef struct net_r_sam_deltas_info { NTSTATUS status; } NET_R_SAM_DELTAS; -#define DS_FORCE_REDISCOVERY 0x00000001 -#define DS_DIRECTORY_SERVICE_REQUIRED 0x00000010 -#define DS_DIRECTORY_SERVICE_PREFERRED 0x00000020 -#define DS_GC_SERVER_REQUIRED 0x00000040 -#define DS_PDC_REQUIRED 0x00000080 -#define DS_BACKGROUND_ONLY 0x00000100 -#define DS_IP_REQUIRED 0x00000200 -#define DS_KDC_REQUIRED 0x00000400 -#define DS_TIMESERV_REQUIRED 0x00000800 -#define DS_WRITABLE_REQUIRED 0x00001000 -#define DS_GOOD_TIMESERV_PREFERRED 0x00002000 -#define DS_AVOID_SELF 0x00004000 -#define DS_ONLY_LDAP_NEEDED 0x00008000 - -#define DS_IS_FLAT_NAME 0x00010000 -#define DS_IS_DNS_NAME 0x00020000 - -#define DS_RETURN_DNS_NAME 0x40000000 -#define DS_RETURN_FLAT_NAME 0x80000000 - -#if 0 /* unknown yet */ -#define DS_IP_VERSION_AGNOSTIC -#define DS_TRY_NEXTCLOSEST_SITE -#endif - #define DSGETDC_VALID_FLAGS ( \ DS_FORCE_REDISCOVERY | \ DS_DIRECTORY_SERVICE_REQUIRED | \ diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 2273fba2e6..9274e37682 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -1832,13 +1832,6 @@ typedef struct q_samr_get_dom_pwinfo } SAMR_Q_GET_DOM_PWINFO; -#define DOMAIN_PASSWORD_COMPLEX 0x00000001 -#define DOMAIN_PASSWORD_NO_ANON_CHANGE 0x00000002 -#define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004 -#define DOMAIN_LOCKOUT_ADMINS 0x00000008 -#define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010 -#define DOMAIN_REFUSE_PASSWORD_CHANGE 0x00000020 - /* SAMR_R_GET_DOM_PWINFO */ typedef struct r_samr_get_dom_pwinfo { @@ -1915,11 +1908,6 @@ typedef struct q_samr_chgpasswd_user3 } SAMR_Q_CHGPASSWD_USER3; -#define REJECT_REASON_OTHER 0x00000000 -#define REJECT_REASON_TOO_SHORT 0x00000001 -#define REJECT_REASON_IN_HISTORY 0x00000002 -#define REJECT_REASON_NOT_COMPLEX 0x00000005 - /* SAMR_CHANGE_REJECT */ typedef struct samr_change_reject { diff --git a/source3/include/smb.h b/source3/include/smb.h index 350584a52e..d64b8ba80c 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -211,30 +211,6 @@ typedef uint32 codepoint_t; /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */ typedef uint64_t NTTIME; - -/* Allowable account control bits */ -#define ACB_DISABLED 0x00000001 /* 1 = User account disabled */ -#define ACB_HOMDIRREQ 0x00000002 /* 1 = Home directory required */ -#define ACB_PWNOTREQ 0x00000004 /* 1 = User password not required */ -#define ACB_TEMPDUP 0x00000008 /* 1 = Temporary duplicate account */ -#define ACB_NORMAL 0x00000010 /* 1 = Normal user account */ -#define ACB_MNS 0x00000020 /* 1 = MNS logon user account */ -#define ACB_DOMTRUST 0x00000040 /* 1 = Interdomain trust account */ -#define ACB_WSTRUST 0x00000080 /* 1 = Workstation trust account */ -#define ACB_SVRTRUST 0x00000100 /* 1 = Server trust account (BDC) */ -#define ACB_PWNOEXP 0x00000200 /* 1 = User password does not expire */ -#define ACB_AUTOLOCK 0x00000400 /* 1 = Account auto locked */ - -/* only valid for > Windows 2000 */ -#define ACB_ENC_TXT_PWD_ALLOWED 0x00000800 /* 1 = Text password encryped */ -#define ACB_SMARTCARD_REQUIRED 0x00001000 /* 1 = Smart Card required */ -#define ACB_TRUSTED_FOR_DELEGATION 0x00002000 /* 1 = Trusted for Delegation */ -#define ACB_NOT_DELEGATED 0x00004000 /* 1 = Not delegated */ -#define ACB_USE_DES_KEY_ONLY 0x00008000 /* 1 = Use DES key only */ -#define ACB_DONT_REQUIRE_PREAUTH 0x00010000 /* 1 = Preauth not required */ -#define ACB_PWEXPIRED 0x00020000 /* 1 = Password is expired */ -#define ACB_NO_AUTH_DATA_REQD 0x00080000 /* 1 = No authorization data required */ - #define MAX_HOURS_LEN 32 #ifndef MAXSUBAUTHS @@ -331,9 +307,10 @@ extern const DATA_BLOB data_blob_null; #include "librpc/gen_ndr/wkssvc.h" #include "librpc/gen_ndr/echo.h" #include "librpc/gen_ndr/svcctl.h" +#include "librpc/gen_ndr/netlogon.h" +#include "librpc/gen_ndr/samr.h" #include "librpc/gen_ndr/libnet_join.h" - struct lsa_dom_info { bool valid; DOM_SID sid; diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 9a6f1061df..644f8515bc 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -429,8 +429,8 @@ static bool pac_io_pac_logon_info(const char *desc, PAC_LOGON_INFO *info, if (info->info3.ptr_res_groups) { - if (!(info->info3.user_flgs & LOGON_RESOURCE_GROUPS)) { - DEBUG(0,("user_flgs attribute does not have LOGON_RESOURCE_GROUPS\n")); + if (!(info->info3.user_flgs & NETLOGON_RESOURCE_GROUPS)) { + DEBUG(0,("user_flgs attribute does not have NETLOGON_RESOURCE_GROUPS\n")); /* return False; */ } @@ -738,10 +738,10 @@ void dump_pac_logon_info(int lvl, PAC_LOGON_INFO *logon_info) DEBUG(lvl,("The PAC:\n")); DEBUGADD(lvl,("\tUser Flags: 0x%x (%d)\n", user_flgs, user_flgs)); - if (user_flgs & LOGON_EXTRA_SIDS) - DEBUGADD(lvl,("\tUser Flags: LOGON_EXTRA_SIDS 0x%x (%d)\n", LOGON_EXTRA_SIDS, LOGON_EXTRA_SIDS)); - if (user_flgs & LOGON_RESOURCE_GROUPS) - DEBUGADD(lvl,("\tUser Flags: LOGON_RESOURCE_GROUPS 0x%x (%d)\n", LOGON_RESOURCE_GROUPS, LOGON_RESOURCE_GROUPS)); + if (user_flgs & NETLOGON_EXTRA_SIDS) + DEBUGADD(lvl,("\tUser Flags: NETLOGON_EXTRA_SIDS 0x%x (%d)\n", NETLOGON_EXTRA_SIDS, NETLOGON_EXTRA_SIDS)); + if (user_flgs & NETLOGON_RESOURCE_GROUPS) + DEBUGADD(lvl,("\tUser Flags: NETLOGON_RESOURCE_GROUPS 0x%x (%d)\n", NETLOGON_RESOURCE_GROUPS, NETLOGON_RESOURCE_GROUPS)); DEBUGADD(lvl,("\tUser SID: %s-%d\n", sid_string_dbg(&dom_sid), logon_info->info3.user_rid)); DEBUGADD(lvl,("\tGroup SID: %s-%d\n", sid_string_dbg(&dom_sid), diff --git a/source3/nsswitch/pam_winbind.c b/source3/nsswitch/pam_winbind.c index 4d019072ac..89db0773ae 100644 --- a/source3/nsswitch/pam_winbind.c +++ b/source3/nsswitch/pam_winbind.c @@ -1431,22 +1431,22 @@ static int winbind_chauthtok_request(pam_handle_t * pamh, switch (reject_reason) { case -1: break; - case REJECT_REASON_OTHER: + case SAMR_REJECT_OTHER: if ((min_pwd_age > 0) && (pwd_last_set + min_pwd_age > time(NULL))) { PAM_WB_REMARK_DIRECT(pamh, ctrl, "NT_STATUS_PWD_TOO_RECENT"); } break; - case REJECT_REASON_TOO_SHORT: + case SAMR_REJECT_TOO_SHORT: PAM_WB_REMARK_DIRECT(pamh, ctrl, "NT_STATUS_PWD_TOO_SHORT"); break; - case REJECT_REASON_IN_HISTORY: + case SAMR_REJECT_IN_HISTORY: PAM_WB_REMARK_DIRECT(pamh, ctrl, "NT_STATUS_PWD_HISTORY_CONFLICT"); break; - case REJECT_REASON_NOT_COMPLEX: + case SAMR_REJECT_COMPLEXITY: _make_remark(pamh, ctrl, PAM_ERROR_MSG, "Password does not meet " "complexity requirements"); diff --git a/source3/nsswitch/pam_winbind.h b/source3/nsswitch/pam_winbind.h index 59a2f39584..6ec564fe71 100644 --- a/source3/nsswitch/pam_winbind.h +++ b/source3/nsswitch/pam_winbind.h @@ -179,22 +179,23 @@ do { \ };\ }; -/* from include/rpc_samr.h */ -#define DOMAIN_PASSWORD_COMPLEX 0x00000001 +/* from samr.idl */ +#define DOMAIN_PASSWORD_COMPLEX 0x00000001 -#define REJECT_REASON_OTHER 0x00000000 -#define REJECT_REASON_TOO_SHORT 0x00000001 -#define REJECT_REASON_IN_HISTORY 0x00000002 -#define REJECT_REASON_NOT_COMPLEX 0x00000005 +#define SAMR_REJECT_OTHER 0x00000000 +#define SAMR_REJECT_TOO_SHORT 0x00000001 +#define SAMR_REJECT_IN_HISTORY 0x00000002 +#define SAMR_REJECT_COMPLEXITY 0x00000005 -/* from include/smb.h */ #define ACB_PWNOEXP 0x00000200 +/* from netlogon.idl */ +#define NETLOGON_CACHED_ACCOUNT 0x00000004 +#define NETLOGON_GRACE_LOGON 0x01000000 + /* from include/rpc_netlogon.h */ -#define LOGON_CACHED_ACCOUNT 0x00000004 -#define LOGON_GRACE_LOGON 0x01000000 #define LOGON_KRB5_FAIL_CLOCK_SKEW 0x02000000 -#define PAM_WB_CACHED_LOGON(x) (x & LOGON_CACHED_ACCOUNT) +#define PAM_WB_CACHED_LOGON(x) (x & NETLOGON_CACHED_ACCOUNT) #define PAM_WB_KRB5_CLOCK_SKEW(x) (x & LOGON_KRB5_FAIL_CLOCK_SKEW) -#define PAM_WB_GRACE_LOGON(x) ((LOGON_CACHED_ACCOUNT|LOGON_GRACE_LOGON) == ( x & (LOGON_CACHED_ACCOUNT|LOGON_GRACE_LOGON))) +#define PAM_WB_GRACE_LOGON(x) ((NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON) == ( x & (NETLOGON_CACHED_ACCOUNT|NETLOGON_GRACE_LOGON))) diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index c8f8398c6f..3410668fcd 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -843,8 +843,8 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags) if (result == NSS_STATUS_SUCCESS) { if (request.flags & WBFLAG_PAM_INFO3_TEXT) { - if (response.data.auth.info3.user_flgs & LOGON_CACHED_ACCOUNT) { - d_printf("user_flgs: LOGON_CACHED_ACCOUNT\n"); + if (response.data.auth.info3.user_flgs & NETLOGON_CACHED_ACCOUNT) { + d_printf("user_flgs: NETLOGON_CACHED_ACCOUNT\n"); } } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 65607a4ac8..b8c6479fb8 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1656,8 +1656,8 @@ static void dump_acct_flags(uint32 acct_flags) { if (acct_flags & ACB_NO_AUTH_DATA_REQD) { DEBUGADD(lvl,("\taccount has ACB_NO_AUTH_DATA_REQD set\n")); } - if (acct_flags & ACB_PWEXPIRED) { - DEBUGADD(lvl,("\taccount has ACB_PWEXPIRED set\n")); + if (acct_flags & ACB_PW_EXPIRED) { + DEBUGADD(lvl,("\taccount has ACB_PW_EXPIRED set\n")); } } @@ -1665,23 +1665,23 @@ static void dump_user_flgs(uint32 user_flags) { int lvl = 10; DEBUG(lvl,("dump_user_flgs\n")); - if (user_flags & LOGON_EXTRA_SIDS) { - DEBUGADD(lvl,("\taccount has LOGON_EXTRA_SIDS\n")); + if (user_flags & NETLOGON_EXTRA_SIDS) { + DEBUGADD(lvl,("\taccount has NETLOGON_EXTRA_SIDS\n")); } - if (user_flags & LOGON_RESOURCE_GROUPS) { - DEBUGADD(lvl,("\taccount has LOGON_RESOURCE_GROUPS\n")); + if (user_flags & NETLOGON_RESOURCE_GROUPS) { + DEBUGADD(lvl,("\taccount has NETLOGON_RESOURCE_GROUPS\n")); } - if (user_flags & LOGON_NTLMV2_ENABLED) { - DEBUGADD(lvl,("\taccount has LOGON_NTLMV2_ENABLED\n")); + if (user_flags & NETLOGON_NTLMV2_ENABLED) { + DEBUGADD(lvl,("\taccount has NETLOGON_NTLMV2_ENABLED\n")); } - if (user_flags & LOGON_CACHED_ACCOUNT) { - DEBUGADD(lvl,("\taccount has LOGON_CACHED_ACCOUNT\n")); + if (user_flags & NETLOGON_CACHED_ACCOUNT) { + DEBUGADD(lvl,("\taccount has NETLOGON_CACHED_ACCOUNT\n")); } - if (user_flags & LOGON_PROFILE_PATH_RETURNED) { - DEBUGADD(lvl,("\taccount has LOGON_PROFILE_PATH_RETURNED\n")); + if (user_flags & NETLOGON_PROFILE_PATH_RETURNED) { + DEBUGADD(lvl,("\taccount has NETLOGON_PROFILE_PATH_RETURNED\n")); } - if (user_flags & LOGON_SERVER_TRUST_ACCOUNT) { - DEBUGADD(lvl,("\taccount has LOGON_SERVER_TRUST_ACCOUNT\n")); + if (user_flags & NETLOGON_SERVER_TRUST_ACCOUNT) { + DEBUGADD(lvl,("\taccount has NETLOGON_SERVER_TRUST_ACCOUNT\n")); } @@ -1859,8 +1859,8 @@ bool net_io_user_info3(const char *desc, NET_USER_INFO_3 *usr, prs_struct *ps, uint32 num_other_sids = usr->num_other_sids; - if (!(usr->user_flgs & LOGON_EXTRA_SIDS)) { - DEBUG(10,("net_io_user_info3: user_flgs attribute does not have LOGON_EXTRA_SIDS\n")); + if (!(usr->user_flgs & NETLOGON_EXTRA_SIDS)) { + DEBUG(10,("net_io_user_info3: user_flgs attribute does not have NETLOGON_EXTRA_SIDS\n")); /* return False; */ } diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 218ce73444..904ee17f51 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -1062,7 +1062,7 @@ static NTSTATUS _net_sam_logon_internal(pipes_struct *p, 0, /* bad_pw_count */ num_gids, /* uint32 num_groups */ gids , /* DOM_GID *gids */ - LOGON_EXTRA_SIDS, /* uint32 user_flgs (?) */ + NETLOGON_EXTRA_SIDS, /* uint32 user_flgs (?) */ pdb_get_acct_ctrl(sampw), server_info->user_session_key.length ? user_session_key : NULL, server_info->lm_session_key.length ? lm_session_key : NULL, diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index 15e180df01..171027fa49 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -135,8 +135,8 @@ static void display_password_properties(uint32 password_properties) if (password_properties & DOMAIN_PASSWORD_NO_CLEAR_CHANGE) printf("\tDOMAIN_PASSWORD_NO_CLEAR_CHANGE\n"); - if (password_properties & DOMAIN_LOCKOUT_ADMINS) - printf("\tDOMAIN_LOCKOUT_ADMINS\n"); + if (password_properties & DOMAIN_PASSWORD_LOCKOUT_ADMINS) + printf("\tDOMAIN_PASSWORD_LOCKOUT_ADMINS\n"); if (password_properties & DOMAIN_PASSWORD_STORE_CLEARTEXT) printf("\tDOMAIN_PASSWORD_STORE_CLEARTEXT\n"); @@ -2228,17 +2228,17 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli, display_sam_unk_info_1(&info); switch (reject.reject_reason) { - case REJECT_REASON_TOO_SHORT: - d_printf("REJECT_REASON_TOO_SHORT\n"); + case SAMR_REJECT_TOO_SHORT: + d_printf("SAMR_REJECT_TOO_SHORT\n"); break; - case REJECT_REASON_IN_HISTORY: - d_printf("REJECT_REASON_IN_HISTORY\n"); + case SAMR_REJECT_IN_HISTORY: + d_printf("SAMR_REJECT_IN_HISTORY\n"); break; - case REJECT_REASON_NOT_COMPLEX: - d_printf("REJECT_REASON_NOT_COMPLEX\n"); + case SAMR_REJECT_COMPLEXITY: + d_printf("SAMR_REJECT_COMPLEXITY\n"); break; - case REJECT_REASON_OTHER: - d_printf("REJECT_REASON_OTHER\n"); + case SAMR_REJECT_OTHER: + d_printf("SAMR_REJECT_OTHER\n"); break; default: d_printf("unknown reject reason: %d\n", reject.reject_reason); diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index fb228f9e2a..668c8e2095 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -1092,7 +1092,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw if (!pdb_get_pass_can_change(hnd)) { DEBUG(1, ("user %s does not have permissions to change password\n", username)); if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_OTHER; + *samr_reject_reason = SAMR_REJECT_OTHER; } return NT_STATUS_ACCOUNT_RESTRICTION; } @@ -1106,7 +1106,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw "denied by Refuse Machine Password Change policy\n", username)); if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_OTHER; + *samr_reject_reason = SAMR_REJECT_OTHER; } return NT_STATUS_ACCOUNT_RESTRICTION; } @@ -1119,7 +1119,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw "wait until %s\n", username, http_timestring(can_change_time))); if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_OTHER; + *samr_reject_reason = SAMR_REJECT_OTHER; } return NT_STATUS_ACCOUNT_RESTRICTION; } @@ -1129,7 +1129,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw username)); DEBUGADD(1, (" account policy min password len = %d\n", min_len)); if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_TOO_SHORT; + *samr_reject_reason = SAMR_REJECT_TOO_SHORT; } return NT_STATUS_PASSWORD_RESTRICTION; /* return NT_STATUS_PWD_TOO_SHORT; */ @@ -1137,7 +1137,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw if (check_passwd_history(hnd,new_passwd)) { if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_IN_HISTORY; + *samr_reject_reason = SAMR_REJECT_IN_HISTORY; } return NT_STATUS_PASSWORD_RESTRICTION; } @@ -1158,7 +1158,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw if (check_ret != 0) { DEBUG(1, ("change_oem_password: check password script said new password is not good enough!\n")); if (samr_reject_reason) { - *samr_reject_reason = REJECT_REASON_NOT_COMPLEX; + *samr_reject_reason = SAMR_REJECT_COMPLEXITY; } TALLOC_FREE(pass); return NT_STATUS_PASSWORD_RESTRICTION; diff --git a/source3/winbindd/winbindd_creds.c b/source3/winbindd/winbindd_creds.c index 62facb6769..4dbace5bcc 100644 --- a/source3/winbindd/winbindd_creds.c +++ b/source3/winbindd/winbindd_creds.c @@ -69,7 +69,7 @@ NTSTATUS winbindd_store_creds(struct winbindd_domain *domain, sid_copy(&sid, &(info3->dom_sid.sid)); sid_append_rid(&sid, info3->user_rid); sid_copy(&cred_sid, &sid); - info3->user_flgs |= LOGON_CACHED_ACCOUNT; + info3->user_flgs |= NETLOGON_CACHED_ACCOUNT; } else if (user_sid != NULL) { diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index 525096b0a2..0c75cb17a9 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -923,7 +923,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain, /* User *DOES* know the password, update logon_time and reset * bad_pw_count */ - my_info3->user_flgs |= LOGON_CACHED_ACCOUNT; + my_info3->user_flgs |= NETLOGON_CACHED_ACCOUNT; if (my_info3->acct_flags & ACB_AUTOLOCK) { return NT_STATUS_ACCOUNT_LOCKED_OUT; @@ -959,7 +959,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain, must_change_time = nt_time_to_unix(my_info3->pass_must_change_time); if (must_change_time != 0 && must_change_time < time(NULL)) { /* we allow grace logons when the password has expired */ - my_info3->user_flgs |= LOGON_GRACE_LOGON; + my_info3->user_flgs |= NETLOGON_GRACE_LOGON; /* return NT_STATUS_PASSWORD_EXPIRED; */ goto success; } @@ -1075,7 +1075,7 @@ NTSTATUS winbindd_dual_pam_auth_cached(struct winbindd_domain *domain, } if ((my_info3->user_rid != DOMAIN_USER_RID_ADMIN) || - (password_properties & DOMAIN_LOCKOUT_ADMINS)) { + (password_properties & DOMAIN_PASSWORD_LOCKOUT_ADMINS)) { my_info3->acct_flags |= ACB_AUTOLOCK; } } -- cgit From 10a55fb4ea8cbfec5b58fb00389ff4d48e4e527e Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:35:55 +0100 Subject: Include auto-generated client headers for netlogon/samr. Guenther (This used to be commit ad8f6933322e7175b74cc3de525fda58ae150baa) --- source3/include/rpc_client.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 66c4f58987..01e2a8421b 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -31,6 +31,8 @@ #include "librpc/gen_ndr/cli_initshutdown.h" #include "librpc/gen_ndr/cli_winreg.h" #include "librpc/gen_ndr/cli_srvsvc.h" +#include "librpc/gen_ndr/cli_samr.h" +#include "librpc/gen_ndr/cli_netlogon.h" /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ -- cgit From d1abd4d866b59fa67605fc469d6406a981455fbe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 17 Jan 2008 10:39:15 +0100 Subject: Use new pidl-generated netlogon client calls in NetApi GetDcName(). Guenther (This used to be commit 733e07a06ce3c903ff5837df6a5119f6d6e3eccb) --- source3/lib/netapi/examples/getdc/getdc.c | 4 +-- source3/lib/netapi/getdc.c | 42 +++++-------------------------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/source3/lib/netapi/examples/getdc/getdc.c b/source3/lib/netapi/examples/getdc/getdc.c index cdd4d0b3b4..272ba1088e 100644 --- a/source3/lib/netapi/examples/getdc/getdc.c +++ b/source3/lib/netapi/examples/getdc/getdc.c @@ -29,7 +29,7 @@ int main(int argc, char **argv) { NET_API_STATUS status; struct libnetapi_ctx *ctx = NULL; - uint8_t *buffer; + uint8_t *buffer = NULL; if (argc < 3) { printf("usage: getdc \n"); @@ -50,7 +50,7 @@ int main(int argc, char **argv) } else { printf("%s\n", (char *)buffer); } - + NetApiBufferFree(buffer); libnetapi_free(ctx); return status; diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c index 85a0ae52ef..484af04a55 100644 --- a/source3/lib/netapi/getdc.c +++ b/source3/lib/netapi/getdc.c @@ -22,22 +22,6 @@ #include "lib/netapi/netapi.h" #include "libnet/libnet.h" -#if 0 -#include "librpc/gen_ndr/cli_netlogon.h" -#endif - -NTSTATUS rpccli_netr_GetDcName(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *logon_server, - const char *domainname, - const char **dcname); -NTSTATUS rpccli_netr_GetAnyDCName(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - const char *logon_server, - const char *domainname, - const char **dcname, - WERROR *werror); - static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -76,17 +60,11 @@ static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx, goto done; }; -#if 0 - werr = rpccli_netr_GetDcName(pipe_cli, ctx, - server_name, - domain_name, - (const char **)&buffer); -#else - werr = rpccli_netlogon_getdcname(pipe_cli, ctx, - server_name, - domain_name, - (char **)buffer); -#endif + status = rpccli_netr_GetDcName(pipe_cli, ctx, + server_name, + domain_name, + (const char **)buffer); + werr = ntstatus_to_werror(status); done: if (cli) { cli_shutdown(cli); @@ -175,22 +153,14 @@ static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx, goto done; }; -#if 0 status = rpccli_netr_GetAnyDCName(pipe_cli, ctx, server_name, domain_name, - (const char **)&buffer, + (const char **)buffer, &werr); if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); goto done; } -#else - werr = rpccli_netlogon_getanydcname(pipe_cli, ctx, - server_name, - domain_name, - (char **)buffer); -#endif done: if (cli) { cli_shutdown(cli); -- cgit From 9e3634fb63f6dec1a3c820a462b5f732e7d09206 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 17 Jan 2008 17:17:52 +0100 Subject: Fix two uninitialized variables in vfs_hpuxacl.c Thanks to David Leonard , this fixes bug 5208. Volker (This used to be commit a3b36c3cb0fe5f3e78c200290afa59829934f496) --- source3/modules/vfs_hpuxacl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_hpuxacl.c b/source3/modules/vfs_hpuxacl.c index e101886450..f9293405fb 100644 --- a/source3/modules/vfs_hpuxacl.c +++ b/source3/modules/vfs_hpuxacl.c @@ -140,7 +140,7 @@ SMB_ACL_T hpuxacl_sys_acl_get_file(vfs_handle_struct *handle, { SMB_ACL_T result = NULL; int count; - HPUX_ACL_T hpux_acl; + HPUX_ACL_T hpux_acl = NULL; DEBUG(10, ("hpuxacl_sys_acl_get_file called for file '%s'.\n", path_p)); @@ -213,7 +213,7 @@ int hpuxacl_sys_acl_set_file(vfs_handle_struct *handle, { int ret = -1; SMB_STRUCT_STAT s; - HPUX_ACL_T hpux_acl; + HPUX_ACL_T hpux_acl = NULL; int count; DEBUG(10, ("hpuxacl_sys_acl_set_file called for file '%s'\n", -- cgit From 76b5c674e70dff0d37409e64d53cda41ef9731a6 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 17 Jan 2008 11:46:41 -0500 Subject: Add a program to test repeated calls to smbc_getxattr(). (This used to be commit f5f46de404dba2e4a03d205a62cd5cf7ea4e075a) --- examples/libsmbclient/Makefile | 5 ++++ examples/libsmbclient/testacl3.c | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 examples/libsmbclient/testacl3.c diff --git a/examples/libsmbclient/Makefile b/examples/libsmbclient/Makefile index 9657957c4e..6c70659661 100644 --- a/examples/libsmbclient/Makefile +++ b/examples/libsmbclient/Makefile @@ -18,6 +18,7 @@ LIBSMBCLIENT = -lwbclient -lsmbclient -ldl -lresolv TESTS= testsmbc \ testacl \ testacl2 \ + testacl3 \ testbrowse \ testbrowse2 \ teststat \ @@ -48,6 +49,10 @@ testacl2: testacl2.o @echo Linking testacl2 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt +testacl3: testacl3.o + @echo Linking testacl3 + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt + testbrowse: testbrowse.o @echo Linking testbrowse $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBSMBCLIENT) -lpopt diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c new file mode 100644 index 0000000000..9102405659 --- /dev/null +++ b/examples/libsmbclient/testacl3.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include +#include +#include "get_auth_data_fn.h" + + +int main(int argc, char * argv[]) +{ + int i; + int fd; + int ret; + int debug = 0; + int mode = 0666; + int savedErrno; + char value[2048]; + char path[2048]; + char * the_acl; + char * p; + time_t t0; + time_t t1; + struct stat st; + SMBCCTX * context; + + smbc_init(get_auth_data_fn, debug); + + context = smbc_set_context(NULL); + smbc_option_set(context, "full_time_names", 1); + + for (;;) + { + fprintf(stdout, "Path: "); + *path = '\0'; + fgets(path, sizeof(path) - 1, stdin); + if (strlen(path) == 0) + { + return 0; + } + + p = path + strlen(path) - 1; + if (*p == '\n') + { + *p = '\0'; + } + + the_acl = strdup("system.nt_sec_desc.*+"); + ret = smbc_getxattr(path, the_acl, value, sizeof(value)); + if (ret < 0) + { + printf("Could not get attributes for [%s] %d: %s\n", + path, errno, strerror(errno)); + return 1; + } + + printf("Attributes for [%s] are:\n%s\n", path, value); + } + + return 0; +} -- cgit From 4f09727df8502c3a66cbf0cb423da1067d215c90 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 17 Jan 2008 11:49:17 -0500 Subject: Fix bug 5185: repeated calls to smbc_getxattr() lose sid-name mapping If we're going to cache connections to IPC$, we'd better also cache the policy handle and not use a stack-based handle that's invalid on subsequent calls. Derrell (This used to be commit 67c415661f6466c21cd0eaafabe58cba049d2af3) --- source3/include/libsmb_internal.h | 1 + source3/libsmb/libsmbclient.c | 83 +++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h index dbc115429b..6c7dc80da8 100644 --- a/source3/include/libsmb_internal.h +++ b/source3/include/libsmb_internal.h @@ -15,6 +15,7 @@ struct _SMBCSRV { bool no_pathinfo; bool no_pathinfo2; bool no_nt_session; + POLICY_HND pol; SMBCSRV *next, *prev; diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 077970647d..2fd8294d04 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1037,8 +1037,7 @@ smbc_attr_server(TALLOC_CTX *ctx, const char *share, char **pp_workgroup, char **pp_username, - char **pp_password, - POLICY_HND *pol) + char **pp_password) { int flags; struct sockaddr_storage ss; @@ -1122,36 +1121,34 @@ smbc_attr_server(TALLOC_CTX *ctx, ZERO_STRUCTP(ipc_srv); ipc_srv->cli = ipc_cli; - if (pol) { - pipe_hnd = cli_rpc_pipe_open_noauth(ipc_srv->cli, - PI_LSARPC, - &nt_status); - if (!pipe_hnd) { - DEBUG(1, ("cli_nt_session_open fail!\n")); - errno = ENOTSUP; - cli_shutdown(ipc_srv->cli); - free(ipc_srv); - return NULL; - } - - /* - * Some systems don't support - * SEC_RIGHTS_MAXIMUM_ALLOWED, but NT sends 0x2000000 - * so we might as well do it too. - */ + pipe_hnd = cli_rpc_pipe_open_noauth(ipc_srv->cli, + PI_LSARPC, + &nt_status); + if (!pipe_hnd) { + DEBUG(1, ("cli_nt_session_open fail!\n")); + errno = ENOTSUP; + cli_shutdown(ipc_srv->cli); + free(ipc_srv); + return NULL; + } - nt_status = rpccli_lsa_open_policy( - pipe_hnd, - talloc_tos(), - True, - GENERIC_EXECUTE_ACCESS, - pol); + /* + * Some systems don't support + * SEC_RIGHTS_MAXIMUM_ALLOWED, but NT sends 0x2000000 + * so we might as well do it too. + */ - if (!NT_STATUS_IS_OK(nt_status)) { - errno = smbc_errno(context, ipc_srv->cli); - cli_shutdown(ipc_srv->cli); - return NULL; - } + nt_status = rpccli_lsa_open_policy( + pipe_hnd, + talloc_tos(), + True, + GENERIC_EXECUTE_ACCESS, + &ipc_srv->pol); + + if (!NT_STATUS_IS_OK(nt_status)) { + errno = smbc_errno(context, ipc_srv->cli); + cli_shutdown(ipc_srv->cli); + return NULL; } /* now add it to the cache (internal or external) */ @@ -5728,7 +5725,6 @@ smbc_setxattr_ctx(SMBCCTX *context, char *password = NULL; char *workgroup = NULL; char *path = NULL; - POLICY_HND pol; DOS_ATTR_DESC *dad = NULL; struct { const char * create_time_attr; @@ -5787,8 +5783,7 @@ smbc_setxattr_ctx(SMBCCTX *context, if (! srv->no_nt_session) { ipc_srv = smbc_attr_server(frame, context, server, share, - &workgroup, &user, &password, - &pol); + &workgroup, &user, &password); if (! ipc_srv) { srv->no_nt_session = True; } @@ -5814,7 +5809,7 @@ smbc_setxattr_ctx(SMBCCTX *context, if (ipc_srv) { ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, namevalue, (*namevalue == '*' ? SMBC_XATTR_MODE_SET @@ -5878,7 +5873,7 @@ smbc_setxattr_ctx(SMBCCTX *context, ret = -1; } else { ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, namevalue, (*namevalue == '*' ? SMBC_XATTR_MODE_SET @@ -5908,7 +5903,7 @@ smbc_setxattr_ctx(SMBCCTX *context, ret = -1; } else { ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, namevalue, SMBC_XATTR_MODE_CHOWN, 0); } TALLOC_FREE(frame); @@ -5935,7 +5930,7 @@ smbc_setxattr_ctx(SMBCCTX *context, ret = -1; } else { ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, namevalue, SMBC_XATTR_MODE_CHOWN, 0); } TALLOC_FREE(frame); @@ -6026,7 +6021,6 @@ smbc_getxattr_ctx(SMBCCTX *context, char *password = NULL; char *workgroup = NULL; char *path = NULL; - POLICY_HND pol; struct { const char * create_time_attr; const char * access_time_attr; @@ -6083,8 +6077,7 @@ smbc_getxattr_ctx(SMBCCTX *context, if (! srv->no_nt_session) { ipc_srv = smbc_attr_server(frame, context, server, share, - &workgroup, &user, &password, - &pol); + &workgroup, &user, &password); if (! ipc_srv) { srv->no_nt_session = True; } @@ -6137,7 +6130,7 @@ smbc_getxattr_ctx(SMBCCTX *context, /* Yup. */ ret = cacl_get(context, talloc_tos(), srv, ipc_srv == NULL ? NULL : ipc_srv->cli, - &pol, path, + &ipc_srv->pol, path, CONST_DISCARD(char *, name), CONST_DISCARD(char *, value), size); if (ret < 0 && errno == 0) { @@ -6168,7 +6161,6 @@ smbc_removexattr_ctx(SMBCCTX *context, char *password = NULL; char *workgroup = NULL; char *path = NULL; - POLICY_HND pol; TALLOC_CTX *frame = talloc_stackframe(); if (!context || !context->internal || @@ -6219,8 +6211,7 @@ smbc_removexattr_ctx(SMBCCTX *context, if (! srv->no_nt_session) { ipc_srv = smbc_attr_server(frame, context, server, share, - &workgroup, &user, &password, - &pol); + &workgroup, &user, &password); if (! ipc_srv) { srv->no_nt_session = True; } @@ -6239,7 +6230,7 @@ smbc_removexattr_ctx(SMBCCTX *context, /* Yup. */ ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, NULL, SMBC_XATTR_MODE_REMOVE_ALL, 0); TALLOC_FREE(frame); return ret; @@ -6259,7 +6250,7 @@ smbc_removexattr_ctx(SMBCCTX *context, /* Yup. */ ret = cacl_set(talloc_tos(), srv->cli, - ipc_srv->cli, &pol, path, + ipc_srv->cli, &ipc_srv->pol, path, name + 19, SMBC_XATTR_MODE_REMOVE, 0); TALLOC_FREE(frame); return ret; -- cgit From 46080b0f4eea6285a8f2009e8ab6cf58623c1f6f Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 17 Jan 2008 11:50:22 -0500 Subject: stop bothering me about example programs not checked in (This used to be commit 41ad5c7700c5ef3839c0629ee5eb42ec0fe61da6) --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index f11de08838..b445ccfca6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.o *.po *~ +source/TAGS source/client/client_proto.h source/libnet/libnet_proto.h source/include/build_env.h @@ -45,3 +46,18 @@ examples/VFS/module_config.h.in examples/VFS/shadow_copy_test.so examples/VFS/skel_opaque.so examples/VFS/skel_transparent.so +examples/libsmbclient/smbwrapper/smbsh +examples/libsmbclient/smbwrapper/smbwrapper.so +examples/libsmbclient/testacl +examples/libsmbclient/testacl2 +examples/libsmbclient/testacl3 +examples/libsmbclient/testbrowse +examples/libsmbclient/testbrowse2 +examples/libsmbclient/testchmod +examples/libsmbclient/testread +examples/libsmbclient/testsmbc +examples/libsmbclient/teststat +examples/libsmbclient/teststat2 +examples/libsmbclient/teststat3 +examples/libsmbclient/testutime +examples/libsmbclient/testwrite -- cgit From 80d7cccfe7d6179da75c00481f2116dae6755682 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 01:04:40 +0100 Subject: Add and correct some WERROR codes. Michael (This used to be commit 7aec862ddc2aa2b5152c3a452971e55ba43646a5) --- source3/include/doserr.h | 7 ++++++- source3/libsmb/doserr.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/source3/include/doserr.h b/source3/include/doserr.h index 08f5b3e39d..546d06926a 100644 --- a/source3/include/doserr.h +++ b/source3/include/doserr.h @@ -213,12 +213,17 @@ #define WERR_SERVER_UNAVAILABLE W_ERROR(1722) #define WERR_INVALID_FORM_NAME W_ERROR(1902) #define WERR_INVALID_FORM_SIZE W_ERROR(1903) +#define WERR_PASSWORD_MUST_CHANGE W_ERROR(1907) +#define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(1908) +#define WERR_ACCOUNT_LOCKED_OUT W_ERROR(1909) + +/* should these go down to NERR_BASE ? */ #define WERR_BUF_TOO_SMALL W_ERROR(2123) #define WERR_JOB_NOT_FOUND W_ERROR(2151) #define WERR_DEST_NOT_FOUND W_ERROR(2152) #define WERR_USER_EXISTS W_ERROR(2224) #define WERR_NOT_LOCAL_DOMAIN W_ERROR(2320) -#define WERR_DOMAIN_CONTROLLER_NOT_FOUND W_ERROR(2453) +#define WERR_DC_NOT_FOUND W_ERROR(2453) #define WERR_SETUP_ALREADY_JOINED W_ERROR(2691) #define WERR_SETUP_NOT_JOINED W_ERROR(2692) diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c index 79445a2410..174db312c8 100644 --- a/source3/libsmb/doserr.c +++ b/source3/libsmb/doserr.c @@ -74,7 +74,7 @@ werror_code_struct dos_errs[] = { "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR }, { "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT }, { "WERR_MACHINE_LOCKED", WERR_MACHINE_LOCKED }, - { "WERR_DOMAIN_CONTROLLER_NOT_FOUND", WERR_DOMAIN_CONTROLLER_NOT_FOUND }, + { "WERR_DC_NOT_FOUND", WERR_DC_NOT_FOUND }, { "WERR_SETUP_NOT_JOINED", WERR_SETUP_NOT_JOINED }, { "WERR_SETUP_ALREADY_JOINED", WERR_SETUP_ALREADY_JOINED }, { "WERR_SETUP_DOMAIN_CONTROLLER", WERR_SETUP_DOMAIN_CONTROLLER }, @@ -96,6 +96,9 @@ werror_code_struct dos_errs[] = { "WERR_SERVICE_DISABLED", WERR_SERVICE_DISABLED }, { "WERR_CAN_NOT_COMPLETE", WERR_CAN_NOT_COMPLETE}, { "WERR_INVALID_FLAGS", WERR_INVALID_FLAGS}, + { "WERR_PASSWORD_MUST_CHANGE", WERR_PASSWORD_MUST_CHANGE }, + { "WERR_DOMAIN_CONTROLLER_NOT_FOUND", WERR_DOMAIN_CONTROLLER_NOT_FOUND }, + { "WERR_ACCOUNT_LOCKED_OUT", WERR_ACCOUNT_LOCKED_OUT }, { NULL, W_ERROR(0) } }; @@ -109,11 +112,14 @@ werror_str_struct dos_err_strs[] = { { WERR_NO_LOGON_SERVERS, "No logon servers found" }, { WERR_NO_SUCH_LOGON_SESSION, "No such logon session" }, { WERR_DOMAIN_CONTROLLER_NOT_FOUND, "A domain controller could not be found" }, + { WERR_DC_NOT_FOUND, "A domain controller could not be found" }, { WERR_SETUP_NOT_JOINED, "Join failed" }, { WERR_SETUP_ALREADY_JOINED, "Machine is already joined" }, { WERR_SETUP_DOMAIN_CONTROLLER, "Machine is a Domain Controller" }, { WERR_LOGON_FAILURE, "Invalid logon credentials" }, { WERR_USER_EXISTS, "User account already exists" }, + { WERR_PASSWORD_MUST_CHANGE, "The password must be changed" }, + { WERR_ACCOUNT_LOCKED_OUT, "Account locked out" }, }; /***************************************************************************** -- cgit From c2ff6c94f2f9ddc2c4b03f7907f7d6e0de951c24 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 01:56:01 +0100 Subject: Improve libnetapi_set_error_string(). Guenther (This used to be commit 96f645553ae5c75aabfe588e1a67f3d4bfacb5cb) --- source3/lib/netapi/netapi.c | 11 ++++++++--- source3/lib/netapi/netapi.h | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index ce00054e6e..5c3f7ec465 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -205,15 +205,20 @@ const char *libnetapi_errstr(NET_API_STATUS status) ****************************************************************/ NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, - const char *error_string) + const char *format, ...) { + va_list args; + TALLOC_FREE(ctx->error_string); - ctx->error_string = talloc_strdup(ctx, error_string); + + va_start(args, format); + ctx->error_string = talloc_vasprintf(ctx, format, args); + va_end(args); + if (!ctx->error_string) { return W_ERROR_V(WERR_NOMEM); } return NET_API_STATUS_SUCCESS; - } /**************************************************************** diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 274a167d53..67bb8a8fca 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -57,46 +57,73 @@ NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *use NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password); NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup); const char *libnetapi_errstr(NET_API_STATUS status); -NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string); +NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...); const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx, NET_API_STATUS status); /**************************************************************** + NetApiBufferFree ****************************************************************/ NET_API_STATUS NetApiBufferFree(void *buffer); /**************************************************************** + NetJoinDomain ****************************************************************/ -/* wkssvc */ NET_API_STATUS NetJoinDomain(const char *server, const char *domain, const char *account_ou, const char *account, const char *password, uint32_t join_options); + +/**************************************************************** + NetUnjoinDomain +****************************************************************/ + NET_API_STATUS NetUnjoinDomain(const char *server_name, const char *account, const char *password, uint32_t unjoin_flags); + +/**************************************************************** + NetGetJoinInformation +****************************************************************/ + NET_API_STATUS NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type); -/* srvsvc */ +/**************************************************************** + NetServerGetInfo +****************************************************************/ + NET_API_STATUS NetServerGetInfo(const char *server_name, uint32_t level, uint8_t **buffer); + +/**************************************************************** + NetServerSetInfo +****************************************************************/ + NET_API_STATUS NetServerSetInfo(const char *server_name, uint32_t level, uint8_t *buffer, uint32_t *parm_error); -/* netlogon */ +/**************************************************************** + NetGetDCName +****************************************************************/ + NET_API_STATUS NetGetDCName(const char *server_name, const char *domain_name, uint8_t **buffer); + +/**************************************************************** + NetGetAnyDCName +****************************************************************/ + NET_API_STATUS NetGetAnyDCName(const char *server_name, const char *domain_name, uint8_t **buffer); -- cgit From bb97b272a975e4af7738c58e7af4b8e3047d4b77 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 02:30:09 +0100 Subject: Fix local hostname detection in netdomjoin-gui. Guenther (This used to be commit 30458116b389889cad845eb96b54c3edc833e722) --- .../examples/netdomjoin-gui/netdomjoin-gui.c | 37 ++++++++++++++++------ 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 9dc2a18138..6e958b4c73 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1263,28 +1264,44 @@ static int initialize_join_state(struct join_state *state, { char my_hostname[HOST_NAME_MAX]; const char *p = NULL; + struct hostent *hp = NULL; + if (gethostname(my_hostname, sizeof(my_hostname)) == -1) { return -1; } - state->my_fqdn = strdup(my_hostname); + p = strchr(my_hostname, '.'); + if (p) { + my_hostname[strlen(my_hostname)-strlen(p)] = '\0'; + } + state->my_hostname = strdup(my_hostname); + if (!state->my_hostname) { + return -1; + } + debug("state->my_hostname: %s\n", state->my_hostname); + + hp = gethostbyname(my_hostname); + if (!hp || !hp->h_name || !*hp->h_name) { + return -1; + } + + state->my_fqdn = strdup(hp->h_name); if (!state->my_fqdn) { return -1; } + debug("state->my_fqdn: %s\n", state->my_fqdn); - p = strchr(my_hostname, '.'); + p = strchr(state->my_fqdn, '.'); if (p) { - my_hostname[strlen(my_hostname) - strlen(p)] = '\0'; - state->my_hostname = strdup(my_hostname); - if (!state->my_hostname) { - return -1; - } p++; state->my_dnsdomain = strdup(p); - if (!state->my_dnsdomain) { - return -1; - } + } else { + state->my_dnsdomain = strdup(""); + } + if (!state->my_dnsdomain) { + return -1; } + debug("state->my_dnsdomain: %s\n", state->my_dnsdomain); } { -- cgit From cfb7e254662dd957da7e193010f87544b96c2f17 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 02:30:53 +0100 Subject: Add some more debugging into netdomjoin-gui. Guenther (This used to be commit d4c5b323229c6f43c824e3559084c98e370730a5) --- source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c index 6e958b4c73..73b14d4d87 100644 --- a/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c +++ b/source3/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c @@ -440,7 +440,7 @@ static void callback_do_join(GtkWidget *widget, state->password, unjoin_flags); if (status != 0) { - err_str = libnetapi_errstr(status); + err_str = libnetapi_get_error_string(state->ctx, status); g_print("callback_do_join: failed to unjoin (%s)\n", err_str); @@ -464,7 +464,7 @@ static void callback_do_join(GtkWidget *widget, state->password, join_flags); if (status != 0) { - err_str = libnetapi_errstr(status); + err_str = libnetapi_get_error_string(state->ctx, status); g_print("callback_do_join: failed to join (%s)\n", err_str); dialog = gtk_message_dialog_new(GTK_WINDOW(state->window_parent), @@ -1308,9 +1308,12 @@ static int initialize_join_state(struct join_state *state, const char *buffer = NULL; uint16_t type = 0; status = NetGetJoinInformation(NULL, &buffer, &type); - if (status) { + if (status != 0) { + printf("NetGetJoinInformation failed with: %s\n", + libnetapi_get_error_string(state->ctx, status)); return status; } + debug("NetGetJoinInformation gave: %s and %d\n", buffer, type); state->name_buffer_initial = strdup(buffer); if (!state->name_buffer_initial) { return -1; @@ -1324,7 +1327,9 @@ static int initialize_join_state(struct join_state *state, uint8_t *buffer = NULL; status = NetServerGetInfo(NULL, 1005, &buffer); - if (status) { + if (status != 0) { + printf("NetServerGetInfo failed with: %s\n", + libnetapi_get_error_string(state->ctx, status)); return status; } -- cgit From b1424846c60848d685853fcf632ab766543e05ee Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 02:38:35 +0100 Subject: Cosmetics and error string reporting for libnetapi. Guenther (This used to be commit 4ca33928512bd71268bafd41d2b608e814a7295f) --- source3/lib/netapi/getdc.c | 30 ++++++++++++++++++++-- source3/lib/netapi/joindomain.c | 57 ++++++++++++++++++++++++++++++++++++----- source3/lib/netapi/serverinfo.c | 43 +++++++++++++++++++++++++------ 3 files changed, 114 insertions(+), 16 deletions(-) diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c index 484af04a55..1084ddc3c8 100644 --- a/source3/lib/netapi/getdc.c +++ b/source3/lib/netapi/getdc.c @@ -22,6 +22,9 @@ #include "lib/netapi/netapi.h" #include "libnet/libnet.h" +/******************************************************************** +********************************************************************/ + static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -30,6 +33,9 @@ static WERROR NetGetDCNameLocal(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } +/******************************************************************** +********************************************************************/ + static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -73,6 +79,9 @@ static WERROR NetGetDCNameRemote(struct libnetapi_ctx *ctx, return werr; } +/******************************************************************** +********************************************************************/ + static WERROR libnetapi_NetGetDCName(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -91,6 +100,10 @@ static WERROR libnetapi_NetGetDCName(struct libnetapi_ctx *ctx, buffer); } +/**************************************************************** + NetGetDCName +****************************************************************/ + NET_API_STATUS NetGetDCName(const char *server_name, const char *domain_name, uint8_t **buffer) @@ -112,9 +125,12 @@ NET_API_STATUS NetGetDCName(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } +/******************************************************************** +********************************************************************/ + static WERROR NetGetAnyDCNameLocal(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -123,6 +139,9 @@ static WERROR NetGetAnyDCNameLocal(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } +/******************************************************************** +********************************************************************/ + static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -170,6 +189,9 @@ static WERROR NetGetAnyDCNameRemote(struct libnetapi_ctx *ctx, } +/******************************************************************** +********************************************************************/ + static WERROR libnetapi_NetGetAnyDCName(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -188,6 +210,10 @@ static WERROR libnetapi_NetGetAnyDCName(struct libnetapi_ctx *ctx, buffer); } +/**************************************************************** + NetGetAnyDCName +****************************************************************/ + NET_API_STATUS NetGetAnyDCName(const char *server_name, const char *domain_name, uint8_t **buffer) @@ -209,5 +235,5 @@ NET_API_STATUS NetGetAnyDCName(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index b268e41a2a..43662b3ffa 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -22,6 +22,9 @@ #include "lib/netapi/netapi.h" #include "libnet/libnet.h" +/**************************************************************** +****************************************************************/ + static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, const char *server_name, const char *domain_name, @@ -52,6 +55,8 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, NULL, flags, &info); if (!NT_STATUS_IS_OK(status)) { + libnetapi_set_error_string(mem_ctx, + "%s", get_friendly_nt_error_msg(status)); return ntstatus_to_werror(status); } r->in.dc_name = talloc_strdup(mem_ctx, @@ -79,13 +84,16 @@ static WERROR NetJoinDomainLocal(struct libnetapi_ctx *mem_ctx, werr = libnet_Join(mem_ctx, r); if (!W_ERROR_IS_OK(werr) && r->out.error_string) { - libnetapi_set_error_string(mem_ctx, r->out.error_string); + libnetapi_set_error_string(mem_ctx, "%s", r->out.error_string); } TALLOC_FREE(r); return werr; } +/**************************************************************** +****************************************************************/ + static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -149,6 +157,9 @@ static WERROR NetJoinDomainRemote(struct libnetapi_ctx *ctx, return werr; } +/**************************************************************** +****************************************************************/ + static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx, const char *server_name, const char *domain_name, @@ -181,6 +192,10 @@ static WERROR libnetapi_NetJoinDomain(struct libnetapi_ctx *ctx, join_flags); } +/**************************************************************** + NetJoinDomain +****************************************************************/ + NET_API_STATUS NetJoinDomain(const char *server_name, const char *domain_name, const char *account_ou, @@ -208,9 +223,12 @@ NET_API_STATUS NetJoinDomain(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, const char *server_name, const char *account, @@ -232,7 +250,6 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, r->in.dc_name = talloc_strdup(mem_ctx, server_name); W_ERROR_HAVE_NO_MEMORY(r->in.dc_name); } else { - NTSTATUS status; const char *domain = NULL; struct DS_DOMAIN_CONTROLLER_INFO *info = NULL; @@ -247,6 +264,8 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, status = dsgetdcname(mem_ctx, NULL, domain, NULL, NULL, flags, &info); if (!NT_STATUS_IS_OK(status)) { + libnetapi_set_error_string(mem_ctx, + "%s", get_friendly_nt_error_msg(status)); return ntstatus_to_werror(status); } r->in.dc_name = talloc_strdup(mem_ctx, @@ -266,13 +285,22 @@ static WERROR NetUnjoinDomainLocal(struct libnetapi_ctx *mem_ctx, r->in.unjoin_flags = unjoin_flags; r->in.modify_config = true; + r->in.debug = true; r->in.domain_sid = &domain_sid; - return libnet_Unjoin(mem_ctx, r); + werr = libnet_Unjoin(mem_ctx, r); + if (!W_ERROR_IS_OK(werr) && r->out.error_string) { + libnetapi_set_error_string(mem_ctx, "%s", r->out.error_string); + } + TALLOC_FREE(r); + return werr; } +/**************************************************************** +****************************************************************/ + static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, const char *server_name, const char *account, @@ -335,6 +363,9 @@ static WERROR NetUnjoinDomainRemote(struct libnetapi_ctx *ctx, return werr; } +/**************************************************************** +****************************************************************/ + static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, const char *server_name, const char *account, @@ -357,6 +388,10 @@ static WERROR libnetapi_NetUnjoinDomain(struct libnetapi_ctx *ctx, unjoin_flags); } +/**************************************************************** + NetUnjoinDomain +****************************************************************/ + NET_API_STATUS NetUnjoinDomain(const char *server_name, const char *account, const char *password, @@ -380,9 +415,12 @@ NET_API_STATUS NetUnjoinDomain(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + static WERROR NetGetJoinInformationRemote(struct libnetapi_ctx *ctx, const char *server_name, const char **name_buffer, @@ -431,6 +469,9 @@ static WERROR NetGetJoinInformationRemote(struct libnetapi_ctx *ctx, return werr; } +/**************************************************************** +****************************************************************/ + static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx, const char *server_name, const char **name_buffer, @@ -478,6 +519,10 @@ static WERROR libnetapi_NetGetJoinInformation(struct libnetapi_ctx *ctx, name_type); } +/**************************************************************** + NetGetJoinInformation +****************************************************************/ + NET_API_STATUS NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type) @@ -499,5 +544,5 @@ NET_API_STATUS NetGetJoinInformation(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 6cd074615b..7fa166e411 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -22,6 +22,9 @@ #include "lib/netapi/netapi.h" #include "libnet/libnet.h" +/**************************************************************** +****************************************************************/ + static WERROR NetServerGetInfoLocal_1005(struct libnetapi_ctx *ctx, uint8_t **buffer) { @@ -36,6 +39,9 @@ static WERROR NetServerGetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_OK; } +/**************************************************************** +****************************************************************/ + static WERROR NetServerGetInfoLocal(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -51,6 +57,9 @@ static WERROR NetServerGetInfoLocal(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } +/**************************************************************** +****************************************************************/ + static WERROR NetServerGetInfoRemote(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -102,6 +111,9 @@ static WERROR NetServerGetInfoRemote(struct libnetapi_ctx *ctx, return werr; } +/**************************************************************** +****************************************************************/ + static WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -121,6 +133,10 @@ static WERROR libnetapi_NetServerGetInfo(struct libnetapi_ctx *ctx, } +/**************************************************************** + NetServerGetInfo +****************************************************************/ + NET_API_STATUS NetServerGetInfo(const char *server_name, uint32_t level, uint8_t **buffer) @@ -142,17 +158,18 @@ NET_API_STATUS NetServerGetInfo(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } +/**************************************************************** +****************************************************************/ + static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, uint8_t *buffer, uint32_t *parm_error) { WERROR werr; struct libnet_conf_ctx *conf_ctx; - TALLOC_CTX *mem_ctx; - struct srvsvc_NetSrvInfo1005 *info1005; if (!buffer) { @@ -171,8 +188,7 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, return WERR_NOT_SUPPORTED; } - mem_ctx = talloc_stackframe(); - werr = libnet_conf_open(mem_ctx, &conf_ctx); + werr = libnet_conf_open(ctx, &conf_ctx); if (!W_ERROR_IS_OK(werr)) { goto done; } @@ -181,12 +197,14 @@ static WERROR NetServerSetInfoLocal_1005(struct libnetapi_ctx *ctx, "server string", info1005->comment); -done: + done: libnet_conf_close(conf_ctx); - TALLOC_FREE(mem_ctx); return werr; } +/**************************************************************** +****************************************************************/ + static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -203,6 +221,9 @@ static WERROR NetServerSetInfoLocal(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } +/**************************************************************** +****************************************************************/ + static WERROR NetServerSetInfoRemote(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -263,6 +284,9 @@ static WERROR NetServerSetInfoRemote(struct libnetapi_ctx *ctx, return werr; } +/**************************************************************** +****************************************************************/ + static WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx, const char *server_name, uint32_t level, @@ -284,6 +308,9 @@ static WERROR libnetapi_NetServerSetInfo(struct libnetapi_ctx *ctx, parm_error); } +/**************************************************************** + NetServerSetInfo +****************************************************************/ NET_API_STATUS NetServerSetInfo(const char *server_name, uint32_t level, @@ -308,5 +335,5 @@ NET_API_STATUS NetServerSetInfo(const char *server_name, return W_ERROR_V(werr); } - return 0; + return NET_API_STATUS_SUCCESS; } -- cgit From b18fd380bd142933b7c1a341629aac61c8799d22 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 02:50:33 +0100 Subject: Add NetGetJoinableOUs() to libnetapi (incl. example). Guenther (This used to be commit 8858e403e1940c362d307b4d4125f977abb0b96a) --- source3/lib/netapi/examples/Makefile.in | 16 +- .../examples/getjoinableous/getjoinableous.c | 104 +++++++++++ source3/lib/netapi/joindomain.c | 192 +++++++++++++++++++++ 3 files changed, 309 insertions(+), 3 deletions(-) create mode 100644 source3/lib/netapi/examples/getjoinableous/getjoinableous.c diff --git a/source3/lib/netapi/examples/Makefile.in b/source3/lib/netapi/examples/Makefile.in index c2f453dedc..86e1b1bc2f 100644 --- a/source3/lib/netapi/examples/Makefile.in +++ b/source3/lib/netapi/examples/Makefile.in @@ -5,7 +5,7 @@ KRB5LIBS=@KRB5_LIBS@ LDAP_LIBS=@LDAP_LIBS@ LIBS=@LIBS@ -lnetapi DEVELOPER_CFLAGS=@DEVELOPER_CFLAGS@ -FLAGS=@CFLAGS@ $(GTK_FLAGS) +FLAGS=-I../ -L../../../bin @CFLAGS@ $(GTK_FLAGS) CC=@CC@ LDFLAGS=@PIE_LDFLAGS@ @LDFLAGS@ DYNEXP=@DYNEXP@ @@ -36,8 +36,12 @@ MAKEDIR = || exec false; \ GETDC_OBJ = getdc/getdc.o NETDOMJOIN_OBJ = netdomjoin/netdomjoin.o NETDOMJOIN_GUI_OBJ = netdomjoin-gui/netdomjoin-gui.o +GETJOINABLEOUS_OBJ = getjoinableous/getjoinableous.o -PROGS = bin/getdc@EXEEXT@ bin/netdomjoin@EXEEXT@ bin/netdomjoin-gui@EXEEXT@ +PROGS = bin/getdc@EXEEXT@ \ + bin/netdomjoin@EXEEXT@ \ + bin/netdomjoin-gui@EXEEXT@ \ + bin/getjoinableous@EXEEXT@ all: $(PROGS) @@ -45,6 +49,10 @@ bin/getdc@EXEEXT@: $(GETDC_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(GETDC_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) +bin/getjoinableous@EXEEXT@: $(GETJOINABLEOUS_OBJ) + @echo Linking $@ + @$(CC) $(FLAGS) -o $@ $(GETJOINABLEOUS_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) + bin/netdomjoin@EXEEXT@: $(NETDOMJOIN_OBJ) @echo Linking $@ @$(CC) $(FLAGS) -o $@ $(NETDOMJOIN_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) @@ -54,4 +62,6 @@ bin/netdomjoin-gui@EXEEXT@: $(NETDOMJOIN_GUI_OBJ) @$(CC) $(FLAGS) $(GTK_FLAGS) -o $@ $(NETDOMJOIN_GUI_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) $(KRB5LIBS) $(LDAP_LIBS) $(GTK_LIBS) clean: - @rm -f $(PROGS) + -rm -f $(PROGS) + -rm -f core */*~ *~ \ + */*.o */*/*.o */*/*/*.o \ diff --git a/source3/lib/netapi/examples/getjoinableous/getjoinableous.c b/source3/lib/netapi/examples/getjoinableous/getjoinableous.c new file mode 100644 index 0000000000..5a3366c9dc --- /dev/null +++ b/source3/lib/netapi/examples/getjoinableous/getjoinableous.c @@ -0,0 +1,104 @@ +/* + * Unix SMB/CIFS implementation. + * Join Support (cmdline + netapi) + * Copyright (C) Guenther Deschner 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include +#include + +#include + +char *get_string_param(const char *param) +{ + char *p; + + p = strchr(param, '='); + if (!p) { + return NULL; + } + + return (p+1); +} + +int main(int argc, char **argv) +{ + NET_API_STATUS status; + const char *server_name = NULL; + const char *domain_name = NULL; + const char *account = NULL; + const char *password = NULL; + const char **ous = NULL; + uint32_t num_ous = 0; + struct libnetapi_ctx *ctx = NULL; + int i; + + status = libnetapi_init(&ctx); + if (status != 0) { + return status; + } + + if (argc < 2) { + printf("usage: getjoinableous\n"); + printf("\t [domain=DOMAIN] \n"); + return 0; + } + + if (argc > 2) { + server_name = argv[1]; + } + + for (i=0; idomain_controller_name); + if (!ads) { + return WERR_GENERAL_FAILURE; + } + + SAFE_FREE(ads->auth.user_name); + if (account) { + ads->auth.user_name = SMB_STRDUP(account); + } else if (ctx->username) { + ads->auth.user_name = SMB_STRDUP(ctx->username); + } + + SAFE_FREE(ads->auth.password); + if (password) { + ads->auth.password = SMB_STRDUP(password); + } else if (ctx->password) { + ads->auth.password = SMB_STRDUP(ctx->password); + } + + ads_status = ads_connect(ads); + if (!ADS_ERR_OK(ads_status)) { + ads_destroy(&ads); + return WERR_DEFAULT_JOIN_REQUIRED; + } + + ads_status = ads_get_joinable_ous(ads, ctx, + (char ***)ous, + (size_t *)ou_count); + if (!ADS_ERR_OK(ads_status)) { + ads_destroy(&ads); + return WERR_DEFAULT_JOIN_REQUIRED; + } + + ads_destroy(&ads); + return WERR_OK; +} + +/**************************************************************** +****************************************************************/ + +static WERROR NetGetJoinableOUsRemote(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain, + const char *account, + const char *password, + uint32_t *ou_count, + const char ***ous) +{ + struct cli_state *cli = NULL; + struct rpc_pipe_client *pipe_cli = NULL; + struct wkssvc_PasswordBuffer *encrypted_password = NULL; + NTSTATUS status; + WERROR werr; + + status = cli_full_connection(&cli, NULL, server_name, + NULL, 0, + "IPC$", "IPC", + ctx->username, + ctx->workgroup, + ctx->password, + 0, Undefined, NULL); + + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + pipe_cli = cli_rpc_pipe_open_noauth(cli, PI_WKSSVC, + &status); + if (!pipe_cli) { + werr = ntstatus_to_werror(status); + goto done; + } + + if (password) { + encode_wkssvc_join_password_buffer(ctx, + password, + &cli->user_session_key, + &encrypted_password); + } + + status = rpccli_wkssvc_NetrGetJoinableOus2(pipe_cli, ctx, + server_name, + domain, + account, + encrypted_password, + ou_count, + ous, + &werr); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + done: + if (cli) { + cli_shutdown(cli); + } + + return werr; +} + +/**************************************************************** +****************************************************************/ + +static WERROR libnetapi_NetGetJoinableOUs(struct libnetapi_ctx *ctx, + const char *server_name, + const char *domain, + const char *account, + const char *password, + uint32_t *ou_count, + const char ***ous) +{ + if (!server_name || is_myname_or_ipaddr(server_name)) { + return NetGetJoinableOUsLocal(ctx, + server_name, + domain, + account, + password, + ou_count, + ous); + } + + return NetGetJoinableOUsRemote(ctx, + server_name, + domain, + account, + password, + ou_count, + ous); +} + +/**************************************************************** + NetGetJoinableOUs +****************************************************************/ + +NET_API_STATUS NetGetJoinableOUs(const char *server_name, + const char *domain, + const char *account, + const char *password, + uint32_t *ou_count, + const char ***ous) +{ + struct libnetapi_ctx *ctx = NULL; + NET_API_STATUS status; + WERROR werr; + + status = libnetapi_getctx(&ctx); + if (status != 0) { + return status; + } + + werr = libnetapi_NetGetJoinableOUs(ctx, + server_name, + domain, + account, + password, + ou_count, + ous); + if (!W_ERROR_IS_OK(werr)) { + return W_ERROR_V(werr); + } + + return NET_API_STATUS_SUCCESS; +} -- cgit From 313a21b4d946550426705c70231c59d8bc4005f1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Jan 2008 15:46:15 +1100 Subject: merged changes from v4-0-test (This used to be commit 8c89d60924b0380231da834cd3c097b4f8cdc369) --- source3/lib/tdb/common/freelist.c | 85 ++++++++++++++++++------------------ source3/lib/tdb/common/tdb_private.h | 1 - 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/source3/lib/tdb/common/freelist.c b/source3/lib/tdb/common/freelist.c index c086c151fa..2f2a4c379b 100644 --- a/source3/lib/tdb/common/freelist.c +++ b/source3/lib/tdb/common/freelist.c @@ -208,62 +208,61 @@ update: } + /* the core of tdb_allocate - called when we have decided which free list entry to use + + Note that we try to allocate by grabbing data from the end of an existing record, + not the beginning. This is so the left merge in a free is more likely to be + able to free up the record without fragmentation */ -static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr, - struct list_struct *rec, tdb_off_t last_ptr) +static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, + tdb_len_t length, tdb_off_t rec_ptr, + struct list_struct *rec, tdb_off_t last_ptr) { - struct list_struct newrec; - tdb_off_t newrec_ptr; +#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8) - memset(&newrec, '\0', sizeof(newrec)); + if (rec->rec_len < length + MIN_REC_SIZE) { + /* we have to grab the whole record */ - /* found it - now possibly split it up */ - if (rec->rec_len > length + MIN_REC_SIZE) { - /* Length of left piece */ - length = TDB_ALIGN(length, TDB_ALIGNMENT); - - /* Right piece to go on free list */ - newrec.rec_len = rec->rec_len - (sizeof(*rec) + length); - newrec_ptr = rec_ptr + sizeof(*rec) + length; - - /* And left record is shortened */ - rec->rec_len = length; - } else { - newrec_ptr = 0; + /* unlink it from the previous record */ + if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) { + return 0; + } + + /* mark it not free */ + rec->magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; + } + return rec_ptr; + } + + /* we're going to just shorten the existing record */ + rec->rec_len -= (length + sizeof(*rec)); + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; } - - /* Remove allocated record from the free list */ - if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) { + if (update_tailer(tdb, rec_ptr, rec) == -1) { return 0; } - - /* Update header: do this before we drop alloc - lock, otherwise tdb_free() might try to - merge with us, thinking we're free. - (Thanks Jeremy Allison). */ + + /* and setup the new record */ + rec_ptr += sizeof(*rec) + rec->rec_len; + + memset(rec, '\0', sizeof(*rec)); + rec->rec_len = length; rec->magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { return 0; } - - /* Did we create new block? */ - if (newrec_ptr) { - /* Update allocated record tailer (we - shortened it). */ - if (update_tailer(tdb, rec_ptr, rec) == -1) { - return 0; - } - - /* Free new record */ - if (tdb_free(tdb, newrec_ptr, &newrec) == -1) { - return 0; - } + + if (update_tailer(tdb, rec_ptr, rec) == -1) { + return 0; } - - /* all done - return the new record offset */ + return rec_ptr; } @@ -287,6 +286,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st /* Extra bytes required for tailer */ length += sizeof(tdb_off_t); + length = TDB_ALIGN(length, TDB_ALIGNMENT); again: last_ptr = FREELIST_TOP; @@ -343,7 +343,8 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st goto fail; } - newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr); + newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, + rec, bestfit.last_ptr); tdb_unlock(tdb, -1, F_WRLCK); return newrec_ptr; } diff --git a/source3/lib/tdb/common/tdb_private.h b/source3/lib/tdb/common/tdb_private.h index dd69903015..ffac89ff0e 100644 --- a/source3/lib/tdb/common/tdb_private.h +++ b/source3/lib/tdb/common/tdb_private.h @@ -49,7 +49,6 @@ typedef uint32_t tdb_off_t; #define TDB_DEAD_MAGIC (0xFEE1DEAD) #define TDB_RECOVERY_MAGIC (0xf53bc0e7U) #define TDB_ALIGNMENT 4 -#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT) #define DEFAULT_HASH_SIZE 131 #define FREELIST_TOP (sizeof(struct tdb_header)) #define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1)) -- cgit From 9dd8940e5f4d89da67b66fb1932a95cc6fda63a5 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 03:14:08 +0100 Subject: Add header for NetGetJoinableOUs to libnetapi. Guenther (This used to be commit f297ea259d58f7a12924b7111ab79818188cff46) --- source3/lib/netapi/netapi.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index 67bb8a8fca..c2f1b488db 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -95,6 +95,17 @@ NET_API_STATUS NetGetJoinInformation(const char *server_name, const char **name_buffer, uint16_t *name_type); +/**************************************************************** + NetGetJoinableOUs +****************************************************************/ + +NET_API_STATUS NetGetJoinableOUs(const char *server_name, + const char *domain, + const char *account, + const char *password, + uint32_t *ou_count, + const char ***ous); + /**************************************************************** NetServerGetInfo ****************************************************************/ -- cgit From db40120c73f4d4cbb132f94cd3c5859fbdad0f5a Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 18 Jan 2008 08:48:44 +0100 Subject: Fix the build w/o ADS. Guenther (This used to be commit 645f2376d40fabdc787902ac7506ad7234616619) --- source3/lib/netapi/joindomain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index cbfc6c01e3..133aff3dd8 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -558,6 +558,7 @@ static WERROR NetGetJoinableOUsLocal(struct libnetapi_ctx *ctx, uint32_t *ou_count, const char ***ous) { +#ifdef WITH_ADS NTSTATUS status; ADS_STATUS ads_status; ADS_STRUCT *ads = NULL; @@ -608,6 +609,9 @@ static WERROR NetGetJoinableOUsLocal(struct libnetapi_ctx *ctx, ads_destroy(&ads); return WERR_OK; +#else + return WERR_NOT_SUPPORTED; +#endif } /**************************************************************** -- cgit From 1ea809383ef310f442bae7b5d4591f9aa655ad60 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 08:15:27 +0100 Subject: Fix typo in debug message. Michael (This used to be commit d7a8d7ffbd724a59aa3fc4bdeca6be5d5a0e7258) --- source3/registry/reg_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 18435ff033..788af28d5d 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -183,7 +183,7 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx, /* Look up the table of registry I/O operations */ if ( !(key->hook = reghook_cache_find( key->name )) ) { - DEBUG(0,("reg_open_onelevel: Failed to assigned a " + DEBUG(0,("reg_open_onelevel: Failed to assign a " "REGISTRY_HOOK to [%s]\n", key->name )); result = WERR_BADFILE; goto done; -- cgit From 60fbc7e4f03bff29ad548c1e8640e6fde23ace2a Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 09:40:42 +0100 Subject: Add a registry backend netlogon_params that replaces the former dynamic overlay. This is the first step in replacing the dynamic overlays by proper backends implementing REGISTRY_OPS. Michael (This used to be commit e8a0524961d81fa83e0316905dc9d215e4aa7656) --- source3/Makefile.in | 1 + source3/include/reg_objects.h | 1 + source3/registry/reg_backend_netlogon_params.c | 58 ++++++++++++++++++++++++++ source3/registry/reg_dynamic.c | 4 ++ source3/registry/reg_frontend.c | 2 + 5 files changed, 66 insertions(+) create mode 100644 source3/registry/reg_backend_netlogon_params.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 227650027a..45aa4cbc37 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -417,6 +417,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_util.o registry/reg_dynamic.o registry/reg_perfcount.o \ registry/reg_smbconf.o registry/reg_api.o \ registry/reg_frontend_hilvl.o \ + registry/reg_backend_netlogon_params.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index 23a14e6757..3b846db681 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -100,6 +100,7 @@ typedef struct { #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" +#define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" #define KEY_TREE_ROOT "" /* diff --git a/source3/registry/reg_backend_netlogon_params.c b/source3/registry/reg_backend_netlogon_params.c new file mode 100644 index 0000000000..b70e1bdf50 --- /dev/null +++ b/source3/registry/reg_backend_netlogon_params.c @@ -0,0 +1,58 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * Netlogon parameters registry backend. + * + * This replaces the former dynamic netlogon parameters overlay. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + + +static int netlogon_params_fetch_reg_values(const char *key, + REGVAL_CTR *regvals) +{ + uint32 dwValue; + + if ( !pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue) ) + dwValue = 0; + + regval_ctr_addvalue( regvals, "RefusePasswordChange", REG_DWORD, + (char*)&dwValue, sizeof(dwValue) ); + + return regval_ctr_numvals( regvals ); +} + + +REGISTRY_OPS netlogon_params_reg_ops = { + NULL, + netlogon_params_fetch_reg_values, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL +}; diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index e70bd178f9..07c9673c28 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -29,6 +29,7 @@ struct reg_dyn_values { int (*fetch_values) ( REGVAL_CTR *val ); }; +#if 0 /*********************************************************************** ***********************************************************************/ @@ -44,6 +45,7 @@ static int netlogon_params( REGVAL_CTR *regvals ) return regval_ctr_numvals( regvals ); } +#endif /*********************************************************************** ***********************************************************************/ @@ -200,7 +202,9 @@ static int current_version( REGVAL_CTR *values ) ***********************************************************************/ static struct reg_dyn_values dynamic_values[] = { +#if 0 { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/NETLOGON/PARAMETERS", &netlogon_params }, +#endif { "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRODUCTOPTIONS", &prod_options }, { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS", &tcpip_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 9e84d3a8c4..6674b0ba20 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -28,6 +28,7 @@ extern REGISTRY_OPS printing_ops; extern REGISTRY_OPS eventlog_ops; extern REGISTRY_OPS shares_reg_ops; extern REGISTRY_OPS smbconf_reg_ops; +extern REGISTRY_OPS netlogon_params_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -40,6 +41,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_PRINTING_PORTS, &printing_ops }, { KEY_SHARES, &shares_reg_ops }, { KEY_SMBCONF, &smbconf_reg_ops }, + { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops }, #endif { NULL, NULL } }; -- cgit From 3d3d6e7020749c63455e16ba110bc46862d3c146 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 18 Jan 2008 11:08:17 +0100 Subject: Add the "allinfo" command to smbclient Modeled after the Samba4 allinfo command (This used to be commit 3fa0cf3fe5f819f6e76df6f7cef3bb4e1c307a52) --- source3/client/client.c | 88 ++++++++++++++++++++++++++++++++ source3/include/smb.h | 10 ++++ source3/libsmb/clirap.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 229 insertions(+) diff --git a/source3/client/client.c b/source3/client/client.c index 267c13048e..59ca2e0adc 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1527,6 +1527,92 @@ static int cmd_altname(void) return 0; } +/**************************************************************************** + Show all info we can get +****************************************************************************/ + +static int do_allinfo(const char *name) +{ + fstring altname; + struct timespec b_time, a_time, m_time, c_time; + SMB_OFF_T size; + uint16_t mode; + SMB_INO_T ino; + NTTIME tmp; + unsigned int num_streams; + struct stream_struct *streams; + unsigned int i; + + if (!NT_STATUS_IS_OK(cli_qpathinfo_alt_name(cli, name, altname))) { + d_printf("%s getting alt name for %s\n", + cli_errstr(cli),name); + return false; + } + d_printf("altname: %s\n", altname); + + if (!cli_qpathinfo2(cli, name, &b_time, &a_time, &m_time, &c_time, + &size, &mode, &ino)) { + d_printf("%s getting pathinfo for %s\n", + cli_errstr(cli),name); + return false; + } + + unix_timespec_to_nt_time(&tmp, b_time); + d_printf("create_time: %s\n", nt_time_string(talloc_tos(), tmp)); + + unix_timespec_to_nt_time(&tmp, a_time); + d_printf("access_time: %s\n", nt_time_string(talloc_tos(), tmp)); + + unix_timespec_to_nt_time(&tmp, m_time); + d_printf("write_time: %s\n", nt_time_string(talloc_tos(), tmp)); + + unix_timespec_to_nt_time(&tmp, c_time); + d_printf("change_time: %s\n", nt_time_string(talloc_tos(), tmp)); + + if (!cli_qpathinfo_streams(cli, name, talloc_tos(), &num_streams, + &streams)) { + d_printf("%s getting streams for %s\n", + cli_errstr(cli),name); + return false; + } + + for (i=0; i\n"); + return 1; + } + name = talloc_asprintf_append(name, buf); + if (!name) { + return 1; + } + + do_allinfo(name); + + return 0; +} + /**************************************************************************** Put a single file. ****************************************************************************/ @@ -3839,6 +3925,8 @@ static struct { char compl_args[2]; /* Completion argument info */ } commands[] = { {"?",cmd_help,"[command] give help on a command",{COMPL_NONE,COMPL_NONE}}, + {"allinfo",cmd_allinfo," show all available info", + {COMPL_NONE,COMPL_NONE}}, {"altname",cmd_altname," show alt name",{COMPL_NONE,COMPL_NONE}}, {"archive",cmd_archive,"\n0=ignore archive bit\n1=only get archive files\n2=only get archive files and reset archive bit\n3=get all files and reset archive bit",{COMPL_NONE,COMPL_NONE}}, {"blocksize",cmd_block,"blocksize (default 20)",{COMPL_NONE,COMPL_NONE}}, diff --git a/source3/include/smb.h b/source3/include/smb.h index d64b8ba80c..15e51dbdd7 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -574,6 +574,16 @@ struct trans_state { char *data; }; +/* + * Info about an alternate data stream + */ + +struct stream_struct { + SMB_OFF_T size; + SMB_OFF_T alloc_size; + char *name; +}; + /* Include VFS stuff */ #include "smb_acls.h" diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index aab77a3d54..4c5e338606 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -805,6 +805,137 @@ bool cli_qpathinfo2(struct cli_state *cli, const char *fname, return True; } +/**************************************************************************** + Get the stream info +****************************************************************************/ + +bool cli_qpathinfo_streams(struct cli_state *cli, const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *pnum_streams, + struct stream_struct **pstreams) +{ + unsigned int data_len = 0; + unsigned int param_len = 0; + uint16 setup = TRANSACT2_QPATHINFO; + char *param; + char *rparam=NULL, *rdata=NULL; + char *p; + unsigned int num_streams; + struct stream_struct *streams; + unsigned int ofs; + size_t namelen = 2*(strlen(fname)+1); + + param = SMB_MALLOC_ARRAY(char, 6+namelen+2); + if (param == NULL) { + return false; + } + p = param; + memset(p, 0, 6); + SSVAL(p, 0, SMB_FILE_STREAM_INFORMATION); + p += 6; + p += clistr_push(cli, p, fname, namelen, STR_TERMINATE); + + param_len = PTR_DIFF(p, param); + + if (!cli_send_trans(cli, SMBtrans2, + NULL, /* name */ + -1, 0, /* fid, flags */ + &setup, 1, 0, /* setup, len, max */ + param, param_len, 10, /* param, len, max */ + NULL, data_len, cli->max_xmit /* data, len, max */ + )) { + return false; + } + + if (!cli_receive_trans(cli, SMBtrans2, + &rparam, ¶m_len, + &rdata, &data_len)) { + return false; + } + + if (!rdata) { + SAFE_FREE(rparam); + return false; + } + + num_streams = 0; + streams = NULL; + ofs = 0; + + while ((data_len > ofs) && (data_len - ofs >= 24)) { + uint32_t nlen, len; + ssize_t size; + void *vstr; + struct stream_struct *tmp; + uint8_t *tmp_buf; + + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, streams, + struct stream_struct, + num_streams+1); + + if (tmp == NULL) { + goto fail; + } + streams = tmp; + + nlen = IVAL(rdata, ofs + 0x04); + + streams[num_streams].size = IVAL_TO_SMB_OFF_T( + rdata, ofs + 0x08); + streams[num_streams].alloc_size = IVAL_TO_SMB_OFF_T( + rdata, ofs + 0x10); + + if (nlen > data_len - (ofs + 24)) { + goto fail; + } + + /* + * We need to null-terminate src, how do I do this with + * convert_string_talloc?? + */ + + tmp_buf = TALLOC_ARRAY(streams, uint8_t, nlen+2); + if (tmp_buf == NULL) { + goto fail; + } + + memcpy(tmp_buf, rdata+ofs+24, nlen); + tmp_buf[nlen] = 0; + tmp_buf[nlen+1] = 0; + + size = convert_string_talloc(streams, CH_UTF16, CH_UNIX, + tmp_buf, nlen+2, &vstr, + false); + TALLOC_FREE(tmp_buf); + + if (size == -1) { + goto fail; + } + streams[num_streams].name = (char *)vstr; + num_streams++; + + len = IVAL(rdata, ofs); + if (len > data_len - ofs) { + goto fail; + } + if (len == 0) break; + ofs += len; + } + + SAFE_FREE(rdata); + SAFE_FREE(rparam); + + *pnum_streams = num_streams; + *pstreams = streams; + return true; + + fail: + TALLOC_FREE(streams); + SAFE_FREE(rdata); + SAFE_FREE(rparam); + return false; +} + /**************************************************************************** Send a qfileinfo QUERY_FILE_NAME_INFO call. ****************************************************************************/ -- cgit From 27d9ac321961891b0580a9f67366ef6b603de418 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 12:07:02 +0100 Subject: Use C99 structure initializers for netlogon_params_reg_ops. Michael (This used to be commit f3901f179b770ffadb3e5a82ac5a2da00d83f40a) --- source3/registry/reg_backend_netlogon_params.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/source3/registry/reg_backend_netlogon_params.c b/source3/registry/reg_backend_netlogon_params.c index b70e1bdf50..507d2c5df8 100644 --- a/source3/registry/reg_backend_netlogon_params.c +++ b/source3/registry/reg_backend_netlogon_params.c @@ -46,13 +46,5 @@ static int netlogon_params_fetch_reg_values(const char *key, REGISTRY_OPS netlogon_params_reg_ops = { - NULL, - netlogon_params_fetch_reg_values, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + .fetch_values = netlogon_params_fetch_reg_values, }; -- cgit From c17c64530ec479334f88679ef780691e06ccd65a Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 18 Jan 2008 17:34:21 +0300 Subject: Merge DMAPI fixes from CTDB Samba (This used to be commit cf1f90ad7a79dbe5926018790bb50d4e3b36cc7b) --- source3/modules/vfs_tsmsm.c | 92 +++++++++++--------- source3/smbd/dmapi.c | 205 +++++++++++++++++--------------------------- source3/smbd/server.c | 6 -- 3 files changed, 129 insertions(+), 174 deletions(-) diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c index 2805488e8b..40b8c3adad 100644 --- a/source3/modules/vfs_tsmsm.c +++ b/source3/modules/vfs_tsmsm.c @@ -3,8 +3,8 @@ Samba VFS module for handling offline files with Tivoli Storage Manager Space Management - (c) Alexander Bokovoy, 2007 - (c) Andrew Tridgell, 2007 + (c) Alexander Bokovoy, 2007, 2008 + (c) Andrew Tridgell, 2007, 2008 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 @@ -21,18 +21,20 @@ */ /* This VFS module accepts following options: - tsmsm: hsm script = (/bin/true by default, i.e. does nothing) + tsmsm: hsm script = (default does nothing) hsm script should point to a shell script which accepts two arguments: where is currently 'offline' to set offline status of the tsmsm: online ratio = ratio to check reported size against actual file size (0.5 by default) + tsmsm: attribute name = name of DMAPI attribute that is present when a file is offline. + Default is "IBMobj" (which is what GPFS uses) The TSMSM VFS module tries to avoid calling expensive DMAPI calls with some heuristics based on the fact that number of blocks reported of a file multiplied by 512 will be bigger than 'online ratio' of actual size for online (non-migrated) files. - If checks fail, we call DMAPI and ask for specific IBM attribute which present for + If checks fail, we call DMAPI and ask for specific attribute which present for offline (migrated) files. If this attribute presents, we consider file offline. */ @@ -62,72 +64,66 @@ /* optimisation tunables - used to avoid the DMAPI slow path */ #define FILE_IS_ONLINE_RATIO 0.5 + +/* default attribute name to look for */ #define DM_ATTRIB_OBJECT "IBMObj" -#define DM_ATTRIB_MIGRATED "IBMMig" struct tsmsm_struct { - dm_sessid_t sid; float online_ratio; char *hsmscript; + const char *attrib_name; }; -#define TSM_STRINGIFY(a) #a -#define TSM_TOSTRING(a) TSM_STRINGIFY(a) - static void tsmsm_free_data(void **pptr) { struct tsmsm_struct **tsmd = (struct tsmsm_struct **)pptr; if(!tsmd) return; TALLOC_FREE(*tsmd); } +/* + called when a client connects to a share +*/ static int tsmsm_connect(struct vfs_handle_struct *handle, const char *service, const char *user) { struct tsmsm_struct *tsmd = TALLOC_ZERO_P(handle, struct tsmsm_struct); - const char *hsmscript, *tsmname; const char *fres; + const char *tsmname; if (!tsmd) { DEBUG(0,("tsmsm_connect: out of memory!\n")); return -1; } - tsmd->sid = *(dm_sessid_t*) dmapi_get_current_session(); - - if (tsmd->sid == DM_NO_SESSION) { + if (!dmapi_have_session()) { DEBUG(0,("tsmsm_connect: no DMAPI session for Samba is available!\n")); TALLOC_FREE(tsmd); return -1; } tsmname = (handle->param ? handle->param : "tsmsm"); - hsmscript = lp_parm_const_string(SNUM(handle->conn), tsmname, - "hsm script", NULL); - if (hsmscript) { - tsmd->hsmscript = talloc_strdup(tsmd, hsmscript); - if(!tsmd->hsmscript) { - DEBUG(1, ("tsmsm_connect: can't allocate memory for hsm script path")); - TALLOC_FREE(tsmd); - return -1; - } - } else { - DEBUG(1, ("tsmsm_connect: can't call hsm script because it " - "is not set to anything in the smb.conf\n" - "Use %s: 'hsm script = path' to set it\n", - tsmname)); - TALLOC_FREE(tsmd); - return -1; - } + + /* Get 'hsm script' and 'dmapi attribute' parameters to tsmd context */ + tsmd->hsmscript = lp_parm_talloc_string(SNUM(handle->conn), tsmname, + "hsm script", NULL); + talloc_steal(tsmd, tsmd->hsmscript); + + tsmd->attrib_name = lp_parm_talloc_string(SNUM(handle->conn), tsmname, + "dmapi attribute", DM_ATTRIB_OBJECT); + talloc_steal(tsmd, tsmd->attrib_name); + /* retrieve 'online ratio'. In case of error default to FILE_IS_ONLINE_RATIO */ fres = lp_parm_const_string(SNUM(handle->conn), tsmname, - "online ratio", TSM_TOSTRING(FILE_IS_ONLINE_RATIO)); - tsmd->online_ratio = strtof(fres, NULL); - if((tsmd->online_ratio == (float)0) || ((errno == ERANGE) && - ((tsmd->online_ratio == HUGE_VALF) || - (tsmd->online_ratio == HUGE_VALL)))) { - DEBUG(1, ("tsmsm_connect: error while getting online ratio from smb.conf." - "Default to %s.\n", TSM_TOSTRING(FILE_IS_ONLINE_RATIO))); + "online ratio", NULL); + if (fres == NULL) { tsmd->online_ratio = FILE_IS_ONLINE_RATIO; + } else { + tsmd->online_ratio = strtof(fres, NULL); + if (tsmd->online_ration > 1.0 || + tsmd->online_ration <= 0.0) { + DEBUG(1, ("tsmsm_connect: invalid online ration %f - using %f.\n", + tsmd->online_ration, (float)FILE_IS_ONLINE_RATIO)); + } } /* Store the private data. */ @@ -140,6 +136,7 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle, const char *path, SMB_STRUCT_STAT *stbuf) { struct tsmsm_struct *tsmd = (struct tsmsm_struct *) handle->data; + const dm_sessid_t *dmsession_id; void *dmhandle = NULL; size_t dmhandle_len = 0; size_t rlen; @@ -154,7 +151,14 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle, path, stbuf->st_blocks, stbuf->st_size, tsmd->online_ratio)); return false; } - + + dmsession_id = dmapi_get_current_session(); + if (dmsession_id == NULL) { + DEBUG(2, ("tsmsm_is_offline: no DMAPI session available? " + "Assume file is online.\n")); + return false; + } + /* using POSIX capabilities does not work here. It's a slow path, so * become_root() is just as good anyway (tridge) */ @@ -173,12 +177,12 @@ static bool tsmsm_is_offline(struct vfs_handle_struct *handle, } memset(&dmname, 0, sizeof(dmname)); - strlcpy((char *)&dmname.an_chars[0], DM_ATTRIB_OBJECT, sizeof(dmname.an_chars)); + strlcpy((char *)&dmname.an_chars[0], tsmd->attrib_name, sizeof(dmname.an_chars)); - ret = dm_get_dmattr(tsmd->sid, dmhandle, dmhandle_len, + ret = dm_get_dmattr(*dmsession_id, dmhandle, dmhandle_len, DM_NO_TOKEN, &dmname, 0, NULL, &rlen); - /* its offline if the IBMObj attribute exists */ + /* its offline if the specified DMAPI attribute exists */ offline = (ret == 0 || (ret == -1 && errno == E2BIG)); DEBUG(10,("dm_get_dmattr %s ret=%d (%s)\n", path, ret, strerror(errno))); @@ -280,6 +284,12 @@ static int tsmsm_set_offline(struct vfs_handle_struct *handle, int result = 0; char *command; + if (tsmd->hsmscript == NULL) { + /* no script enabled */ + DEBUG(1, ("tsmsm_set_offline: No tsmsm:hsmscript configured\n")); + return 0; + } + /* Now, call the script */ command = talloc_asprintf(tsmd, "%s offline \"%s\"", tsmd->hsmscript, path); if(!command) { diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c index 620baf199e..a410748ccf 100644 --- a/source3/smbd/dmapi.c +++ b/source3/smbd/dmapi.c @@ -25,9 +25,9 @@ #ifndef USE_DMAPI -int dmapi_init_session(void) { return -1; } uint32 dmapi_file_flags(const char * const path) { return 0; } bool dmapi_have_session(void) { return False; } +const void * dmapi_get_current_session(void) { return NULL; } #else /* USE_DMAPI */ @@ -48,90 +48,48 @@ bool dmapi_have_session(void) { return False; } static dm_sessid_t samba_dmapi_session = DM_NO_SESSION; -/* Initialise the DMAPI interface. Make sure that we only end up initialising - * once per process to avoid resource leaks across different DMAPI - * implementations. - */ -static int init_dmapi_service(void) -{ - static pid_t lastpid; - - pid_t mypid; - - mypid = sys_getpid(); - if (mypid != lastpid) { - char *version; - - lastpid = mypid; - if (dm_init_service(&version) < 0) { - return -1; - } - - DEBUG(0, ("Initializing DMAPI: %s\n", version)); - } - - return 0; -} - -bool dmapi_have_session(void) -{ - return samba_dmapi_session != DM_NO_SESSION; -} - -static dm_sessid_t *realloc_session_list(dm_sessid_t * sessions, int count) -{ - dm_sessid_t *nsessions; - - nsessions = TALLOC_REALLOC_ARRAY(NULL, sessions, dm_sessid_t, count); - if (nsessions == NULL) { - TALLOC_FREE(sessions); - return NULL; - } - return nsessions; -} - -/* Initialise DMAPI session. The session is persistant kernel state, so it - * might already exist, in which case we merely want to reconnect to it. This - * function should be called as root. - */ -int dmapi_init_session(void) +/* + Initialise DMAPI session. The session is persistant kernel state, + so it might already exist, in which case we merely want to + reconnect to it. This function should be called as root. +*/ +static int dmapi_init_session(void) { char buf[DM_SESSION_INFO_LEN]; size_t buflen; - - uint nsessions = 10; + uint nsessions = 5; dm_sessid_t *sessions = NULL; + char *version; int i, err; - /* If we aren't root, something in the following will fail due to lack - * of privileges. Aborting seems a little extreme. - */ - SMB_WARN(getuid() == 0, "dmapi_init_session must be called as root"); - - samba_dmapi_session = DM_NO_SESSION; - if (init_dmapi_service() < 0) { + if (dm_init_service(&version) < 0) { + DEBUG(0, ("dm_init_service failed - disabling DMAPI\n")); return -1; } -retry: + ZERO_STRUCT(buf); - if ((sessions = realloc_session_list(sessions, nsessions)) == NULL) { - return -1; - } - - err = dm_getall_sessions(nsessions, sessions, &nsessions); - if (err < 0) { - if (errno == E2BIG) { - nsessions *= 2; - goto retry; + do { + dm_sessid_t *new_sessions; + nsessions *= 2; + new_sessions = TALLOC_REALLOC_ARRAY(NULL, sessions, + dm_sessid_t, nsessions); + if (new_sessions == NULL) { + talloc_free(sessions); + return -1; } + sessions = new_sessions; + err = dm_getall_sessions(nsessions, sessions, &nsessions); + } while (err == -1 && errno == E2BIG); + + if (err == -1) { DEBUGADD(DMAPI_TRACE, ("failed to retrieve DMAPI sessions: %s\n", strerror(errno))); - TALLOC_FREE(sessions); + talloc_free(sessions); return -1; } @@ -147,7 +105,7 @@ retry: } } - TALLOC_FREE(sessions); + talloc_free(sessions); /* No session already defined. */ if (samba_dmapi_session == DM_NO_SESSION) { @@ -162,91 +120,84 @@ retry: return -1; } - DEBUGADD(DMAPI_TRACE, - ("created new DMAPI session named '%s'\n", - DMAPI_SESSION_NAME)); + DEBUG(0, ("created new DMAPI session named '%s' for %s\n", + DMAPI_SESSION_NAME, version)); + } + + if (samba_dmapi_session != DM_NO_SESSION) { + set_effective_capability(DMAPI_ACCESS_CAPABILITY); } - /* Note that we never end the DMAPI session. This enables child - * processes to continue to use the session after we exit. It also lets - * you run a second Samba server on different ports without any - * conflict. + /* + Note that we never end the DMAPI session. It gets re-used if possiblie. + DMAPI session is a kernel resource that is usually lives until server reboot + and doesn't get destroed when an application finishes. */ return 0; } -/* Reattach to an existing dmapi session. Called from service processes that - * might not be running as root. - */ -static int reattach_dmapi_session(void) +/* + Return a pointer to our DMAPI session, if available. + This assumes that you have called dmapi_have_session() first. +*/ +const void *dmapi_get_current_session(void) { - char buf[DM_SESSION_INFO_LEN]; - size_t buflen; - - if (samba_dmapi_session != DM_NO_SESSION ) { - become_root(); - - /* NOTE: On Linux, this call opens /dev/dmapi, costing us a - * file descriptor. Ideally, we would close this when we fork. - */ - if (init_dmapi_service() < 0) { - samba_dmapi_session = DM_NO_SESSION; - unbecome_root(); - return -1; - } - - if (dm_query_session(samba_dmapi_session, sizeof(buf), - buf, &buflen) < 0) { - /* Session is stale. Disable DMAPI. */ - samba_dmapi_session = DM_NO_SESSION; - unbecome_root(); - return -1; - } - - set_effective_capability(DMAPI_ACCESS_CAPABILITY); - - DEBUG(DMAPI_TRACE, ("reattached DMAPI session\n")); - unbecome_root(); + if (samba_dmapi_session == DM_NO_SESSION) { + return NULL; } - return 0; + return (void *)&samba_dmapi_session; } + +/* + dmapi_have_session() must be the first DMAPI call you make in Samba. It will + initialize DMAPI, if available, and tell you if you can get a DMAPI session. + This should be called in the client-specific child process. +*/ -/* If a DMAPI session has been initialised, then we need to make sure - * we are attached to it and have the correct privileges. This is - * necessary to be able to do DMAPI operations across a fork(2). If - * it fails, there is no likelihood of that failure being transient. - * - * Note that this use of the static attached flag relies on the fact - * that dmapi_file_flags() is never called prior to forking the - * per-client server process. - */ -const void * dmapi_get_current_session(void) +bool dmapi_have_session(void) { - static int attached = 0; - if (dmapi_have_session() && !attached) { - attached++; - if (reattach_dmapi_session() < 0) { - return DM_NO_SESSION; - } + static bool initialized; + if (!initialized) { + initialized = true; + + become_root(); + dmapi_init_session(); + unbecome_root(); + } - return &samba_dmapi_session; + + return samba_dmapi_session != DM_NO_SESSION; } +/* + This is default implementation of dmapi_file_flags() that is + called from VFS is_offline() call to know whether file is offline. + For GPFS-specific version see modules/vfs_tsmsm.c. It might be + that approach on quering existence of a specific attribute that + is used in vfs_tsmsm.c will work with other DMAPI-based HSM + implementations as well. +*/ uint32 dmapi_file_flags(const char * const path) { - dm_sessid_t dmapi_session; int err; dm_eventset_t events = {0}; uint nevents; + dm_sessid_t dmapi_session; + void *dmapi_session_ptr; void *dm_handle = NULL; size_t dm_handle_len = 0; uint32 flags = 0; - dmapi_session = *(dm_sessid_t*) dmapi_get_current_session(); + dmapi_session_ptr = dmapi_get_current_session(); + if (dmapi_session_ptr == NULL) { + return 0; + } + + dmapi_session = *(dm_sessid_t *)dmapi_session_ptr; if (dmapi_session == DM_NO_SESSION) { return 0; } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index db241103ed..7116027adf 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1313,12 +1313,6 @@ extern void build_options(bool screen); if ( is_daemon && !interactive ) start_background_queue(); - /* Always attempt to initialize DMAPI. We will only use it later if - * lp_dmapi_support is set on the share, but we need a single global - * session to work with. - */ - dmapi_init_session(); - if (!open_sockets_smbd(is_daemon, interactive, ports)) exit(1); -- cgit From 928f899948d25a133c9622a2ac8208e4499ba260 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Nov 2007 14:46:47 +0100 Subject: r25970: libreplace: fix AC_N_DEFINE() so that some appears in config.h metze (cherry picked from commit a07c983fde52607806745914bb41039afb5618cc) (This used to be commit 3db37038b3e5a59a9baa85f6bcd32ac6e5ec2da1) --- source3/lib/replace/libreplace_macros.m4 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source3/lib/replace/libreplace_macros.m4 b/source3/lib/replace/libreplace_macros.m4 index 92fecd3db8..54e6b7ac75 100644 --- a/source3/lib/replace/libreplace_macros.m4 +++ b/source3/lib/replace/libreplace_macros.m4 @@ -248,11 +248,18 @@ m4_define([AH_CHECK_FUNC_EXT], dnl Define an AC_DEFINE with ifndef guard. dnl AC_N_DEFINE(VARIABLE [, VALUE]) -define(AC_N_DEFINE, -[cat >> confdefs.h <<\EOF -[#ifndef] $1 -[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) -[#endif] +AC_DEFUN([AC_N_DEFINE], +[ +AH_VERBATIM([$1], [ +#ifndef $1 +# undef $1 +#endif +]) + + cat >>confdefs.h <<\EOF +#ifndef $1 +[#define] $1 m4_if($#, 1, 1, [$2]) +#endif EOF ]) -- cgit From 2e0dc77bdad8e6c88920cfb8624a8dac981dd4c8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Nov 2007 14:55:48 +0100 Subject: r25971: libreplace: remove AC_EXTENSION_FLAG as it's the same as AC_N_DEFINE metze (cherry picked from commit 05b4619c5beff474488d1abe5e647acd94a3e20c) (This used to be commit 58932ca791024bd9a543ff5e21bc26970ceed477) --- source3/lib/replace/libreplace_cc.m4 | 4 ++-- source3/lib/replace/libreplace_macros.m4 | 13 ------------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/source3/lib/replace/libreplace_cc.m4 b/source3/lib/replace/libreplace_cc.m4 index a01bf1b290..a0722b2fcf 100644 --- a/source3/lib/replace/libreplace_cc.m4 +++ b/source3/lib/replace/libreplace_cc.m4 @@ -48,8 +48,8 @@ LIBREPLACE_C99_STRUCT_INIT([],[AC_MSG_WARN([c99 structure initializer are not su AC_PROG_INSTALL AC_ISC_POSIX -AC_EXTENSION_FLAG(_XOPEN_SOURCE_EXTENDED) -AC_EXTENSION_FLAG(_OSF_SOURCE) +AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED) +AC_N_DEFINE(_OSF_SOURCE) AC_SYS_LARGEFILE diff --git a/source3/lib/replace/libreplace_macros.m4 b/source3/lib/replace/libreplace_macros.m4 index 54e6b7ac75..1856eacf66 100644 --- a/source3/lib/replace/libreplace_macros.m4 +++ b/source3/lib/replace/libreplace_macros.m4 @@ -87,19 +87,6 @@ fi rm -f conftest* ])]) -AC_DEFUN([AC_EXTENSION_FLAG], -[ - cat >>confdefs.h <<\EOF -#ifndef $1 -# define $1 1 -#endif -EOF -AH_VERBATIM([$1], [#ifndef $1 -# define $1 1 -#endif]) -]) - - dnl see if a declaration exists for a function or variable dnl defines HAVE_function_DECL if it exists dnl AC_HAVE_DECL(var, includes) -- cgit From f75898d5b5712bcd8cb45cd54893932c1d0e5b36 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Nov 2007 15:43:14 +0100 Subject: r25974: libreplace: see what the build-farm says if we use _XOPEN_SOURCE=600 On Tru64 this brings in socklen_t and some other socket stuff metze (cherry picked from commit d42f2e5759332f1f0c6c1269bd29ac62ddb11016) (This used to be commit af3772e22f5e6e0158783086e9791ffc95ee5368) --- source3/lib/replace/libreplace_cc.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/replace/libreplace_cc.m4 b/source3/lib/replace/libreplace_cc.m4 index a0722b2fcf..3f0a337083 100644 --- a/source3/lib/replace/libreplace_cc.m4 +++ b/source3/lib/replace/libreplace_cc.m4 @@ -49,6 +49,7 @@ AC_PROG_INSTALL AC_ISC_POSIX AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED) +AC_N_DEFINE(_XOPEN_SOURCE,600) AC_N_DEFINE(_OSF_SOURCE) AC_SYS_LARGEFILE -- cgit From 0e1348869e50715f889a97a375abc7ae1af13d69 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 15 Nov 2007 16:40:32 +0100 Subject: r25976: libreplace: not all platforms like _XOPEN_SOURCE=600 - Only use _XOPEN_SOURCE=600 on Tru64 - _OSF_SOURCE is also Tru64 specific metze (cherry picked from commit d19ab62081ce4ee4273ff752ad0443782a994826) (This used to be commit dbff70b2ebe7cc09f7fbe5a0319f978dfcfa1da9) --- source3/lib/replace/libreplace_cc.m4 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source3/lib/replace/libreplace_cc.m4 b/source3/lib/replace/libreplace_cc.m4 index 3f0a337083..bf5056838d 100644 --- a/source3/lib/replace/libreplace_cc.m4 +++ b/source3/lib/replace/libreplace_cc.m4 @@ -49,8 +49,6 @@ AC_PROG_INSTALL AC_ISC_POSIX AC_N_DEFINE(_XOPEN_SOURCE_EXTENDED) -AC_N_DEFINE(_XOPEN_SOURCE,600) -AC_N_DEFINE(_OSF_SOURCE) AC_SYS_LARGEFILE @@ -78,6 +76,11 @@ case "$host_os" in CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" fi ;; + *osf*) + # this brings in socklen_t + AC_N_DEFINE(_XOPEN_SOURCE,600) + AC_N_DEFINE(_OSF_SOURCE) + ;; # # VOS may need to have POSIX support and System V compatibility enabled. # -- cgit From a2bfb1749ca7bc0c713d3508c1324799245c7d1a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 22 Nov 2007 14:42:14 +0100 Subject: r26102: libreplace: remove system/printing.h as it only contains samba3 stuff metze (cherry picked from commit 1ecb4ec01b0506c95a5f90a62040329e7a39ee93) (This used to be commit ff8a001f0d3f2655efafed41f2f0b14552a5c7e7) --- source3/lib/replace/system/printing.h | 50 ----------------------------------- source3/lib/replace/test/testsuite.c | 1 - 2 files changed, 51 deletions(-) delete mode 100644 source3/lib/replace/system/printing.h diff --git a/source3/lib/replace/system/printing.h b/source3/lib/replace/system/printing.h deleted file mode 100644 index 7eb02d004a..0000000000 --- a/source3/lib/replace/system/printing.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _system_printing_h -#define _system_printing_h - -/* - Unix SMB/CIFS implementation. - - printing system include wrappers - - Copyright (C) Andrew Tridgell 2004 - - ** NOTE! The following LGPL license applies to the replace - ** library. This does NOT imply that all of Samba is released - ** under the LGPL - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 3 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, see . - -*/ - -#ifdef AIX -#define DEFAULT_PRINTING PRINT_AIX -#define PRINTCAP_NAME "/etc/qconfig" -#endif - -#ifdef HPUX -#define DEFAULT_PRINTING PRINT_HPUX -#endif - -#ifdef QNX -#define DEFAULT_PRINTING PRINT_QNX -#endif - -#ifndef DEFAULT_PRINTING -#define DEFAULT_PRINTING PRINT_BSD -#endif -#ifndef PRINTCAP_NAME -#define PRINTCAP_NAME "/etc/printcap" -#endif - -#endif diff --git a/source3/lib/replace/test/testsuite.c b/source3/lib/replace/test/testsuite.c index 269a2ff5d6..5b95ae395c 100644 --- a/source3/lib/replace/test/testsuite.c +++ b/source3/lib/replace/test/testsuite.c @@ -37,7 +37,6 @@ #include "system/locale.h" #include "system/network.h" #include "system/passwd.h" -#include "system/printing.h" #include "system/readline.h" #include "system/select.h" #include "system/shmem.h" -- cgit From 1e5418edbc370e87293c324eae54372a495bb932 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 20 Dec 2007 15:59:39 +0100 Subject: r26550: libreplace: fallback to __ss_family of struct sockaddr_storage metze (cherry picked from commit 11bdc9bed80b9842ac1ab8f22509a5d191cddc91) (This used to be commit c11122afda52ce787dd1d3357bd85b6ce36b8ca4) --- source3/lib/replace/libreplace.m4 | 20 ++++++++++++++++++++ source3/lib/replace/system/network.h | 9 +++++++++ 2 files changed, 29 insertions(+) diff --git a/source3/lib/replace/libreplace.m4 b/source3/lib/replace/libreplace.m4 index 7a5283a4d6..f866b3648f 100644 --- a/source3/lib/replace/libreplace.m4 +++ b/source3/lib/replace/libreplace.m4 @@ -153,6 +153,26 @@ AC_HAVE_TYPE([struct sockaddr_in6], [ #include ]) +if test x"$ac_cv_type_struct_sockaddr_storage" = x"yes"; then +AC_CHECK_MEMBER(struct sockaddr_storage.ss_family, + AC_DEFINE(HAVE_SS_FAMILY, 1, [Defined if struct sockaddr_storage has ss_family field]),, + [ +#include +#include +#include + ]) + +if test x"$ac_cv_member_struct_sockaddr_storage_ss_family" != x"yes"; then +AC_CHECK_MEMBER(struct sockaddr_storage.__ss_family, + AC_DEFINE(HAVE___SS_FAMILY, 1, [Defined if struct sockaddr_storage has __ss_family field]),, + [ +#include +#include +#include + ]) +fi +fi + AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index b6ae3c7c6f..2f387de5cf 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -227,9 +227,18 @@ typedef unsigned short int sa_family_t; #ifdef HAVE_STRUCT_SOCKADDR_IN6 #define sockaddr_storage sockaddr_in6 #define ss_family sin6_family +#define HAVE_SS_FAMILY 1 #else #define sockaddr_storage sockaddr_in #define ss_family sin_family +#define HAVE_SS_FAMILY 1 +#endif +#endif + +#ifndef HAVE_SS_FAMILY +#ifdef HAVE___SS_FAMILY +#define ss_family __ss_family +#define HAVE_SS_FAMILY 1 #endif #endif -- cgit From f8ad02305fca3357e924c9c0e462b05b1452ae16 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 13 Jan 2008 04:46:11 +0100 Subject: Try to fix the build on Tru64; avoid single quotes because they get expanded by perl in the build system. (cherry picked from commit bba8914af56cb161c275fbbdea2479d6f8bd703c) (This used to be commit a0e663ff2c6548e48c9710e3fb314f3bbabb59d0) --- source3/lib/replace/libreplace_ld.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/replace/libreplace_ld.m4 b/source3/lib/replace/libreplace_ld.m4 index cb8e21434e..0ca6f7a34d 100644 --- a/source3/lib/replace/libreplace_ld.m4 +++ b/source3/lib/replace/libreplace_ld.m4 @@ -265,7 +265,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined" ;; *osf*) - LD_SHLIB_ALLOW_UNDEF_FLAG="-expect_unresolved '*'" + LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,*" ;; *darwin*) LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup" -- cgit From a0e04a94170ffb54e8a809ed869a08af898fb723 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Jan 2008 22:24:07 +0100 Subject: libreplace: Escape asterisk. (cherry picked from commit df36c78549b40ee5e47d5cc79de2eb79f58c567a) (This used to be commit 174a45ec18fff064d89f6a12b044973ab3c10c54) --- source3/lib/replace/libreplace_ld.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/replace/libreplace_ld.m4 b/source3/lib/replace/libreplace_ld.m4 index 0ca6f7a34d..2aec698967 100644 --- a/source3/lib/replace/libreplace_ld.m4 +++ b/source3/lib/replace/libreplace_ld.m4 @@ -265,7 +265,7 @@ AC_DEFUN([AC_LIBREPLACE_LD_SHLIB_ALLOW_UNDEF_FLAG], LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,--allow-shlib-undefined" ;; *osf*) - LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,*" + LD_SHLIB_ALLOW_UNDEF_FLAG="-Wl,-expect_unresolved,\"*\"" ;; *darwin*) LD_SHLIB_ALLOW_UNDEF_FLAG="-undefined dynamic_lookup" -- cgit From db449a4c5f807b11ec723b11a2db32d09162e163 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Jan 2008 16:34:06 +0100 Subject: Revert "Host SerNet-AIX has __ss_family instead of ss_family in sockaddr_storage" This reverts commit e33286f4a68352e55df081d06307f64f190773b3. 393bab185e0e9f02aac5740becc2aba2762133c8 is the v4-0-test fix for the same problem. metze (This used to be commit b8a57a24c390355c4950ca499c1d96aff80abad7) --- source3/configure.in | 9 --------- source3/lib/replace/system/network.h | 4 ---- 2 files changed, 13 deletions(-) diff --git a/source3/configure.in b/source3/configure.in index f65eb3c204..a34d42c478 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -3051,15 +3051,6 @@ if test x"$samba_cv_HAVE_IFACE_IFREQ" = x"yes"; then fi fi -dnl AIX 5.3.0.0 -AC_TRY_COMPILE([#include ],[ -struct sockaddr_storage s; s.__ss_family = 0], -samba_cv_have_aix_sockaddr_storage=yes,samba_cv_have_aix_sockaddr_storage=no) - -if test x"$samba_cv_have_aix_sockaddr_storage" = x"yes"; then - AC_DEFINE(HAVE_AIX_SOCKADDR_STORAGE, 1, [Whether struct sockaddr_storage has __sa_family]) -fi - if test $iface = no; then AC_CACHE_CHECK([for iface AIX],samba_cv_HAVE_IFACE_AIX,[ SAVE_CPPFLAGS="$CPPFLAGS" diff --git a/source3/lib/replace/system/network.h b/source3/lib/replace/system/network.h index 2f387de5cf..fe6e46817f 100644 --- a/source3/lib/replace/system/network.h +++ b/source3/lib/replace/system/network.h @@ -242,10 +242,6 @@ typedef unsigned short int sa_family_t; #endif #endif -#ifdef HAVE_AIX_SOCKADDR_STORAGE -#define ss_family __ss_family -#endif - #ifndef HAVE_STRUCT_ADDRINFO #define HAVE_STRUCT_ADDRINFO struct addrinfo { -- cgit From bb707b1db6add166a7887284281fa4b65776be08 Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Fri, 18 Jan 2008 14:22:49 -0500 Subject: Fix typo that disabled setting group id. Thanks, Henrik. (This used to be commit 843e1694cfe4a999ed14a9c215b8e77723d0fe79) --- source3/libsmb/libsmbclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 2fd8294d04..fbcb7f64e2 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -5931,7 +5931,7 @@ smbc_setxattr_ctx(SMBCCTX *context, } else { ret = cacl_set(talloc_tos(), srv->cli, ipc_srv->cli, &ipc_srv->pol, path, - namevalue, SMBC_XATTR_MODE_CHOWN, 0); + namevalue, SMBC_XATTR_MODE_CHGRP, 0); } TALLOC_FREE(frame); return ret; -- cgit From b97fbf58886427fbb7f3181694bf6f9648f5d0f4 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Jan 2008 13:47:10 -0800 Subject: Fix error message for new allinfo command. Jeremy. (This used to be commit 3a1bcbfa7ca2b55265eb486e2b7c740e04775698) --- source3/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/client/client.c b/source3/client/client.c index 59ca2e0adc..28b4a2b24b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1600,7 +1600,7 @@ static int cmd_allinfo(void) } if (!next_token_talloc(ctx, &cmd_ptr, &buf, NULL)) { - d_printf("altname \n"); + d_printf("allinfo \n"); return 1; } name = talloc_asprintf_append(name, buf); -- cgit From 805caafd44cbc5fff49711b1a15fb64cc99f3ad3 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Sat, 19 Jan 2008 02:12:35 +0100 Subject: util_str: Don't return memory from talloc_tos(), use mem_ctx instead. (This used to be commit ab0ee6e9a6a9eee317228f0c2bde254ad9a59b85) --- source3/lib/afs.c | 23 +++++++++++++---------- source3/lib/util_str.c | 6 +++--- source3/rpc_server/srv_samr_util.c | 12 ++++++------ source3/utils/net_rpc_samsync.c | 6 +++--- source3/utils/ntlm_auth.c | 25 +++++++++++++++---------- 5 files changed, 40 insertions(+), 32 deletions(-) diff --git a/source3/lib/afs.c b/source3/lib/afs.c index a7d6f6c9f7..b3d590bf24 100644 --- a/source3/lib/afs.c +++ b/source3/lib/afs.c @@ -42,20 +42,23 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket, const struct ClearToken *ct) { char *base64_ticket; - char *result; + char *result = NULL; DATA_BLOB key = data_blob(ct->HandShakeKey, 8); char *base64_key; + TALLOC_CTX *mem_ctx; + + mem_ctx = talloc_init("afs_encode_token"); + if (mem_ctx == NULL) + goto done; - base64_ticket = base64_encode_data_blob(ticket); + base64_ticket = base64_encode_data_blob(mem_ctx, ticket); if (base64_ticket == NULL) - return NULL; + goto done; - base64_key = base64_encode_data_blob(key); - if (base64_key == NULL) { - TALLOC_FREE(base64_ticket); - return NULL; - } + base64_key = base64_encode_data_blob(mem_ctx, key); + if (base64_key == NULL) + goto done; asprintf(&result, "%s\n%u\n%s\n%u\n%u\n%u\n%s\n", cell, ct->AuthHandle, base64_key, ct->ViceId, ct->BeginTimestamp, @@ -63,8 +66,8 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket, DEBUG(10, ("Got ticket string:\n%s\n", result)); - TALLOC_FREE(base64_ticket); - TALLOC_FREE(base64_key); +done: + TALLOC_FREE(mem_ctx); return result; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 3e3268104c..bcb9197141 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -2415,13 +2415,13 @@ void base64_decode_inplace(char *s) } /** - * Encode a base64 string into a malloc()ed string caller to free. + * Encode a base64 string into a talloc()ed string caller to free. * * From SQUID: adopted from http://ftp.sunet.se/pub2/gnu/vm/base64-encode.c * with adjustments **/ -char *base64_encode_data_blob(DATA_BLOB data) +char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data) { int bits = 0; int char_count = 0; @@ -2434,7 +2434,7 @@ char *base64_encode_data_blob(DATA_BLOB data) out_cnt = 0; len = data.length; output_len = data.length * 2; - result = TALLOC_ARRAY(talloc_tos(), char, output_len); /* get us plenty of space */ + result = TALLOC_ARRAY(mem_ctx, char, output_len); /* get us plenty of space */ SMB_ASSERT(result != NULL); while (len-- && out_cnt < (data.length * 2) - 5) { diff --git a/source3/rpc_server/srv_samr_util.c b/source3/rpc_server/srv_samr_util.c index bde7936343..c8f732153c 100644 --- a/source3/rpc_server/srv_samr_util.c +++ b/source3/rpc_server/srv_samr_util.c @@ -44,16 +44,16 @@ void copy_id20_to_sam_passwd(struct samu *to, SAM_USER_INFO_20 *from) char *new_string; DATA_BLOB mung; - if (from == NULL || to == NULL) + if (from == NULL || to == NULL) return; - + if (from->hdr_munged_dial.buffer) { old_string = pdb_get_munged_dial(to); mung.length = from->hdr_munged_dial.uni_str_len; mung.data = (uint8 *) from->uni_munged_dial.buffer; mung.free = NULL; new_string = (mung.length == 0) ? - NULL : base64_encode_data_blob(mung); + NULL : base64_encode_data_blob(talloc_tos(), mung); DEBUG(10,("INFO_20 UNI_MUNGED_DIAL: %s -> %s\n",old_string, new_string)); if (STRING_CHANGED_NC(old_string,new_string)) pdb_set_munged_dial(to , new_string, PDB_CHANGED); @@ -196,7 +196,7 @@ void copy_id21_to_sam_passwd(struct samu *to, SAM_USER_INFO_21 *from) mung.data = (uint8 *) from->uni_munged_dial.buffer; mung.free = NULL; newstr = (mung.length == 0) ? - NULL : base64_encode_data_blob(mung); + NULL : base64_encode_data_blob(talloc_tos(), mung); DEBUG(10,("INFO_21 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); if (STRING_CHANGED_NC(old_string,newstr)) pdb_set_munged_dial(to , newstr, PDB_CHANGED); @@ -421,7 +421,7 @@ void copy_id23_to_sam_passwd(struct samu *to, SAM_USER_INFO_23 *from) mung.data = (uint8 *) from->uni_munged_dial.buffer; mung.free = NULL; newstr = (mung.length == 0) ? - NULL : base64_encode_data_blob(mung); + NULL : base64_encode_data_blob(talloc_tos(), mung); DEBUG(10,("INFO_23 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); if (STRING_CHANGED_NC(old_string, newstr)) pdb_set_munged_dial(to , newstr, PDB_CHANGED); @@ -633,7 +633,7 @@ void copy_id25_to_sam_passwd(struct samu *to, SAM_USER_INFO_25 *from) mung.data = (uint8 *) from->uni_munged_dial.buffer; mung.free = NULL; newstr = (mung.length == 0) ? - NULL : base64_encode_data_blob(mung); + NULL : base64_encode_data_blob(talloc_tos(), mung); DEBUG(10,("INFO_25 UNI_MUNGED_DIAL: %s -> %s\n",old_string, newstr)); if (STRING_CHANGED_NC(old_string,newstr)) pdb_set_munged_dial(to , newstr, PDB_CHANGED); diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index 779006884d..d0fcfe3aeb 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -365,7 +365,8 @@ static NTSTATUS sam_account_from_delta(struct samu *account, SAM_ACCOUNT_INFO *d old_string = pdb_get_munged_dial(account); mung.length = delta->hdr_parameters.uni_str_len; mung.data = (uint8 *) delta->uni_parameters.buffer; - newstr = (mung.length == 0) ? NULL : base64_encode_data_blob(mung); + newstr = (mung.length == 0) ? NULL : + base64_encode_data_blob(talloc_tos(), mung); if (STRING_CHANGED_NC(old_string, newstr)) pdb_set_munged_dial(account, newstr, PDB_CHANGED); @@ -1422,12 +1423,11 @@ static int fprintf_attr(FILE *add_fd, const char *attr_name, base64_blob.data = (unsigned char *)value; base64_blob.length = strlen(value); - base64 = base64_encode_data_blob(base64_blob); + base64 = base64_encode_data_blob(value, base64_blob); SMB_ASSERT(base64 != NULL); res = fprintf(add_fd, "%s:: %s\n", attr_name, base64); TALLOC_FREE(value); - TALLOC_FREE(base64); return res; } diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 6a702fc0cf..68bf24fec7 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -739,7 +739,8 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod } else if (strncmp(buf, "GK", 2) == 0) { DEBUG(10, ("Requested NTLMSSP session key\n")); if(have_session_key) { - char *key64 = base64_encode_data_blob(session_key); + char *key64 = base64_encode_data_blob(talloc_tos(), + session_key); x_fprintf(x_stdout, "GK %s\n", key64?key64:""); TALLOC_FREE(key64); } else { @@ -768,7 +769,8 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod nt_status = ntlmssp_update(ntlmssp_state, request, &reply); if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - char *reply_base64 = base64_encode_data_blob(reply); + char *reply_base64 = base64_encode_data_blob(talloc_tos(), + reply); x_fprintf(x_stdout, "TT %s\n", reply_base64); TALLOC_FREE(reply_base64); data_blob_free(&reply); @@ -889,7 +891,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo DEBUG(10, ("Requested session key\n")); if(have_session_key) { - char *key64 = base64_encode_data_blob(session_key); + char *key64 = base64_encode_data_blob(talloc_tos(), + session_key); x_fprintf(x_stdout, "GK %s\n", key64?key64:""); TALLOC_FREE(key64); } @@ -925,7 +928,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo } if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - char *reply_base64 = base64_encode_data_blob(reply); + char *reply_base64 = base64_encode_data_blob(talloc_tos(), + reply); if (first) { x_fprintf(x_stdout, "YR %s\n", reply_base64); } else { @@ -939,7 +943,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo } DEBUG(10, ("NTLMSSP challenge\n")); } else if (NT_STATUS_IS_OK(nt_status)) { - char *reply_base64 = base64_encode_data_blob(reply); + char *reply_base64 = base64_encode_data_blob(talloc_tos(), + reply); x_fprintf(x_stdout, "AF %s\n", reply_base64); TALLOC_FREE(reply_base64); @@ -1039,7 +1044,7 @@ static void offer_gss_spnego_mechs(void) { return; } - reply_base64 = base64_encode_data_blob(token); + reply_base64 = base64_encode_data_blob(talloc_tos(), token); x_fprintf(x_stdout, "TT %s *\n", reply_base64); TALLOC_FREE(reply_base64); @@ -1276,7 +1281,7 @@ static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, return; } - reply_base64 = base64_encode_data_blob(token); + reply_base64 = base64_encode_data_blob(talloc_tos(), token); x_fprintf(x_stdout, "%s %s %s\n", reply_code, reply_base64, reply_argument); @@ -1343,7 +1348,7 @@ static bool manage_client_ntlmssp_init(SPNEGO_DATA spnego) write_spnego_data(&to_server, &spnego); data_blob_free(&spnego.negTokenInit.mechToken); - to_server_base64 = base64_encode_data_blob(to_server); + to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server); data_blob_free(&to_server); x_fprintf(x_stdout, "KK %s\n", to_server_base64); TALLOC_FREE(to_server_base64); @@ -1401,7 +1406,7 @@ static void manage_client_ntlmssp_targ(SPNEGO_DATA spnego) write_spnego_data(&to_server, &spnego); data_blob_free(&request); - to_server_base64 = base64_encode_data_blob(to_server); + to_server_base64 = base64_encode_data_blob(talloc_tos(), to_server); data_blob_free(&to_server); x_fprintf(x_stdout, "KK %s\n", to_server_base64); TALLOC_FREE(to_server_base64); @@ -1490,7 +1495,7 @@ static bool manage_client_krb5_init(SPNEGO_DATA spnego) return False; } - reply_base64 = base64_encode_data_blob(to_server); + reply_base64 = base64_encode_data_blob(talloc_tos(), to_server); x_fprintf(x_stdout, "KK %s *\n", reply_base64); TALLOC_FREE(reply_base64); -- cgit From 145ab107b2670b3d645c6757d0a3930eaff6c4d0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 17 Jan 2008 17:48:33 +0100 Subject: Always return nlink=1 for directories I did not test it, but it should not affect cifsfs, there are special posix calls that also return the stat information unfiltered. (This used to be commit e96cf1309e45628f4c27d03f77a4eef5e00602df) --- source3/smbd/trans2.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 23d6f12996..763b6480e3 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3745,11 +3745,6 @@ static void call_trans2qfilepathinfo(connection_struct *conn, nlink = sbuf.st_nlink; - if ((nlink > 0) && S_ISDIR(sbuf.st_mode)) { - /* NTFS does not seem to count ".." */ - nlink -= 1; - } - if ((nlink > 0) && delete_pending) { nlink -= 1; } @@ -4018,7 +4013,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd data_size = 24; SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,file_size); - SIVAL(pdata,16,nlink); + SIVAL(pdata,16,(mode&aDIR)?1:nlink); SCVAL(pdata,20,delete_pending?1:0); SCVAL(pdata,21,(mode&aDIR)?1:0); SSVAL(pdata,22,0); /* Padding. */ @@ -4096,7 +4091,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd pdata += 40; SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,file_size); - SIVAL(pdata,16,nlink); + SIVAL(pdata,16,(mode&aDIR)?1:nlink); SCVAL(pdata,20,delete_pending); SCVAL(pdata,21,(mode&aDIR)?1:0); SSVAL(pdata,22,0); -- cgit From ca6cf1fe94f096aac846d0111b39006bdd40b7e3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 18 Jan 2008 18:39:27 -0800 Subject: Actually test vl's new code and make it work to fix the build farm :-). Jeremy. (This used to be commit 63defd3e9d4ba3f02f36ec5ad7b73463f31962a1) --- source3/smbd/trans2.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 763b6480e3..935a881607 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3743,12 +3743,6 @@ static void call_trans2qfilepathinfo(connection_struct *conn, } } - nlink = sbuf.st_nlink; - - if ((nlink > 0) && delete_pending) { - nlink -= 1; - } - if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) { reply_nterror(req, NT_STATUS_INVALID_LEVEL); return; @@ -3767,6 +3761,16 @@ static void call_trans2qfilepathinfo(connection_struct *conn, if (!mode) mode = FILE_ATTRIBUTE_NORMAL; + nlink = sbuf.st_nlink; + + if (nlink && (mode&aDIR)) { + nlink = 1; + } + + if ((nlink > 0) && delete_pending) { + nlink -= 1; + } + fullpathname = fname; if (!(mode & aDIR)) file_size = get_file_size(sbuf); @@ -4013,7 +4017,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd data_size = 24; SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,file_size); - SIVAL(pdata,16,(mode&aDIR)?1:nlink); + SIVAL(pdata,16,nlink); SCVAL(pdata,20,delete_pending?1:0); SCVAL(pdata,21,(mode&aDIR)?1:0); SSVAL(pdata,22,0); /* Padding. */ @@ -4091,7 +4095,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd pdata += 40; SOFF_T(pdata,0,allocation_size); SOFF_T(pdata,8,file_size); - SIVAL(pdata,16,(mode&aDIR)?1:nlink); + SIVAL(pdata,16,nlink); SCVAL(pdata,20,delete_pending); SCVAL(pdata,21,(mode&aDIR)?1:0); SSVAL(pdata,22,0); -- cgit From 7b73ad2755290c5345b506dcc9c8afa04432bd5e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 12:54:46 +0100 Subject: Link ndr_xattr.o with LIBNDR_GEN_OBJ It will be used elsewhere (net xattr for example) (This used to be commit 924c4ede2acbd4e1d327ccdefc92bbbb3d67d7d8) --- source3/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 45aa4cbc37..d3e37826d7 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -276,6 +276,7 @@ LIBNDR_GEN_OBJ = librpc/gen_ndr/ndr_wkssvc.o \ librpc/gen_ndr/ndr_netlogon.o \ librpc/gen_ndr/ndr_samr.o \ librpc/gen_ndr/ndr_notify.o \ + librpc/gen_ndr/ndr_xattr.o \ librpc/gen_ndr/ndr_libnet_join.o RPC_PARSE_OBJ0 = rpc_parse/parse_prs.o rpc_parse/parse_misc.o @@ -515,7 +516,7 @@ VFS_EXPAND_MSDFS_OBJ = modules/vfs_expand_msdfs.o VFS_SHADOW_COPY_OBJ = modules/vfs_shadow_copy.o VFS_SHADOW_COPY2_OBJ = modules/vfs_shadow_copy2.o VFS_AFSACL_OBJ = modules/vfs_afsacl.o -VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o librpc/gen_ndr/ndr_xattr.o +VFS_XATTR_TDB_OBJ = modules/vfs_xattr_tdb.o VFS_POSIXACL_OBJ = modules/vfs_posixacl.o VFS_AIXACL_OBJ = modules/vfs_aixacl.o modules/vfs_aixacl_util.o VFS_AIXACL2_OBJ = modules/vfs_aixacl2.o modules/vfs_aixacl_util.o modules/nfs4_acls.o -- cgit From f22a29e1bd0c59710b1f6ab56e903fa6e1e51a46 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 16 Jan 2008 09:52:26 +0100 Subject: ntlm_auth: Dynamically allocate the read buffer. This ports over my changes from Samba4 (This used to be commit 4a475baf26ba9f99bc05f13dd2745494174a00c1) --- source3/utils/ntlm_auth.c | 71 ++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 68bf24fec7..b0c79571d2 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -28,7 +28,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND -#define SQUID_BUFFER_SIZE 2010 +#define INITIAL_BUFFER_SIZE 300 +#define MAX_BUFFER_SIZE 630000 enum stdio_helper_mode { SQUID_2_4_BASIC, @@ -2070,46 +2071,60 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helper_function fn) { - char buf[SQUID_BUFFER_SIZE+1]; - int length; + char *buf; + char tmp[INITIAL_BUFFER_SIZE+1]; + int length, buf_size = 0; char *c; - static bool err; - /* this is not a typo - x_fgets doesn't work too well under squid */ - if (fgets(buf, sizeof(buf)-1, stdin) == NULL) { - if (ferror(stdin)) { - DEBUG(1, ("fgets() failed! dying..... errno=%d (%s)\n", ferror(stdin), - strerror(ferror(stdin)))); - - exit(1); /* BIIG buffer */ - } - exit(0); - } - - c=(char *)memchr(buf,'\n',sizeof(buf)-1); - if (c) { - *c = '\0'; - length = c-buf; - } else { - err = 1; - return; - } - if (err) { - DEBUG(2, ("Oversized message\n")); + buf = talloc_strdup(NULL, ""); + if (!buf) { + DEBUG(0, ("Failed to allocate input buffer.\n")); x_fprintf(x_stderr, "ERR\n"); - err = 0; - return; + exit(1); } + do { + + /* this is not a typo - x_fgets doesn't work too well under + * squid */ + if (fgets(tmp, sizeof(tmp)-1, stdin) == NULL) { + if (ferror(stdin)) { + DEBUG(1, ("fgets() failed! dying..... errno=%d " + "(%s)\n", ferror(stdin), + strerror(ferror(stdin)))); + + exit(1); + } + exit(0); + } + + buf = talloc_strdup_append_buffer(buf, tmp); + buf_size += INITIAL_BUFFER_SIZE; + + if (buf_size > MAX_BUFFER_SIZE) { + DEBUG(2, ("Oversized message\n")); + x_fprintf(x_stderr, "ERR\n"); + talloc_free(buf); + return; + } + + c = strchr(buf, '\n'); + } while (c == NULL); + + *c = '\0'; + length = c-buf; + DEBUG(10, ("Got '%s' from squid (length: %d).\n",buf,length)); if (buf[0] == '\0') { DEBUG(2, ("Invalid Request\n")); x_fprintf(x_stderr, "ERR\n"); + talloc_free(buf); return; } - + fn(helper_mode, buf, length); + talloc_free(buf); } -- cgit From 83f30d72e02829fc0304fbeb9751e71e6aaf6c84 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 16 Jan 2008 14:45:22 +0100 Subject: ntlm_auth: Prepare for a deeper rewrite of the helper functions (This used to be commit f8243d1913cd19401ce6a13f53c6b84a36fc9dd6) --- source3/utils/ntlm_auth.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index b0c79571d2..24a49afadd 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -43,6 +43,23 @@ enum stdio_helper_mode { NUM_HELPER_MODES }; +enum ntlm_auth_con_state { + CLIENT_INITIAL, + CLIENT_RESPONSE, + CLIENT_FINISHED, + CLIENT_ERROR, + SERVER_INITIAL, + SERVER_CHALLENGE, + SERVER_FINISHED, + SERVER_ERROR +}; + +struct ntlm_auth_state { + TALLOC_CTX *mem_ctx; + enum stdio_helper_mode helper_mode; + enum ntlm_auth_con_state con_state; +}; + typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode, char *buf, int length); @@ -2069,14 +2086,15 @@ static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_ } } -static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helper_function fn) +static void manage_squid_request(struct ntlm_auth_state *state, + stdio_helper_function fn) { char *buf; char tmp[INITIAL_BUFFER_SIZE+1]; int length, buf_size = 0; char *c; - buf = talloc_strdup(NULL, ""); + buf = talloc_strdup(state->mem_ctx, ""); if (!buf) { DEBUG(0, ("Failed to allocate input buffer.\n")); x_fprintf(x_stderr, "ERR\n"); @@ -2123,17 +2141,38 @@ static void manage_squid_request(enum stdio_helper_mode helper_mode, stdio_helpe return; } - fn(helper_mode, buf, length); + fn(state->helper_mode, buf, length); talloc_free(buf); } static void squid_stream(enum stdio_helper_mode stdio_mode, stdio_helper_function fn) { + TALLOC_CTX *mem_ctx; + struct ntlm_auth_state *state; + /* initialize FDescs */ x_setbuf(x_stdout, NULL); x_setbuf(x_stderr, NULL); + + mem_ctx = talloc_init("ntlm_auth"); + if (!mem_ctx) { + DEBUG(0, ("squid_stream: Failed to create talloc context\n")); + x_fprintf(x_stderr, "ERR\n"); + exit(1); + } + + state = talloc(mem_ctx, struct ntlm_auth_state); + if (!state) { + DEBUG(0, ("squid_stream: Failed to talloc ntlm_auth_state\n")); + x_fprintf(x_stderr, "ERR\n"); + exit(1); + } + + state->mem_ctx = mem_ctx; + state->helper_mode = stdio_mode; + while(1) { - manage_squid_request(stdio_mode, fn); + manage_squid_request(state, fn); } } -- cgit From 40db1a1625da0e63e5f21ec7a7d275e5fbaf71e8 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 18 Jan 2008 10:37:16 +0100 Subject: nltm_auth: Use struct ntlm_auth_state in helper functions. Now rewriting the helpers one after the other can start. (This used to be commit 2479a0c3adf46b2d0a9b109ce689c93296f16a62) --- source3/utils/ntlm_auth.c | 74 +++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 24a49afadd..8387833540 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -43,12 +43,15 @@ enum stdio_helper_mode { NUM_HELPER_MODES }; -enum ntlm_auth_con_state { - CLIENT_INITIAL, +enum ntlm_auth_cli_state { + CLIENT_INITIAL = 0, CLIENT_RESPONSE, CLIENT_FINISHED, - CLIENT_ERROR, - SERVER_INITIAL, + CLIENT_ERROR +}; + +enum ntlm_auth_svr_state { + SERVER_INITIAL = 0, SERVER_CHALLENGE, SERVER_FINISHED, SERVER_ERROR @@ -57,31 +60,33 @@ enum ntlm_auth_con_state { struct ntlm_auth_state { TALLOC_CTX *mem_ctx; enum stdio_helper_mode helper_mode; - enum ntlm_auth_con_state con_state; + enum ntlm_auth_cli_state cli_state; + enum ntlm_auth_svr_state svr_state; }; -typedef void (*stdio_helper_function)(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +typedef void (*stdio_helper_function)(struct ntlm_auth_state *state, char *buf, + int length); -static void manage_squid_basic_request (enum stdio_helper_mode stdio_helper_mode, +static void manage_squid_basic_request (struct ntlm_auth_state *state, char *buf, int length); -static void manage_squid_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +static void manage_squid_ntlmssp_request (struct ntlm_auth_state *state, + char *buf, int length); -static void manage_client_ntlmssp_request (enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +static void manage_client_ntlmssp_request (struct ntlm_auth_state *state, + char *buf, int length); -static void manage_gss_spnego_request (enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +static void manage_gss_spnego_request (struct ntlm_auth_state *state, + char *buf, int length); -static void manage_gss_spnego_client_request (enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +static void manage_gss_spnego_client_request (struct ntlm_auth_state *state, + char *buf, int length); -static void manage_ntlm_server_1_request (enum stdio_helper_mode stdio_helper_mode, - char *buf, int length); +static void manage_ntlm_server_1_request (struct ntlm_auth_state *state, + char *buf, int length); -static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_mode, char *buf, int length); +static void manage_ntlm_change_password_1_request(struct ntlm_auth_state *state, + char *buf, int length); static const struct { enum stdio_helper_mode mode; @@ -697,8 +702,8 @@ static NTSTATUS do_ccache_ntlm_auth(DATA_BLOB initial_msg, DATA_BLOB challenge_m return NT_STATUS_MORE_PROCESSING_REQUIRED; } -static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, + char *buf, int length) { static NTLMSSP_STATE *ntlmssp_state = NULL; static char* want_feature_list = NULL; @@ -816,8 +821,8 @@ static void manage_squid_ntlmssp_request(enum stdio_helper_mode stdio_helper_mod data_blob_free(&request); } -static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, + char *buf, int length) { /* The statics here are *HORRIBLE* and this entire concept needs to be rewritten. Essentially it's using these statics @@ -987,8 +992,8 @@ static void manage_client_ntlmssp_request(enum stdio_helper_mode stdio_helper_mo data_blob_free(&request); } -static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_squid_basic_request(struct ntlm_auth_state *state, + char *buf, int length) { char *user, *pass; user=buf; @@ -1002,7 +1007,7 @@ static void manage_squid_basic_request(enum stdio_helper_mode stdio_helper_mode, *pass='\0'; pass++; - if (stdio_helper_mode == SQUID_2_5_BASIC) { + if (state->helper_mode == SQUID_2_5_BASIC) { rfc1738_unescape(user); rfc1738_unescape(pass); } @@ -1071,8 +1076,8 @@ static void offer_gss_spnego_mechs(void) { return; } -static void manage_gss_spnego_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_gss_spnego_request(struct ntlm_auth_state *state, + char *buf, int length) { static NTLMSSP_STATE *ntlmssp_state = NULL; SPNEGO_DATA request, response; @@ -1545,8 +1550,8 @@ static void manage_client_krb5_targ(SPNEGO_DATA spnego) #endif -static void manage_gss_spnego_client_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_gss_spnego_client_request(struct ntlm_auth_state *state, + char *buf, int length) { DATA_BLOB request; SPNEGO_DATA spnego; @@ -1683,8 +1688,8 @@ static void manage_gss_spnego_client_request(enum stdio_helper_mode stdio_helper return; } -static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mode, - char *buf, int length) +static void manage_ntlm_server_1_request(struct ntlm_auth_state *state, + char *buf, int length) { char *request, *parameter; static DATA_BLOB challenge; @@ -1876,7 +1881,8 @@ static void manage_ntlm_server_1_request(enum stdio_helper_mode stdio_helper_mod } } -static void manage_ntlm_change_password_1_request(enum stdio_helper_mode helper_mode, char *buf, int length) +static void manage_ntlm_change_password_1_request(struct ntlm_auth_state *state, + char *buf, int length) { char *request, *parameter; static DATA_BLOB new_nt_pswd; @@ -2141,7 +2147,7 @@ static void manage_squid_request(struct ntlm_auth_state *state, return; } - fn(state->helper_mode, buf, length); + fn(state, buf, length); talloc_free(buf); } -- cgit From 4b05fd29e6f19a63194d4af6d4c499591235cfb1 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 18 Jan 2008 14:40:47 +0100 Subject: ntlm_auth: Rewrite manage_client_ntlmssp_request without statics. (This used to be commit af438426222f4990f3e4103babbbb5de03ade93d) --- source3/utils/ntlm_auth.c | 121 +++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 55 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 8387833540..751dd2001d 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -62,6 +62,12 @@ struct ntlm_auth_state { enum stdio_helper_mode helper_mode; enum ntlm_auth_cli_state cli_state; enum ntlm_auth_svr_state svr_state; + struct ntlmssp_state *ntlmssp_state; + uint32_t neg_flags; + char *want_feature_list; + bool have_session_key; + DATA_BLOB session_key; + DATA_BLOB initial_message; }; typedef void (*stdio_helper_function)(struct ntlm_auth_state *state, char *buf, @@ -824,20 +830,9 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, char *buf, int length) { - /* The statics here are *HORRIBLE* and this entire concept - needs to be rewritten. Essentially it's using these statics - as the state in a state machine. BLEEEGH ! JRA. */ - - static NTLMSSP_STATE *ntlmssp_state = NULL; - static DATA_BLOB initial_message; - static char* want_feature_list = NULL; - static uint32 neg_flags = 0; - static bool have_session_key = False; - static DATA_BLOB session_key; DATA_BLOB request, reply; NTSTATUS nt_status; - bool first = False; - + if (!opt_username || !*opt_username) { x_fprintf(x_stderr, "username must be specified!\n\n"); exit(1); @@ -852,8 +847,9 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, if (strlen(buf) > 3) { if(strncmp(buf, "SF ", 3) == 0) { DEBUG(10, ("Looking for flags to negotiate\n")); - SAFE_FREE(want_feature_list); - want_feature_list = SMB_STRNDUP(buf+3, strlen(buf)-3); + talloc_free(state->want_feature_list); + state->want_feature_list = talloc_strdup(state->mem_ctx, + buf+3); x_fprintf(x_stdout, "OK\n"); return; } @@ -865,7 +861,8 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, if (strncmp(buf, "PW ", 3) == 0) { /* We asked for a password and obviously got it :-) */ - opt_password = SMB_STRNDUP((const char *)request.data, request.length); + opt_password = SMB_STRNDUP((const char *)request.data, + request.length); if (opt_password == NULL) { DEBUG(1, ("Out of memory\n")); @@ -879,8 +876,8 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, return; } - if (!ntlmssp_state && use_cached_creds) { - /* check whether credentials are usable. */ + if (!state->ntlmssp_state && use_cached_creds) { + /* check whether cached credentials are usable. */ DATA_BLOB empty_blob = data_blob_null; nt_status = do_ccache_ntlm_auth(empty_blob, empty_blob, NULL); @@ -891,31 +888,39 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, } if (opt_password == NULL && !use_cached_creds) { - /* Request a password from the calling process. After - sending it, the calling process should retry asking for the negotiate. */ - + sending it, the calling process should retry asking for the + negotiate. */ + DEBUG(10, ("Requesting password\n")); x_fprintf(x_stdout, "PW\n"); return; } if (strncmp(buf, "YR", 2) == 0) { - if (ntlmssp_state) - ntlmssp_end(&ntlmssp_state); + if (state->ntlmssp_state) + ntlmssp_end(&state->ntlmssp_state); + state->cli_state = CLIENT_INITIAL; } else if (strncmp(buf, "TT", 2) == 0) { - + /* No special preprocessing required */ } else if (strncmp(buf, "GF", 2) == 0) { DEBUG(10, ("Requested negotiated NTLMSSP flags\n")); - x_fprintf(x_stdout, "GF 0x%08lx\n", have_session_key?neg_flags:0l); + + if(state->cli_state == CLIENT_FINISHED) { + x_fprintf(x_stdout, "GF 0x%08x\n", state->neg_flags); + } + else { + x_fprintf(x_stdout, "BH\n"); + } + data_blob_free(&request); return; } else if (strncmp(buf, "GK", 2) == 0 ) { DEBUG(10, ("Requested session key\n")); - if(have_session_key) { - char *key64 = base64_encode_data_blob(talloc_tos(), - session_key); + if(state->cli_state == CLIENT_FINISHED) { + char *key64 = base64_encode_data_blob(state->mem_ctx, + state->session_key); x_fprintf(x_stdout, "GK %s\n", key64?key64:""); TALLOC_FREE(key64); } @@ -931,39 +936,42 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, return; } - if (!ntlmssp_state) { - if (!NT_STATUS_IS_OK(nt_status = ntlm_auth_start_ntlmssp_client(&ntlmssp_state))) { + if (!state->ntlmssp_state) { + nt_status = ntlm_auth_start_ntlmssp_client( + &state->ntlmssp_state); + if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); return; } - ntlmssp_want_feature_list(ntlmssp_state, want_feature_list); - first = True; - initial_message = data_blob_null; + ntlmssp_want_feature_list(state->ntlmssp_state, + state->want_feature_list); + state->initial_message = data_blob_null; } DEBUG(10, ("got NTLMSSP packet:\n")); dump_data(10, request.data, request.length); - if (use_cached_creds && !opt_password && !first) { - nt_status = do_ccache_ntlm_auth(initial_message, request, &reply); + if (use_cached_creds && !opt_password && + (state->cli_state == CLIENT_RESPONSE)) { + nt_status = do_ccache_ntlm_auth(state->initial_message, request, + &reply); } else { - nt_status = ntlmssp_update(ntlmssp_state, request, &reply); + nt_status = ntlmssp_update(state->ntlmssp_state, request, + &reply); } - + if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - char *reply_base64 = base64_encode_data_blob(talloc_tos(), + char *reply_base64 = base64_encode_data_blob(state->mem_ctx, reply); - if (first) { + if (state->cli_state == CLIENT_INITIAL) { x_fprintf(x_stdout, "YR %s\n", reply_base64); - } else { - x_fprintf(x_stdout, "KK %s\n", reply_base64); - } - TALLOC_FREE(reply_base64); - if (first) { - initial_message = reply; + state->initial_message = reply; + state->cli_state = CLIENT_RESPONSE; } else { + x_fprintf(x_stdout, "KK %s\n", reply_base64); data_blob_free(&reply); } + TALLOC_FREE(reply_base64); DEBUG(10, ("NTLMSSP challenge\n")); } else if (NT_STATUS_IS_OK(nt_status)) { char *reply_base64 = base64_encode_data_blob(talloc_tos(), @@ -971,22 +979,25 @@ static void manage_client_ntlmssp_request(struct ntlm_auth_state *state, x_fprintf(x_stdout, "AF %s\n", reply_base64); TALLOC_FREE(reply_base64); - if(have_session_key) - data_blob_free(&session_key); + if(state->have_session_key) + data_blob_free(&state->session_key); - session_key = data_blob(ntlmssp_state->session_key.data, - ntlmssp_state->session_key.length); - neg_flags = ntlmssp_state->neg_flags; - have_session_key = True; + state->session_key = data_blob( + state->ntlmssp_state->session_key.data, + state->ntlmssp_state->session_key.length); + state->neg_flags = state->ntlmssp_state->neg_flags; + state->have_session_key = true; DEBUG(10, ("NTLMSSP OK!\n")); - if (ntlmssp_state) - ntlmssp_end(&ntlmssp_state); + state->cli_state = CLIENT_FINISHED; + if (state->ntlmssp_state) + ntlmssp_end(&state->ntlmssp_state); } else { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status))); - if (ntlmssp_state) - ntlmssp_end(&ntlmssp_state); + state->cli_state = CLIENT_ERROR; + if (state->ntlmssp_state) + ntlmssp_end(&state->ntlmssp_state); } data_blob_free(&request); @@ -2167,7 +2178,7 @@ static void squid_stream(enum stdio_helper_mode stdio_mode, stdio_helper_functio exit(1); } - state = talloc(mem_ctx, struct ntlm_auth_state); + state = talloc_zero(mem_ctx, struct ntlm_auth_state); if (!state) { DEBUG(0, ("squid_stream: Failed to talloc ntlm_auth_state\n")); x_fprintf(x_stderr, "ERR\n"); -- cgit From b133f5ac0abaa7afb7ddf67d1916a0247cf91a5c Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Sat, 19 Jan 2008 12:29:03 +0100 Subject: ntlm_auth: Get rid of statics in manage_squid_ntlmssp_request (This used to be commit 97768628f5ec533818b7f5165e92c156d668b79b) --- source3/utils/ntlm_auth.c | 87 +++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 37 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 751dd2001d..3e2093a194 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -1,23 +1,24 @@ -/* +/* Unix SMB/CIFS implementation. Winbind status program. Copyright (C) Tim Potter 2000-2003 Copyright (C) Andrew Bartlett 2003-2004 - Copyright (C) Francesco Chemolli 2000 + Copyright (C) Francesco Chemolli 2000 Copyright (C) Robert O'Callahan 2006 (added cached credential code). + Copyright (C) Kai Blin 2008 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 the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -152,7 +153,7 @@ static char winbind_separator(void) d_printf("winbind separator was NULL!\n"); return *lp_winbind_separator(); } - + return sep; } @@ -711,11 +712,6 @@ static NTSTATUS do_ccache_ntlm_auth(DATA_BLOB initial_msg, DATA_BLOB challenge_m static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, char *buf, int length) { - static NTLMSSP_STATE *ntlmssp_state = NULL; - static char* want_feature_list = NULL; - static uint32 neg_flags = 0; - static bool have_session_key = False; - static DATA_BLOB session_key; DATA_BLOB request, reply; NTSTATUS nt_status; @@ -728,8 +724,9 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, if (strlen(buf) > 3) { if(strncmp(buf, "SF ", 3) == 0){ DEBUG(10, ("Setting flags to negotioate\n")); - SAFE_FREE(want_feature_list); - want_feature_list = SMB_STRNDUP(buf+3, strlen(buf)-3); + TALLOC_FREE(state->want_feature_list); + state->want_feature_list = talloc_strdup(state->mem_ctx, + buf+3); x_fprintf(x_stdout, "OK\n"); return; } @@ -739,9 +736,11 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, } if ((strncmp(buf, "PW ", 3) == 0)) { - /* The calling application wants us to use a local password (rather than winbindd) */ + /* The calling application wants us to use a local password + * (rather than winbindd) */ - opt_password = SMB_STRNDUP((const char *)request.data, request.length); + opt_password = SMB_STRNDUP((const char *)request.data, + request.length); if (opt_password == NULL) { DEBUG(1, ("Out of memory\n")); @@ -756,26 +755,33 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, } if (strncmp(buf, "YR", 2) == 0) { - if (ntlmssp_state) - ntlmssp_end(&ntlmssp_state); + if (state->ntlmssp_state) + ntlmssp_end(&state->ntlmssp_state); + state->svr_state = SERVER_INITIAL; } else if (strncmp(buf, "KK", 2) == 0) { - + /* No special preprocessing required */ } else if (strncmp(buf, "GF", 2) == 0) { DEBUG(10, ("Requested negotiated NTLMSSP flags\n")); - x_fprintf(x_stdout, "GF 0x%08lx\n", have_session_key?neg_flags:0l); + + if (state->svr_state == SERVER_FINISHED) { + x_fprintf(x_stdout, "GF 0x%08x\n", state->neg_flags); + } + else { + x_fprintf(x_stdout, "BH\n"); + } data_blob_free(&request); return; } else if (strncmp(buf, "GK", 2) == 0) { DEBUG(10, ("Requested NTLMSSP session key\n")); - if(have_session_key) { - char *key64 = base64_encode_data_blob(talloc_tos(), - session_key); + if(state->have_session_key) { + char *key64 = base64_encode_data_blob(state->mem_ctx, + state->session_key); x_fprintf(x_stdout, "GK %s\n", key64?key64:""); TALLOC_FREE(key64); } else { x_fprintf(x_stdout, "BH\n"); } - + data_blob_free(&request); return; } else { @@ -784,44 +790,51 @@ static void manage_squid_ntlmssp_request(struct ntlm_auth_state *state, return; } - if (!ntlmssp_state) { - if (!NT_STATUS_IS_OK(nt_status = ntlm_auth_start_ntlmssp_server(&ntlmssp_state))) { + if (!state->ntlmssp_state) { + nt_status = ntlm_auth_start_ntlmssp_server( + &state->ntlmssp_state); + if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); return; } - ntlmssp_want_feature_list(ntlmssp_state, want_feature_list); + ntlmssp_want_feature_list(state->ntlmssp_state, + state->want_feature_list); } DEBUG(10, ("got NTLMSSP packet:\n")); dump_data(10, request.data, request.length); - nt_status = ntlmssp_update(ntlmssp_state, request, &reply); - + nt_status = ntlmssp_update(state->ntlmssp_state, request, &reply); + if (NT_STATUS_EQUAL(nt_status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { - char *reply_base64 = base64_encode_data_blob(talloc_tos(), + char *reply_base64 = base64_encode_data_blob(state->mem_ctx, reply); x_fprintf(x_stdout, "TT %s\n", reply_base64); TALLOC_FREE(reply_base64); data_blob_free(&reply); + state->svr_state = SERVER_CHALLENGE; DEBUG(10, ("NTLMSSP challenge\n")); } else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCESS_DENIED)) { x_fprintf(x_stdout, "BH %s\n", nt_errstr(nt_status)); DEBUG(0, ("NTLMSSP BH: %s\n", nt_errstr(nt_status))); - ntlmssp_end(&ntlmssp_state); + ntlmssp_end(&state->ntlmssp_state); } else if (!NT_STATUS_IS_OK(nt_status)) { x_fprintf(x_stdout, "NA %s\n", nt_errstr(nt_status)); DEBUG(10, ("NTLMSSP %s\n", nt_errstr(nt_status))); } else { - x_fprintf(x_stdout, "AF %s\n", (char *)ntlmssp_state->auth_context); + x_fprintf(x_stdout, "AF %s\n", + (char *)state->ntlmssp_state->auth_context); DEBUG(10, ("NTLMSSP OK!\n")); - - if(have_session_key) - data_blob_free(&session_key); - session_key = data_blob(ntlmssp_state->session_key.data, - ntlmssp_state->session_key.length); - neg_flags = ntlmssp_state->neg_flags; - have_session_key = True; + + if(state->have_session_key) + data_blob_free(&state->session_key); + state->session_key = data_blob( + state->ntlmssp_state->session_key.data, + state->ntlmssp_state->session_key.length); + state->neg_flags = state->ntlmssp_state->neg_flags; + state->have_session_key = true; + state->svr_state = SERVER_FINISHED; } data_blob_free(&request); -- cgit From 398c323f7544e815cfeb2b750f9ff28061c294f3 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Sat, 19 Jan 2008 12:27:31 +0100 Subject: afs: Use talloc_stackframe() instead of talloc_init() Thanks to vl for pointing this out. (This used to be commit 76cf5a979bf3014b1de660520e538546b3676b23) --- source3/lib/afs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/lib/afs.c b/source3/lib/afs.c index b3d590bf24..9f5d81f442 100644 --- a/source3/lib/afs.c +++ b/source3/lib/afs.c @@ -48,7 +48,7 @@ static char *afs_encode_token(const char *cell, const DATA_BLOB ticket, char *base64_key; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("afs_encode_token"); + mem_ctx = talloc_stackframe(); if (mem_ctx == NULL) goto done; -- cgit From 5a48ee89b8527534064439678f98365057912d77 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 13:37:40 +0100 Subject: Fix the build ... forgot to "git add" it (This used to be commit 6d0a727f26dd0945634486f18a55aa8dd5813983) --- source3/include/includes.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/include/includes.h b/source3/include/includes.h index e9477d8ba1..7eca8d3ddf 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -702,6 +702,7 @@ typedef char fstring[FSTRING_LEN]; #include "rpc_perfcount.h" #include "rpc_perfcount_defs.h" #include "librpc/gen_ndr/notify.h" +#include "librpc/gen_ndr/xattr.h" #include "nt_printing.h" #include "idmap.h" #include "client.h" -- cgit From 6d7eb2e6ecec5920fe347c5d75d8596bd289eecf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 15 Jan 2008 13:22:39 +0100 Subject: Make get_ea_value public (This used to be commit 0aa406bbba8699063ea3758b19dca24cf42ff15a) --- source3/smbd/trans2.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 935a881607..12b0f20879 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -114,8 +114,9 @@ static bool samba_private_attr_name(const char *unix_ea_name) Get one EA value. Fill in a struct ea_struct. ****************************************************************************/ -static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, - const char *fname, char *ea_name, struct ea_struct *pea) +NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, + files_struct *fsp, const char *fname, + const char *ea_name, struct ea_struct *pea) { /* Get the value of this xattr. Max size is 64k. */ size_t attr_size = 256; @@ -126,7 +127,7 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str val = TALLOC_REALLOC_ARRAY(mem_ctx, val, char, attr_size); if (!val) { - return False; + return NT_STATUS_NO_MEMORY; } if (fsp && fsp->fh->fd != -1) { @@ -141,7 +142,7 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str } if (sizeret == -1) { - return False; + return map_nt_error_from_unix(errno); } DEBUG(10,("get_ea_value: EA %s is of length %u\n", ea_name, (unsigned int)sizeret)); @@ -149,13 +150,17 @@ static bool get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, files_str pea->flags = 0; if (strnequal(ea_name, "user.", 5)) { - pea->name = &ea_name[5]; + pea->name = talloc_strdup(mem_ctx, &ea_name[5]); } else { - pea->name = ea_name; + pea->name = talloc_strdup(mem_ctx, ea_name); + } + if (pea->name == NULL) { + TALLOC_FREE(val); + return NT_STATUS_NO_MEMORY; } pea->value.data = (unsigned char *)val; pea->value.length = (size_t)sizeret; - return True; + return NT_STATUS_OK; } /**************************************************************************** @@ -215,7 +220,9 @@ static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_str if (!listp) return NULL; - if (!get_ea_value(mem_ctx, conn, fsp, fname, p, &listp->ea)) { + if (!NT_STATUS_IS_OK(get_ea_value(mem_ctx, conn, fsp, + fname, p, + &listp->ea))) { return NULL; } -- cgit From 84518f1fc74437c61b79080671f3adfd809b2c32 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 16:07:56 +0100 Subject: Add get_ea_names_from_file to sanely list posix xattrs Refactor get_ea_list_from_file to use that. (This used to be commit aec357a456798050abe565d2a744ed5f17ad5901) --- source3/smbd/trans2.c | 191 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 142 insertions(+), 49 deletions(-) diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 12b0f20879..53eff65b54 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -163,86 +163,179 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, return NT_STATUS_OK; } -/**************************************************************************** - Return a linked list of the total EA's. Plus the total size -****************************************************************************/ - -static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, - const char *fname, size_t *pea_total_len) +NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, + files_struct *fsp, const char *fname, + char ***pnames, size_t *pnum_names) { /* Get a list of all xattrs. Max namesize is 64k. */ size_t ea_namelist_size = 1024; - char *ea_namelist; + char *ea_namelist = NULL; + char *p; + char **names, **tmp; + size_t num_names; ssize_t sizeret; - int i; - struct ea_list *ea_list_head = NULL; - - *pea_total_len = 0; if (!lp_ea_support(SNUM(conn))) { - return NULL; + *pnames = NULL; + *pnum_names = 0; + return NT_STATUS_OK; } - for (i = 0, ea_namelist = TALLOC_ARRAY(mem_ctx, char, ea_namelist_size); i < 6; - ea_namelist = TALLOC_REALLOC_ARRAY(mem_ctx, ea_namelist, char, ea_namelist_size), i++) { + /* + * TALLOC the result early to get the talloc hierarchy right. + */ - if (!ea_namelist) { - return NULL; + names = TALLOC_ARRAY(mem_ctx, char *, 1); + if (names == NULL) { + DEBUG(0, ("talloc failed\n")); + return NT_STATUS_NO_MEMORY; + } + + while (ea_namelist_size <= 65536) { + + ea_namelist = TALLOC_REALLOC_ARRAY( + names, ea_namelist, char, ea_namelist_size); + if (ea_namelist == NULL) { + DEBUG(0, ("talloc failed\n")); + TALLOC_FREE(names); + return NT_STATUS_NO_MEMORY; } if (fsp && fsp->fh->fd != -1) { - sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist, ea_namelist_size); + sizeret = SMB_VFS_FLISTXATTR(fsp, ea_namelist, + ea_namelist_size); } else { - sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist, ea_namelist_size); + sizeret = SMB_VFS_LISTXATTR(conn, fname, ea_namelist, + ea_namelist_size); } - if (sizeret == -1 && errno == ERANGE) { + if ((sizeret == -1) && (errno = ERANGE)) { ea_namelist_size *= 2; - } else { + } + else { break; } } - if (sizeret == -1) - return NULL; + if (sizeret == -1) { + TALLOC_FREE(names); + return map_nt_error_from_unix(errno); + } - DEBUG(10,("get_ea_list_from_file: ea_namelist size = %u\n", (unsigned int)sizeret )); + DEBUG(10, ("get_ea_list_from_file: ea_namelist size = %u\n", + (unsigned int)sizeret)); - if (sizeret) { - for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p) + 1) { - struct ea_list *listp; + if (sizeret == 0) { + TALLOC_FREE(names); + *pnames = NULL; + *pnum_names = 0; + return NT_STATUS_OK; + } - if (strnequal(p, "system.", 7) || samba_private_attr_name(p)) - continue; + /* + * Ensure the result is 0-terminated + */ - listp = TALLOC_P(mem_ctx, struct ea_list); - if (!listp) - return NULL; + if (ea_namelist[sizeret-1] != '\0') { + TALLOC_FREE(names); + return NT_STATUS_INTERNAL_ERROR; + } - if (!NT_STATUS_IS_OK(get_ea_value(mem_ctx, conn, fsp, - fname, p, - &listp->ea))) { - return NULL; - } + /* + * count the names + */ + num_names = 0; - { - fstring dos_ea_name; - push_ascii_fstring(dos_ea_name, listp->ea.name); - *pea_total_len += 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length; - DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len = %u\n", - (unsigned int)*pea_total_len, dos_ea_name, - (unsigned int)listp->ea.value.length )); - } - DLIST_ADD_END(ea_list_head, listp, struct ea_list *); + for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p)+1) { + num_names += 1; + } + + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, names, char *, num_names); + if (tmp == NULL) { + DEBUG(0, ("talloc failed\n")); + TALLOC_FREE(names); + return NT_STATUS_NO_MEMORY; + } + + names = tmp; + num_names = 0; + + for (p = ea_namelist; p - ea_namelist < sizeret; p += strlen(p)+1) { + names[num_names++] = p; + } + + *pnames = names; + *pnum_names = num_names; + return NT_STATUS_OK; +} + +/**************************************************************************** + Return a linked list of the total EA's. Plus the total size +****************************************************************************/ + +static struct ea_list *get_ea_list_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, + const char *fname, size_t *pea_total_len) +{ + /* Get a list of all xattrs. Max namesize is 64k. */ + size_t i, num_names; + char **names; + struct ea_list *ea_list_head = NULL; + NTSTATUS status; + + *pea_total_len = 0; + + if (!lp_ea_support(SNUM(conn))) { + return NULL; + } + + status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname, + &names, &num_names); + + if (!NT_STATUS_IS_OK(status) || (num_names == 0)) { + return NULL; + } + + for (i=0; iea))) { + return NULL; } + + push_ascii_fstring(dos_ea_name, listp->ea.name); + + *pea_total_len += + 4 + strlen(dos_ea_name) + 1 + listp->ea.value.length; + + DEBUG(10,("get_ea_list_from_file: total_len = %u, %s, val len " + "= %u\n", (unsigned int)*pea_total_len, dos_ea_name, + (unsigned int)listp->ea.value.length)); + + DLIST_ADD_END(ea_list_head, listp, struct ea_list *); + } - DEBUG(10,("get_ea_list_from_file: total_len = %u\n", (unsigned int)*pea_total_len)); + /* Add on 4 for total length. */ + if (*pea_total_len) { + *pea_total_len += 4; + } + + DEBUG(10, ("get_ea_list_from_file: total_len = %u\n", + (unsigned int)*pea_total_len)); + return ea_list_head; } -- cgit From 3b889a256b6e2414d92c948d2e741773294e7ac9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 16:19:08 +0100 Subject: The remote storage op is gone Alexander, I think this ok... (This used to be commit 197b08ad789c4968155f1c711ef43a5383a89289) --- source3/include/vfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index d03cf3477d..3109a5c3e4 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -103,7 +103,7 @@ /* Leave at 22 - not yet released. Remove parameter fd from write. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ -/* Leave at 22 - not yet released. Additional change: add operations for offline files and remote storage volume abstraction -- ab*/ +/* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */ #define SMB_VFS_INTERFACE_VERSION 22 -- cgit From 70f88005c77cee0848a495da139144206b53eb3f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 15:44:48 +0100 Subject: Fix error return in xattr_tdb_load_attrs (This used to be commit 64e54ea8f76fe57193955aabc1459fe635233aca) --- source3/modules/vfs_xattr_tdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 29864a8f94..597dd38eaf 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -110,7 +110,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx, status = xattr_tdb_pull_attrs(mem_ctx, &data, presult); TALLOC_FREE(data.dptr); - return NT_STATUS_OK; + return status; } /* -- cgit From a0bd9d97a3a701fdb1f9a48ce925f63b786a8070 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 19 Jan 2008 15:14:45 +0100 Subject: Tiny memory leak in lib/version.c Hi, while implementing the extra_info version stuff, it occured to me that samba_version_string() potentially allocates memory which is unused but never free'd. If SAMBA_VERSION_VENDOR_PATCH is defined, a second call to asprintf takes place. The result is stored in tmp_version. Afterwards, samba_version is set to tmp_version without free'ing samba_version first. Looks like a simple free(samba_version) is missing. Patch against 3.2-test below. Ok, this only happens once over the lifetime of the application, so it's no big deal, but I though it doesn't hurt to mention it. Corinna * lib/version.c (samba_version_string): Free samba_version before setting to tmp_version. (This used to be commit 373a23d48f2dd24e65dbf814ea58b4add2322128) --- source3/lib/version.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/lib/version.c b/source3/lib/version.c index 204c2044a8..cbb70ae8a6 100644 --- a/source3/lib/version.c +++ b/source3/lib/version.c @@ -51,6 +51,7 @@ const char *samba_version_string(void) */ assert(res != -1); + free(samba_version); samba_version = tmp_version; #endif -- cgit From 07e07f696ad10f3a5d7a0d9de656ff13600ac97d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 19:31:02 +0100 Subject: Use SAFE_FREE instead of free (This used to be commit 999647329028147d7c29a3348202641b3e03430e) --- source3/lib/version.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/lib/version.c b/source3/lib/version.c index cbb70ae8a6..3cae02ad2e 100644 --- a/source3/lib/version.c +++ b/source3/lib/version.c @@ -51,7 +51,8 @@ const char *samba_version_string(void) */ assert(res != -1); - free(samba_version); + SAFE_FREE(samba_version); + samba_version = tmp_version; #endif -- cgit From 1b976d51928dd6fa923272d277e13e5267188869 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 20:41:15 +0100 Subject: Add the STREAMINFO vfs call Based on jpeach's work, modified the streaminfo prototype Make use of it in trans2.c together with marshall_stream_info() (This used to be commit c34d729c7c0600a8f11bf7e489a634a4e37fe88e) --- source3/include/vfs.h | 10 ++++ source3/include/vfs_macros.h | 3 ++ source3/modules/vfs_default.c | 59 ++++++++++++++++++++++ source3/smbd/trans2.c | 112 +++++++++++++++++++++++++++++++++++++----- 4 files changed, 171 insertions(+), 13 deletions(-) diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 3109a5c3e4..cda28a1680 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -104,6 +104,7 @@ /* Leave at 22 - not yet released. Remove parameter fromfd from sendfile. - obnox */ /* Leave at 22 - not yet released. Remove parameter fromfd from recvfile. - obnox */ /* Leave at 22 - not yet released. Additional change: add operations for offline files -- ab */ +/* Leave at 22 - not yet released. Add the streaminfo call. -- jpeach, vl */ #define SMB_VFS_INTERFACE_VERSION 22 @@ -198,6 +199,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_NOTIFY_WATCH, SMB_VFS_OP_CHFLAGS, SMB_VFS_OP_FILE_ID_CREATE, + SMB_VFS_OP_STREAMINFO, /* NT ACL operations. */ @@ -339,6 +341,13 @@ struct vfs_ops { int (*chflags)(struct vfs_handle_struct *handle, const char *path, unsigned int flags); struct file_id (*file_id_create)(struct vfs_handle_struct *handle, SMB_DEV_T dev, SMB_INO_T inode); + NTSTATUS (*streaminfo)(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *num_streams, + struct stream_struct **streams); + /* NT ACL operations. */ NTSTATUS (*fget_nt_acl)(struct vfs_handle_struct *handle, @@ -476,6 +485,7 @@ struct vfs_ops { struct vfs_handle_struct *notify_watch; struct vfs_handle_struct *chflags; struct vfs_handle_struct *file_id_create; + struct vfs_handle_struct *streaminfo; /* NT ACL operations. */ diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index dd30f977dc..1674f26326 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -82,6 +82,7 @@ #define SMB_VFS_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs.ops.notify_watch((conn)->vfs.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) #define SMB_VFS_CHFLAGS(conn, path, flags) ((conn)->vfs.ops.chflags((conn)->vfs.handles.chflags, (path), (flags))) #define SMB_VFS_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops.file_id_create((conn)->vfs.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs.ops.streaminfo((conn)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) /* NT ACL operations. */ #define SMB_VFS_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs.ops.fget_nt_acl((fsp)->conn->vfs.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) @@ -206,6 +207,7 @@ #define SMB_VFS_OPAQUE_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_opaque.ops.notify_watch((conn)->vfs_opaque.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) #define SMB_VFS_OPAQUE_CHFLAGS(conn, path, flags) ((conn)->vfs_opaque.ops.chflags((conn)->vfs_opaque.handles.chflags, (path), (flags))) #define SMB_VFS_OPAQUE_FILE_ID_CREATE(conn, dev, inode) ((conn)->vfs.ops_opaque.file_id_create((conn)->vfs_opaque.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_OPAQUE_STREAMINFO(conn, fsp, fname, mem_ctx, num_streams, streams) ((conn)->vfs_opaque.ops.streaminfo((conn)->vfs_opaque.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) /* NT ACL operations. */ #define SMB_VFS_OPAQUE_FGET_NT_ACL(fsp, security_info, ppdesc) ((fsp)->conn->vfs_opaque.ops.fget_nt_acl((fsp)->conn->vfs_opaque.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) @@ -331,6 +333,7 @@ #define SMB_VFS_NEXT_NOTIFY_WATCH(conn, ctx, e, callback, private_data, handle_p) ((conn)->vfs_next.ops.notify_watch((conn)->vfs_next.handles.notify_watch, (ctx), (e), (callback), (private_data), (handle_p))) #define SMB_VFS_NEXT_CHFLAGS(handle, path, flags) ((handle)->vfs_next.ops.chflags((handle)->vfs_next.handles.chflags, (path), (flags))) #define SMB_VFS_NEXT_FILE_ID_CREATE(handle, dev, inode) ((handle)->vfs_next.ops.file_id_create((handle)->vfs_next.handles.file_id_create, (dev), (inode))) +#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, num_streams, streams) ((handle)->vfs.ops.streaminfo((handle)->vfs.handles.streaminfo, (fsp), (fname), (mem_ctx), (num_streams), (streams))) /* NT ACL operations. */ #define SMB_VFS_NEXT_FGET_NT_ACL(handle, fsp, security_info, ppdesc) ((handle)->vfs_next.ops.fget_nt_acl((handle)->vfs_next.handles.fget_nt_acl, (fsp), (security_info), (ppdesc))) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 31234f23ec..2e620d04cc 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -942,6 +942,63 @@ static struct file_id vfswrap_file_id_create(struct vfs_handle_struct *handle, S return file_id_create_dev(dev, inode); } +static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, + struct files_struct *fsp, + const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *pnum_streams, + struct stream_struct **pstreams) +{ + SMB_STRUCT_STAT sbuf; + NTSTATUS status; + unsigned int num_streams = 0; + struct stream_struct *streams = NULL; + int ret; + + if ((fsp != NULL) && (fsp->is_directory)) { + /* + * No default streams on directories + */ + goto done; + } + + if ((fsp != NULL) && (fsp->fh->fd != -1)) { + ret = SMB_VFS_FSTAT(fsp, &sbuf); + } + else { + ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); + } + + if (ret == -1) { + return map_nt_error_from_unix(errno); + } + + if (S_ISDIR(sbuf.st_mode)) { + goto done; + } + + streams = talloc(mem_ctx, struct stream_struct); + + if (streams == NULL) { + return NT_STATUS_NO_MEMORY; + } + + streams->size = sbuf.st_size; + streams->alloc_size = get_allocation_size(handle->conn, fsp, &sbuf); + + streams->name = talloc_strdup(streams, "::$DATA"); + if (streams->name == NULL) { + TALLOC_FREE(streams); + return NT_STATUS_NO_MEMORY; + } + + num_streams = 1; + done: + *pnum_streams = num_streams; + *pstreams = streams; + return NT_STATUS_OK; +} + static NTSTATUS vfswrap_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) @@ -1367,6 +1424,8 @@ static vfs_op_tuple vfs_default_ops[] = { SMB_VFS_LAYER_OPAQUE}, {SMB_VFS_OP(vfswrap_file_id_create), SMB_VFS_OP_FILE_ID_CREATE, SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(vfswrap_streaminfo), SMB_VFS_OP_STREAMINFO, + SMB_VFS_LAYER_OPAQUE}, /* NT ACL operations. */ diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 53eff65b54..d56a0dab09 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5,7 +5,7 @@ Copyright (C) Stefan (metze) Metzmacher 2003 Copyright (C) Volker Lendecke 2005-2007 Copyright (C) Steve French 2005 - Copyright (C) James Peach 2007 + Copyright (C) James Peach 2006-2007 Extensively modified by Andrew Tridgell, 1995 @@ -3568,6 +3568,72 @@ static char *store_file_unix_basic_info2(connection_struct *conn, return pdata; } +static NTSTATUS marshall_stream_info(unsigned int num_streams, + const struct stream_struct *streams, + char *data, + unsigned int max_data_bytes, + unsigned int *data_size) +{ + unsigned int i; + unsigned int ofs = 0; + + for (i=0; i max_data_bytes) { + TALLOC_FREE(namebuf); + return NT_STATUS_BUFFER_TOO_SMALL; + } + + SIVAL(data, ofs+4, namelen); + SOFF_T(data, ofs+8, streams[i].size); + SOFF_T(data, ofs+16, streams[i].alloc_size); + memcpy(data+ofs+24, namebuf, namelen); + TALLOC_FREE(namebuf); + + next_offset = ofs + 24 + namelen; + + if (i == num_streams-1) { + SIVAL(data, ofs, 0); + } + else { + unsigned int align = ndr_align_size(next_offset, 8); + + if (next_offset + align > max_data_bytes) { + return NT_STATUS_BUFFER_TOO_SMALL; + } + + memset(data+next_offset, 0, align); + next_offset += align; + + SIVAL(data, ofs, next_offset - ofs); + ofs = next_offset; + } + + ofs = next_offset; + } + + *data_size = ofs; + + return NT_STATUS_OK; +} + /**************************************************************************** Reply to a TRANSACT2_QFILEINFO on a PIPE ! ****************************************************************************/ @@ -4273,20 +4339,40 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd */ case SMB_QUERY_FILE_STREAM_INFO: #endif - case SMB_FILE_STREAM_INFORMATION: - DEBUG(10,("call_trans2qfilepathinfo: SMB_FILE_STREAM_INFORMATION\n")); - if (mode & aDIR) { - data_size = 0; - } else { - size_t byte_len = dos_PutUniCode(pdata+24,"::$DATA", (size_t)0xE, False); - SIVAL(pdata,0,0); /* ??? */ - SIVAL(pdata,4,byte_len); /* Byte length of unicode string ::$DATA */ - SOFF_T(pdata,8,file_size); - SOFF_T(pdata,16,allocation_size); - data_size = 24 + byte_len; + case SMB_FILE_STREAM_INFORMATION: { + unsigned int num_streams; + struct stream_struct *streams; + NTSTATUS status; + + DEBUG(10,("call_trans2qfilepathinfo: " + "SMB_FILE_STREAM_INFORMATION\n")); + + status = SMB_VFS_STREAMINFO( + conn, fsp, fname, talloc_tos(), + &num_streams, &streams); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("could not get stream info: %s\n", + nt_errstr(status))); + reply_nterror(req, status); + return; } - break; + status = marshall_stream_info(num_streams, streams, + pdata, max_data_bytes, + &data_size); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("marshall_stream_info failed: %s\n", + nt_errstr(status))); + reply_nterror(req, status); + return; + } + + TALLOC_FREE(streams); + + break; + } case SMB_QUERY_COMPRESSION_INFO: case SMB_FILE_COMPRESSION_INFORMATION: DEBUG(10,("call_trans2qfilepathinfo: SMB_FILE_COMPRESSION_INFORMATION\n")); -- cgit From 14e7c292bc76b0edb8cafcaa728a612fa806fa6d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 22:44:55 +0100 Subject: Add an error mapping for ENOATTR (This used to be commit 9f0d778490415b05224f36287df999672ee16928) --- source3/lib/errmap_unix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c index 885a1c55b2..8194cf80cc 100644 --- a/source3/lib/errmap_unix.c +++ b/source3/lib/errmap_unix.c @@ -92,6 +92,9 @@ const struct unix_error_map unix_dos_nt_errmap[] = { #ifdef EWOULDBLOCK { EWOULDBLOCK, ERRDOS, 111, NT_STATUS_NETWORK_BUSY }, #endif +#ifdef ENOATTR + { ENOATTR, ERRDOS, ERRbadfile, NT_STATUS_NOT_FOUND }, +#endif { 0, 0, 0, NT_STATUS_OK } }; -- cgit From 2411c6cb90e485bd289b8b654db1c632556bfb2d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 23:10:09 +0100 Subject: Add "split_ntfs_stream_name()" together with a torture test (This used to be commit d813bd9e02d9baf916eb96c478be89f0c435e07c) --- source3/lib/util.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++ source3/smbd/nttrans.c | 3 ++ source3/torture/torture.c | 69 ++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+) diff --git a/source3/lib/util.c b/source3/lib/util.c index bc3eaa8d5e..11f3660df8 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3273,3 +3273,93 @@ void *talloc_zeronull(const void *context, size_t size, const char *name) return talloc_named_const(context, size, name); } #endif + +/* Split a path name into filename and stream name components. Canonicalise + * such that an implicit $DATA token is always explicit. + * + * The "specification" of this function can be found in the + * run_local_stream_name() function in torture.c, I've tried those + * combinations against a W2k3 server. + */ + +NTSTATUS split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname, + char **pbase, char **pstream) +{ + char *base = NULL; + char *stream = NULL; + char *sname; /* stream name */ + const char *stype; /* stream type */ + + DEBUG(10, ("split_ntfs_stream_name called for [%s]\n", fname)); + + sname = strchr_m(fname, ':'); + + if (lp_posix_pathnames() || (sname == NULL)) { + if (pbase != NULL) { + base = talloc_strdup(mem_ctx, fname); + NT_STATUS_HAVE_NO_MEMORY(base); + } + goto done; + } + + if (pbase != NULL) { + base = talloc_strndup(mem_ctx, fname, PTR_DIFF(sname, fname)); + NT_STATUS_HAVE_NO_MEMORY(base); + } + + sname += 1; + + stype = strchr_m(sname, ':'); + + if (stype == NULL) { + sname = talloc_strdup(mem_ctx, sname); + stype = "$DATA"; + } + else { + if (StrCaseCmp(stype, ":$DATA") != 0) { + /* + * If there is an explicit stream type, so far we only + * allow $DATA. Is there anything else allowed? -- vl + */ + DEBUG(10, ("[%s] is an invalid stream type\n", stype)); + TALLOC_FREE(base); + return NT_STATUS_OBJECT_NAME_INVALID; + } + sname = talloc_strndup(mem_ctx, sname, PTR_DIFF(stype, sname)); + stype += 1; + } + + if (sname == NULL) { + TALLOC_FREE(base); + return NT_STATUS_NO_MEMORY; + } + + if (sname[0] == '\0') { + /* + * no stream name, so no stream + */ + goto done; + } + + if (pstream != NULL) { + stream = talloc_asprintf(mem_ctx, "%s:%s", sname, stype); + if (stream == NULL) { + TALLOC_FREE(sname); + TALLOC_FREE(base); + return NT_STATUS_NO_MEMORY; + } + /* + * upper-case the type field + */ + strupper_m(strchr_m(stream, ':')+1); + } + + done: + if (pbase != NULL) { + *pbase = base; + } + if (pstream != NULL) { + *pstream = stream; + } + return NT_STATUS_OK; +} diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e8df732ea2..9381174af0 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -271,6 +271,9 @@ void send_nt_replies(connection_struct *conn, /**************************************************************************** Is it an NTFS stream name ? + An NTFS file name is .:: + $DATA can be used as both a stream name and a stream type. A missing stream + name or type implies $DATA. ****************************************************************************/ bool is_ntfs_stream_name(const char *fname) diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 05b41413b4..070474cf6f 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -5098,6 +5098,74 @@ static bool run_local_rbtree(int dummy) return ret; } +static bool test_stream_name(const char *fname, const char *expected_base, + const char *expected_stream, + NTSTATUS expected_status) +{ + NTSTATUS status; + char *base = NULL; + char *stream = NULL; + + status = split_ntfs_stream_name(talloc_tos(), fname, &base, &stream); + if (!NT_STATUS_EQUAL(status, expected_status)) { + goto error; + } + + if (!NT_STATUS_IS_OK(status)) { + return true; + } + + if (base == NULL) goto error; + + if (strcmp(expected_base, base) != 0) goto error; + + if ((expected_stream != NULL) && (stream == NULL)) goto error; + if ((expected_stream == NULL) && (stream != NULL)) goto error; + + if ((stream != NULL) && (strcmp(expected_stream, stream) != 0)) + goto error; + + TALLOC_FREE(base); + TALLOC_FREE(stream); + return true; + + error: + d_fprintf(stderr, "test_stream(%s, %s, %s, %s)\n", + fname, expected_base ? expected_base : "", + expected_stream ? expected_stream : "", + nt_errstr(expected_status)); + d_fprintf(stderr, "-> base=%s, stream=%s, status=%s\n", + base ? base : "", stream ? stream : "", + nt_errstr(status)); + TALLOC_FREE(base); + TALLOC_FREE(stream); + return false; +} + +static bool run_local_stream_name(int dummy) +{ + bool ret = true; + + ret &= test_stream_name( + "bla", "bla", NULL, NT_STATUS_OK); + ret &= test_stream_name( + "bla::$DATA", "bla", NULL, NT_STATUS_OK); + ret &= test_stream_name( + "bla:blub:", "bla", NULL, NT_STATUS_OBJECT_NAME_INVALID); + ret &= test_stream_name( + "bla::", NULL, NULL, NT_STATUS_OBJECT_NAME_INVALID); + ret &= test_stream_name( + "bla::123", "bla", NULL, NT_STATUS_OBJECT_NAME_INVALID); + ret &= test_stream_name( + "bla:$DATA", "bla", "$DATA:$DATA", NT_STATUS_OK); + ret &= test_stream_name( + "bla:x:$DATA", "bla", "x:$DATA", NT_STATUS_OK); + ret &= test_stream_name( + "bla:x", "bla", "x:$DATA", NT_STATUS_OK); + + return ret; +} + static bool data_blob_equal(DATA_BLOB a, DATA_BLOB b) { if (a.length != b.length) { @@ -5328,6 +5396,7 @@ static struct { { "LOCAL-GENCACHE", run_local_gencache, 0}, { "LOCAL-RBTREE", run_local_rbtree, 0}, { "LOCAL-MEMCACHE", run_local_memcache, 0}, + { "LOCAL-STREAM-NAME", run_local_stream_name, 0}, {NULL, NULL, 0}}; -- cgit From 1069cfe4ade88a032164c1242c9480a544584655 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 23:25:36 +0100 Subject: Add streams support This is the core of the streams support. The main change is that in files_struct there is now a base_fsp pointer that holds the main file open while a stream is open. This is necessary to get the rather strange delete semantics right: You can't delete the main file while a stream is open without FILE_SHARE_DELETE, and while a stream is open a successful unlink of the main file leads to DELETE_PENDING for all further access on the main file or any stream. (This used to be commit 6022873cc155bdbbd3fb620689715f07a24d6ed1) --- source3/include/smb.h | 5 ++ source3/smbd/close.c | 115 +++++++++++++++++++++++++- source3/smbd/filename.c | 121 +++++++++++++++++++++++++++ source3/smbd/open.c | 214 +++++++++++++++++++++++++++++++++++++++++++++--- source3/smbd/reply.c | 28 +++++-- 5 files changed, 459 insertions(+), 24 deletions(-) diff --git a/source3/include/smb.h b/source3/include/smb.h index 15e51dbdd7..25421115c8 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -513,6 +513,8 @@ typedef struct files_struct { FAKE_FILE_HANDLE *fake_file_handle; struct notify_change_buf *notify; + + struct files_struct *base_fsp; /* placeholder for delete on close */ } files_struct; #include "ntquotas.h" @@ -1369,6 +1371,9 @@ struct bitmap { #define NTCREATEX_OPTIONS_PRIVATE_DENY_DOS 0x01000000 #define NTCREATEX_OPTIONS_PRIVATE_DENY_FCB 0x02000000 +/* Private options for streams support */ +#define NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE 0x04000000 + /* Responses when opening a file. */ #define FILE_WAS_SUPERSEDED 0 #define FILE_WAS_OPENED 1 diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 4c385d7611..4bd23a35fc 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -155,6 +155,75 @@ static void notify_deferred_opens(struct share_mode_lock *lck) } } +/**************************************************************************** + Delete all streams +****************************************************************************/ + +static NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) +{ + struct stream_struct *stream_info; + int i; + unsigned int num_streams; + TALLOC_CTX *frame = talloc_stackframe(); + NTSTATUS status; + + status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(), + &num_streams, &stream_info); + + if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { + DEBUG(10, ("no streams around\n")); + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n", + nt_errstr(status))); + goto fail; + } + + DEBUG(10, ("delete_all_streams found %d streams\n", + num_streams)); + + if (num_streams == 0) { + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + for (i=0; ifs_capabilities & FILE_NAMED_STREAMS) + && !is_ntfs_stream_name(fsp->fsp_name)) { + + status = delete_all_streams(conn, fsp->fsp_name); + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(5, ("delete_all_streams failed: %s\n", + nt_errstr(status))); + goto done; + } + } + + if (SMB_VFS_UNLINK(conn,fsp->fsp_name) != 0) { /* * This call can potentially fail as another smbd may @@ -570,12 +652,37 @@ static NTSTATUS close_stat(files_struct *fsp) NTSTATUS close_file(files_struct *fsp, enum file_close_type close_type) { + NTSTATUS status; + struct files_struct *base_fsp = fsp->base_fsp; + if(fsp->is_directory) { - return close_directory(fsp, close_type); + status = close_directory(fsp, close_type); } else if (fsp->is_stat) { - return close_stat(fsp); + status = close_stat(fsp); } else if (fsp->fake_file_handle != NULL) { - return close_fake_file(fsp); + status = close_fake_file(fsp); + } else { + status = close_normal_file(fsp, close_type); + } + + if (!NT_STATUS_IS_OK(status)) { + return status; } - return close_normal_file(fsp, close_type); + + if ((base_fsp != NULL) && (close_type != SHUTDOWN_CLOSE)) { + + /* + * fsp was a stream, the base fsp can't be a stream as well + * + * For SHUTDOWN_CLOSE this is not possible here, because + * SHUTDOWN_CLOSE only happens from files.c which walks the + * complete list of files. If we mess with more than one fsp + * those loops will become confused. + */ + + SMB_ASSERT(base_fsp->base_fsp == NULL); + close_file(base_fsp, close_type); + } + + return status; } diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index be4960cab8..1d44c7498e 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -28,6 +28,13 @@ static bool scan_directory(connection_struct *conn, const char *path, char *name, char **found_name); +static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, + connection_struct *conn, + const char *orig_path, + const char *basepath, + const char *streamname, + SMB_STRUCT_STAT *pst, + char **path); /**************************************************************************** Mangle the 2nd name and check if it is then equal to the first name. @@ -119,6 +126,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, char *start, *end; char *dirpath = NULL; char *name = NULL; + char *stream = NULL; bool component_was_mangled = False; bool name_has_wildcard = False; NTSTATUS result; @@ -206,6 +214,18 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } + stream = strchr_m(name, ':'); + + if (stream != NULL) { + char *tmp = talloc_strdup(ctx, stream); + if (tmp == NULL) { + TALLOC_FREE(name); + return NT_STATUS_NO_MEMORY; + } + *stream = '\0'; + stream = tmp; + } + /* * Large directory fix normalization. If we're case sensitive, and * the case preserving parameters are set to "no", normalize the case of @@ -653,6 +673,20 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, DEBUG(5,("conversion finished %s -> %s\n",orig_path, name)); done: + if (stream != NULL) { + char *tmp = NULL; + + result = build_stream_path(ctx, conn, orig_path, name, stream, + pst, &tmp); + if (!NT_STATUS_IS_OK(result)) { + goto fail; + } + + DEBUG(10, ("build_stream_path returned %s\n", tmp)); + + TALLOC_FREE(name); + name = tmp; + } *pp_conv_path = name; TALLOC_FREE(dirpath); return NT_STATUS_OK; @@ -823,3 +857,90 @@ static bool scan_directory(connection_struct *conn, const char *path, errno = ENOENT; return False; } + +static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, + connection_struct *conn, + const char *orig_path, + const char *basepath, + const char *streamname, + SMB_STRUCT_STAT *pst, + char **path) +{ + SMB_STRUCT_STAT st; + char *result = NULL; + NTSTATUS status; + unsigned int i, num_streams; + struct stream_struct *streams = NULL; + + result = talloc_asprintf(mem_ctx, "%s%s", basepath, streamname); + if (result == NULL) { + return NT_STATUS_NO_MEMORY; + } + + if (SMB_VFS_STAT(conn, result, &st) == 0) { + *pst = st; + *path = result; + return NT_STATUS_OK; + } + + if (errno != ENOENT) { + status = map_nt_error_from_unix(errno); + DEBUG(10, ("vfs_stat failed: %s\n", nt_errstr(status))); + goto fail; + } + + status = SMB_VFS_STREAMINFO(conn, NULL, basepath, mem_ctx, + &num_streams, &streams); + + if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { + SET_STAT_INVALID(*pst); + *path = result; + return NT_STATUS_OK; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("vfs_streaminfo failed: %s\n", nt_errstr(status))); + goto fail; + } + + for (i=0; icase_sensitive)) { + DEBUGADD(10, ("equal\n")); + break; + } + DEBUGADD(10, ("not equal\n")); + } + + if (i == num_streams) { + SET_STAT_INVALID(*pst); + *path = result; + TALLOC_FREE(streams); + return NT_STATUS_OK; + } + + TALLOC_FREE(result); + + result = talloc_asprintf(mem_ctx, "%s%s", basepath, streams[i].name); + if (result == NULL) { + status = NT_STATUS_NO_MEMORY; + goto fail; + } + + SET_STAT_INVALID(*pst); + + if (SMB_VFS_STAT(conn, result, pst) == 0) { + stat_cache_add(orig_path, result, conn->case_sensitive); + } + + *path = result; + TALLOC_FREE(streams); + return NT_STATUS_OK; + + fail: + TALLOC_FREE(result); + TALLOC_FREE(streams); + return status; +} diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9d48bcc98b..0d6e07a032 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1842,7 +1842,9 @@ NTSTATUS open_file_ntcreate(connection_struct *conn, set_share_mode(lck, fsp, current_user.ut.uid, 0, fsp->oplock_type, new_file_created); /* Handle strange delete on close create semantics. */ - if ((create_options & FILE_DELETE_ON_CLOSE) && can_set_initial_delete_on_close(lck)) { + if ((create_options & FILE_DELETE_ON_CLOSE) + && (is_ntfs_stream_name(fname) + || can_set_initial_delete_on_close(lck))) { status = can_set_delete_on_close(fsp, True, new_dos_attributes); if (!NT_STATUS_IS_OK(status)) { @@ -2443,6 +2445,115 @@ static struct case_semantics_state *set_posix_case_semantics(TALLOC_CTX *mem_ctx return result; } +/* + * If a main file is opened for delete, all streams need to be checked for + * !FILE_SHARE_DELETE. Do this by opening with DELETE_ACCESS. + * If that works, delete them all by setting the delete on close and close. + */ + +static NTSTATUS open_streams_for_delete(connection_struct *conn, + const char *fname) +{ + struct stream_struct *stream_info; + files_struct **streams; + int i; + unsigned int num_streams; + TALLOC_CTX *frame = talloc_stackframe(); + NTSTATUS status; + + status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(), + &num_streams, &stream_info); + + if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { + DEBUG(10, ("no streams around\n")); + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("SMB_VFS_STREAMINFO failed: %s\n", + nt_errstr(status))); + goto fail; + } + + DEBUG(10, ("open_streams_for_delete found %d streams\n", + num_streams)); + + if (num_streams == 0) { + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams); + if (streams == NULL) { + DEBUG(0, ("talloc failed\n")); + status = NT_STATUS_NO_MEMORY; + goto fail; + } + + for (i=0; i= 0; i--) { + if (streams[i] == NULL) { + continue; + } + + DEBUG(10, ("Closing stream # %d, %s\n", i, + streams[i]->fsp_name)); + close_file(streams[i], NORMAL_CLOSE); + } + + fail: + TALLOC_FREE(frame); + return status; +} + /* * Wrapper around open_file_ntcreate and open_directory */ @@ -2466,6 +2577,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn, { SMB_STRUCT_STAT sbuf; int info = FILE_WAS_OPENED; + files_struct *base_fsp = NULL; files_struct *fsp = NULL; NTSTATUS status; @@ -2495,7 +2607,23 @@ NTSTATUS create_file_unixpath(connection_struct *conn, sbuf = *psbuf; } else { - SET_STAT_INVALID(sbuf); + if (SMB_VFS_STAT(conn, fname, &sbuf) == -1) { + SET_STAT_INVALID(sbuf); + } + } + + if ((conn->fs_capabilities & FILE_NAMED_STREAMS) + && (access_mask & DELETE_ACCESS) + && !is_ntfs_stream_name(fname)) { + /* + * We can't open a file with DELETE access if any of the + * streams is open without FILE_SHARE_DELETE + */ + status = open_streams_for_delete(conn, fname); + + if (!NT_STATUS_IS_OK(status)) { + goto fail; + } } /* This is the correct thing to do (check every time) but can_delete @@ -2528,12 +2656,61 @@ NTSTATUS create_file_unixpath(connection_struct *conn, } #endif + if ((conn->fs_capabilities & FILE_NAMED_STREAMS) + && is_ntfs_stream_name(fname) + && (!(create_options & NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE))) { + char *base; + uint32 base_create_disposition; + + if (create_options & FILE_DIRECTORY_FILE) { + status = NT_STATUS_NOT_A_DIRECTORY; + goto fail; + } + + status = split_ntfs_stream_name(talloc_tos(), fname, + &base, NULL); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("split_ntfs_stream_name failed: %s\n", + nt_errstr(status))); + goto fail; + } + + SMB_ASSERT(!is_ntfs_stream_name(base)); /* paranoia.. */ + + switch (create_disposition) { + case FILE_OPEN: + base_create_disposition = FILE_OPEN; + break; + default: + base_create_disposition = FILE_OPEN_IF; + break; + } + + status = create_file_unixpath(conn, NULL, base, 0, + FILE_SHARE_READ + | FILE_SHARE_WRITE + | FILE_SHARE_DELETE, + base_create_disposition, + 0, 0, 0, 0, NULL, NULL, + &base_fsp, NULL, NULL); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(10, ("create_file_unixpath for base %s failed: " + "%s\n", base, nt_errstr(status))); + goto fail; + } + } + /* * If it's a request for a directory open, deal with it separately. */ if (create_options & FILE_DIRECTORY_FILE) { + if (create_options & FILE_NON_DIRECTORY_FILE) { + status = NT_STATUS_INVALID_PARAMETER; + goto fail; + } + /* Can't open a temp directory. IFS kit test. */ if (file_attributes & FILE_ATTRIBUTE_TEMPORARY) { status = NT_STATUS_INVALID_PARAMETER; @@ -2664,6 +2841,16 @@ NTSTATUS create_file_unixpath(connection_struct *conn, DEBUG(10, ("create_file: info=%d\n", info)); + /* + * Set fsp->base_fsp late enough that we can't "goto fail" anymore. In + * the fail: branch we call close_file(fsp, ERROR_CLOSE) which would + * also close fsp->base_fsp which we have to also do explicitly in + * this routine here, as not in all "goto fail:" we have the fsp set + * up already to be initialized with the base_fsp. + */ + + fsp->base_fsp = base_fsp; + *result = fsp; if (pinfo != NULL) { *pinfo = info; @@ -2685,6 +2872,10 @@ NTSTATUS create_file_unixpath(connection_struct *conn, close_file(fsp, ERROR_CLOSE); fsp = NULL; } + if (base_fsp != NULL) { + close_file(base_fsp, ERROR_CLOSE); + base_fsp = NULL; + } return status; } @@ -2812,19 +3003,18 @@ NTSTATUS create_file(connection_struct *conn, status = NT_STATUS_NO_MEMORY; goto fail; } - } else { - /* - * Check to see if this is a mac fork of some kind. - */ + } + + /* + * Check to see if this is a mac fork of some kind. + */ - if (is_ntfs_stream_name(fname)) { - enum FAKE_FILE_TYPE fake_file_type; + if (is_ntfs_stream_name(fname)) { + enum FAKE_FILE_TYPE fake_file_type; - fake_file_type = is_fake_file(fname); + fake_file_type = is_fake_file(fname); - if (fake_file_type == FAKE_FILE_TYPE_NONE) { - return NT_STATUS_OBJECT_PATH_NOT_FOUND; - } + if (fake_file_type != FAKE_FILE_TYPE_NONE) { /* * Here we go! support for changing the disk quotas diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 381ddfe151..61ec611b6b 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -167,6 +167,10 @@ static NTSTATUS check_path_syntax_internal(char *path, } *d = '\0'; + + if (NT_STATUS_IS_OK(ret) && !posix_path) { + ret = split_ntfs_stream_name(NULL, path, NULL, NULL); + } return ret; } @@ -2289,14 +2293,22 @@ static NTSTATUS do_unlink(connection_struct *conn, /* On open checks the open itself will check the share mode, so don't do it here as we'll get it wrong. */ - status = open_file_ntcreate(conn, req, fname, &sbuf, - DELETE_ACCESS, - FILE_SHARE_NONE, - FILE_OPEN, - 0, - FILE_ATTRIBUTE_NORMAL, - req != NULL ? 0 : INTERNAL_OPEN_ONLY, - NULL, &fsp); + status = create_file_unixpath + (conn, /* conn */ + req, /* req */ + fname, /* fname */ + DELETE_ACCESS, /* access_mask */ + FILE_SHARE_NONE, /* share_access */ + FILE_OPEN, /* create_disposition*/ + FILE_NON_DIRECTORY_FILE, /* create_options */ + FILE_ATTRIBUTE_NORMAL, /* file_attributes */ + 0, /* oplock_request */ + 0, /* allocation_size */ + NULL, /* sd */ + NULL, /* ea_list */ + &fsp, /* result */ + NULL, /* pinfo */ + &sbuf); /* psbuf */ if (!NT_STATUS_IS_OK(status)) { DEBUG(10, ("open_file_ntcreate failed: %s\n", -- cgit From 4ba64fce494b064590a932d53cdbdb5f7bc4a837 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 23:33:11 +0100 Subject: vfs_streams_xattr module Store streams in posix xattrs. A kludge, as xattrs are limited in many ways, but it might be a help for some situations. (This used to be commit 83a805220e52742119546c76a054d50582e33a24) --- source3/Makefile.in | 5 + source3/configure.in | 3 +- source3/modules/vfs_streams_xattr.c | 672 ++++++++++++++++++++++++++++++++++++ 3 files changed, 679 insertions(+), 1 deletion(-) create mode 100644 source3/modules/vfs_streams_xattr.c diff --git a/source3/Makefile.in b/source3/Makefile.in index d3e37826d7..ec06bc971d 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -526,6 +526,7 @@ VFS_HPUXACL_OBJ = modules/vfs_hpuxacl.o VFS_IRIXACL_OBJ = modules/vfs_irixacl.o VFS_TRU64ACL_OBJ = modules/vfs_tru64acl.o VFS_CATIA_OBJ = modules/vfs_catia.o +VFS_STREAMS_XATTR_OBJ = modules/vfs_streams_xattr.o VFS_CACHEPRIME_OBJ = modules/vfs_cacheprime.o VFS_PREALLOC_OBJ = modules/vfs_prealloc.o VFS_COMMIT_OBJ = modules/vfs_commit.o @@ -1747,6 +1748,10 @@ bin/catia.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_CATIA_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_CATIA_OBJ) +bin/streams_xattr.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_STREAMS_XATTR_OBJ) + @echo "Building plugin $@" + @$(SHLD_MODULE) $(VFS_STREAMS_XATTR_OBJ) + bin/cacheprime.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_CACHEPRIME_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_CACHEPRIME_OBJ) diff --git a/source3/configure.in b/source3/configure.in index a34d42c478..38788eda39 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -707,7 +707,7 @@ dnl These have to be built static: default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_lsa_ds rpc_wkssvc rpc_svcctl2 rpc_ntsvcs rpc_net rpc_netdfs rpc_srvsvc2 rpc_spoolss rpc_eventlog2 auth_sam auth_unix auth_winbind auth_server auth_domain auth_builtin vfs_default nss_info_template" dnl These are preferably build shared, and static if dlopen() is not available -default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb" +default_shared_modules="vfs_recycle vfs_audit vfs_extd_audit vfs_full_audit vfs_netatalk vfs_fake_perms vfs_default_quota vfs_readonly vfs_cap vfs_expand_msdfs vfs_shadow_copy vfs_shadow_copy2 charset_CP850 charset_CP437 auth_script vfs_readahead vfs_syncops vfs_xattr_tdb vfs_streams_xattr" if test "x$developer" = xyes; then default_static_modules="$default_static_modules rpc_rpcecho" @@ -6497,6 +6497,7 @@ SMB_MODULE(vfs_irixacl, \$(VFS_IRIXACL_OBJ), "bin/irixacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS) SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS) +SMB_MODULE(vfs_streams_xattr, \$(VFS_STREAMS_XATTR_OBJ), "bin/streams_xattr.$SHLIBEXT", VFS) SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", VFS) SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS) SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c new file mode 100644 index 0000000000..3701cddfb5 --- /dev/null +++ b/source3/modules/vfs_streams_xattr.c @@ -0,0 +1,672 @@ +/* + * Store streams in xattrs + * + * Copyright (C) Volker Lendecke, 2008 + * + * Partly based on James Peach's Darwin module, which is + * + * Copyright (C) James Peach 2006-2007 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_VFS + +#define XATTR_DOSSTREAM_PREFIX "user.DosStream." + +struct stream_io { + char *base; + char *xattr_name; +}; + +static SMB_INO_T stream_inode(const SMB_STRUCT_STAT *sbuf, const char *sname) +{ + struct MD5Context ctx; + unsigned char hash[16]; + SMB_INO_T result; + char *upper_sname; + + DEBUG(10, ("stream_inode called for %lu/%lu [%s]\n", + (unsigned long)sbuf->st_dev, + (unsigned long)sbuf->st_ino, sname)); + + upper_sname = talloc_strdup_upper(talloc_tos(), sname); + SMB_ASSERT(upper_sname != NULL); + + MD5Init(&ctx); + MD5Update(&ctx, (unsigned char *)&(sbuf->st_dev), + sizeof(sbuf->st_dev)); + MD5Update(&ctx, (unsigned char *)&(sbuf->st_ino), + sizeof(sbuf->st_ino)); + MD5Update(&ctx, (unsigned char *)upper_sname, + talloc_get_size(upper_sname)-1); + MD5Final(hash, &ctx); + + TALLOC_FREE(upper_sname); + + /* Hopefully all the variation is in the lower 4 (or 8) bytes! */ + memcpy(&result, hash, sizeof(result)); + + DEBUG(10, ("stream_inode returns %lu\n", (unsigned long)result)); + + return result; +} + +static ssize_t get_xattr_size(connection_struct *conn, const char *fname, + const char *xattr_name) +{ + NTSTATUS status; + struct ea_struct ea; + ssize_t result; + + status = get_ea_value(talloc_tos(), conn, NULL, fname, + xattr_name, &ea); + + if (!NT_STATUS_IS_OK(status)) { + return -1; + } + + result = ea.value.length-1; + TALLOC_FREE(ea.value.data); + return result; +} + + +static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, + SMB_STRUCT_STAT *sbuf) +{ + struct stream_io *io = (struct stream_io *) + VFS_FETCH_FSP_EXTENSION(handle, fsp); + + if (io == NULL) { + return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); + } + + if (SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf) == -1) { + return -1; + } + + sbuf->st_size = get_xattr_size(handle->conn, io->base, io->xattr_name); + if (sbuf->st_size == -1) { + return -1; + } + + sbuf->st_ino = stream_inode(sbuf, io->xattr_name); + sbuf->st_mode &= ~S_IFMT; + sbuf->st_mode |= S_IFREG; + sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1; + + return 0; +} + +static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname, + SMB_STRUCT_STAT *sbuf) +{ + NTSTATUS status; + char *base, *sname; + int result = -1; + char *xattr_name; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_STAT(handle, fname, sbuf); + } + + status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname); + if (!NT_STATUS_IS_OK(status)) { + errno = EINVAL; + goto fail; + } + + if (SMB_VFS_NEXT_STAT(handle, base, sbuf) == -1) { + goto fail; + } + + xattr_name = talloc_asprintf(talloc_tos(), "%s%s", + XATTR_DOSSTREAM_PREFIX, sname); + if (xattr_name == NULL) { + errno = ENOMEM; + goto fail; + } + + sbuf->st_size = get_xattr_size(handle->conn, base, xattr_name); + if (sbuf->st_size == -1) { + errno = ENOENT; + goto fail; + } + + sbuf->st_ino = stream_inode(sbuf, xattr_name); + sbuf->st_mode &= ~S_IFMT; + sbuf->st_mode |= S_IFREG; + sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1; + + result = 0; + fail: + TALLOC_FREE(base); + TALLOC_FREE(sname); + return result; +} + +static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname, + SMB_STRUCT_STAT *sbuf) +{ + NTSTATUS status; + char *base, *sname; + int result = -1; + char *xattr_name; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_LSTAT(handle, fname, sbuf); + } + + status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname); + if (!NT_STATUS_IS_OK(status)) { + errno = EINVAL; + goto fail; + } + + if (SMB_VFS_NEXT_LSTAT(handle, base, sbuf) == -1) { + goto fail; + } + + xattr_name = talloc_asprintf(talloc_tos(), "%s%s", + XATTR_DOSSTREAM_PREFIX, sname); + if (xattr_name == NULL) { + errno = ENOMEM; + goto fail; + } + + sbuf->st_size = get_xattr_size(handle->conn, base, xattr_name); + if (sbuf->st_size == -1) { + errno = ENOENT; + goto fail; + } + + sbuf->st_ino = stream_inode(sbuf, xattr_name); + sbuf->st_mode &= ~S_IFMT; + sbuf->st_mode |= S_IFREG; + sbuf->st_blocks = sbuf->st_size % STAT_ST_BLOCKSIZE + 1; + + result = 0; + fail: + TALLOC_FREE(base); + TALLOC_FREE(sname); + return result; +} + +static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, + files_struct *fsp, int flags, mode_t mode) +{ + TALLOC_CTX *frame; + NTSTATUS status; + struct stream_io *sio; + char *base, *sname; + struct ea_struct ea; + char *xattr_name; + int baseflags; + int hostfd = -1; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); + } + + frame = talloc_stackframe(); + + status = split_ntfs_stream_name(talloc_tos(), fname, + &base, &sname); + if (!NT_STATUS_IS_OK(status)) { + errno = EINVAL; + goto fail; + } + + xattr_name = talloc_asprintf(talloc_tos(), "%s%s", + XATTR_DOSSTREAM_PREFIX, sname); + if (xattr_name == NULL) { + errno = ENOMEM; + goto fail; + } + + /* + * We use baseflags to turn off nasty side-effects when opening the + * underlying file. + */ + baseflags = flags; + baseflags &= ~O_TRUNC; + baseflags &= ~O_EXCL; + baseflags &= ~O_CREAT; + + hostfd = SMB_VFS_NEXT_OPEN(handle, base, fsp, baseflags, mode); + + /* It is legit to open a stream on a directory, but the base + * fd has to be read-only. + */ + if ((hostfd == -1) && (errno == EISDIR)) { + baseflags &= ~O_ACCMODE; + baseflags |= O_RDONLY; + hostfd = SMB_VFS_NEXT_OPEN(handle, fname, fsp, baseflags, + mode); + } + + if (hostfd == -1) { + goto fail; + } + + status = get_ea_value(talloc_tos(), handle->conn, fsp, base, + xattr_name, &ea); + + if (!NT_STATUS_IS_OK(status) + && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { + /* + * The base file is not there. This is an error even if we got + * O_CREAT, the higher levels should have created the base + * file for us. + */ + errno = ENOENT; + goto fail; + } + + if (!NT_STATUS_IS_OK(status)) { + /* + * The attribute does not exist + */ + + if (flags & O_CREAT) { + /* + * Darn, xattrs need at least 1 byte + */ + char null = '\0'; + + if (SMB_VFS_NEXT_SETXATTR( + handle, base, xattr_name, &null, sizeof(null), + flags & O_EXCL ? XATTR_CREATE : 0) == -1) { + goto fail; + } + } + } + + if (flags & O_TRUNC) { + char null = '\0'; + if (SMB_VFS_NEXT_SETXATTR( + handle, base, xattr_name, &null, sizeof(null), + flags & O_EXCL ? XATTR_CREATE : 0) == -1) { + goto fail; + } + } + + sio = (struct stream_io *)VFS_ADD_FSP_EXTENSION(handle, fsp, + struct stream_io); + if (sio == NULL) { + errno = ENOMEM; + goto fail; + } + + sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp), + xattr_name); + sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp), + base); + + if ((sio->xattr_name == NULL) || (sio->base == NULL)) { + errno = ENOMEM; + goto fail; + } + + TALLOC_FREE(frame); + return hostfd; + + fail: + if (hostfd >= 0) { + /* + * BUGBUGBUG -- we would need to call fd_close_posix here, but + * we don't have a full fsp yet + */ + SMB_VFS_NEXT_CLOSE(handle, fsp, hostfd); + } + + TALLOC_FREE(frame); + return -1; +} + +static int streams_xattr_unlink(vfs_handle_struct *handle, const char *fname) +{ + NTSTATUS status; + char *base = NULL; + char *sname = NULL; + int ret = -1; + char *xattr_name; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_UNLINK(handle, fname); + } + + status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname); + if (!NT_STATUS_IS_OK(status)) { + errno = EINVAL; + goto fail; + } + + xattr_name = talloc_asprintf(talloc_tos(), "%s%s", + XATTR_DOSSTREAM_PREFIX, sname); + if (xattr_name == NULL) { + errno = ENOMEM; + goto fail; + } + + ret = SMB_VFS_NEXT_REMOVEXATTR(handle, base, xattr_name); + + if ((ret == -1) && (errno == ENOATTR)) { + errno = ENOENT; + goto fail; + } + + ret = 0; + + fail: + TALLOC_FREE(base); + TALLOC_FREE(sname); + return ret; +} + +static NTSTATUS walk_xattr_streams(connection_struct *conn, files_struct *fsp, + const char *fname, + bool (*fn)(struct ea_struct *ea, + void *private_data), + void *private_data) +{ + NTSTATUS status; + char **names; + size_t i, num_names; + size_t prefix_len = strlen(XATTR_DOSSTREAM_PREFIX); + + status = get_ea_names_from_file(talloc_tos(), conn, fsp, fname, + &names, &num_names); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + for (i=0; imem_ctx, + &state->num_streams, &state->streams, + ea->name, ea->value.length-1, + smb_roundup(state->handle->conn, + ea->value.length-1))) { + state->status = NT_STATUS_NO_MEMORY; + return false; + } + + return true; +} + +static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, + struct files_struct *fsp, + const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *pnum_streams, + struct stream_struct **pstreams) +{ + SMB_STRUCT_STAT sbuf; + int ret; + NTSTATUS status; + struct streaminfo_state state; + + if ((fsp != NULL) && (fsp->fh->fd != -1)) { + if (is_ntfs_stream_name(fsp->fsp_name)) { + return NT_STATUS_INVALID_PARAMETER; + } + ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf); + } + else { + if (is_ntfs_stream_name(fname)) { + return NT_STATUS_INVALID_PARAMETER; + } + ret = SMB_VFS_NEXT_STAT(handle, fname, &sbuf); + } + + if (ret == -1) { + return map_nt_error_from_unix(errno); + } + + state.streams = NULL; + state.num_streams = 0; + + if (!S_ISDIR(sbuf.st_mode)) { + if (!add_one_stream(mem_ctx, + &state.num_streams, &state.streams, + "::$DATA", sbuf.st_size, + get_allocation_size(handle->conn, fsp, + &sbuf))) { + return NT_STATUS_NO_MEMORY; + } + } + + state.mem_ctx = mem_ctx; + state.handle = handle; + state.status = NT_STATUS_OK; + + status = walk_xattr_streams(handle->conn, fsp, fname, + collect_one_stream, &state); + + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(state.streams); + return status; + } + + if (!NT_STATUS_IS_OK(state.status)) { + TALLOC_FREE(state.streams); + return state.status; + } + + *pnum_streams = state.num_streams; + *pstreams = state.streams; + return NT_STATUS_OK; +} + +static int streams_xattr_statvfs(struct vfs_handle_struct *handle, + const char *path, + struct vfs_statvfs_struct *statbuf) +{ + int ret; + + ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf); + statbuf->FsCapabilities |= FILE_NAMED_STREAMS; + return ret; + +} + +static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, + files_struct *fsp, const void *data, + size_t n, SMB_OFF_T offset) +{ + struct stream_io *sio = + (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); + struct ea_struct ea; + NTSTATUS status; + int ret; + + if (sio == NULL) { + return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); + } + + status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base, + sio->xattr_name, &ea); + if (!NT_STATUS_IS_OK(status)) { + return -1; + } + + if ((offset + n) > ea.value.length-1) { + uint8 *tmp; + + tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8, + offset + n + 1); + + if (tmp == NULL) { + TALLOC_FREE(ea.value.data); + errno = ENOMEM; + return -1; + } + ea.value.data = tmp; + ea.value.length = offset + n + 1; + ea.value.data[offset+n] = 0; + } + + memcpy(ea.value.data + offset, data, n); + + ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, sio->xattr_name, + ea.value.data, ea.value.length, 0); + + TALLOC_FREE(ea.value.data); + + return n; +} + +static ssize_t streams_xattr_pread(vfs_handle_struct *handle, + files_struct *fsp, void *data, + size_t n, SMB_OFF_T offset) +{ + struct stream_io *sio = + (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp); + struct ea_struct ea; + NTSTATUS status; + size_t length, overlap; + + if (sio == NULL) { + return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); + } + + status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base, + sio->xattr_name, &ea); + if (!NT_STATUS_IS_OK(status)) { + return -1; + } + + length = ea.value.length-1; + + /* Attempt to read past EOF. */ + if (length <= offset) { + errno = EINVAL; + return -1; + } + + overlap = (offset + n) > length ? (length - offset) : n; + memcpy(data, ea.value.data + offset, overlap); + + TALLOC_FREE(ea.value.data); + return overlap; +} + +/* VFS operations structure */ + +static vfs_op_tuple streams_xattr_ops[] = { + {SMB_VFS_OP(streams_xattr_statvfs), SMB_VFS_OP_STATVFS, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_open), SMB_VFS_OP_OPEN, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_stat), SMB_VFS_OP_STAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_fstat), SMB_VFS_OP_FSTAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_lstat), SMB_VFS_OP_LSTAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_pread), SMB_VFS_OP_PREAD, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_pwrite), SMB_VFS_OP_PWRITE, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_lstat), SMB_VFS_OP_LSTAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_unlink), SMB_VFS_OP_UNLINK, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_xattr_streaminfo), SMB_VFS_OP_STREAMINFO, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_streams_xattr_init(void); +NTSTATUS vfs_streams_xattr_init(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "streams_xattr", + streams_xattr_ops); +} -- cgit From dfd05b9b65c5ad12dbb64b626d3180fb9e21ccb0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jan 2008 23:36:34 +0100 Subject: vfs_streams_depot Store streams in a file each. Not 100% finished, and not built by default. (This used to be commit 5f5fc72b01c8e8fc096375c7cb4a97186c387259) --- source3/Makefile.in | 5 + source3/configure.in | 1 + source3/modules/vfs_streams_depot.c | 648 ++++++++++++++++++++++++++++++++++++ 3 files changed, 654 insertions(+) create mode 100644 source3/modules/vfs_streams_depot.c diff --git a/source3/Makefile.in b/source3/Makefile.in index ec06bc971d..ea5e5a82a7 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -527,6 +527,7 @@ VFS_IRIXACL_OBJ = modules/vfs_irixacl.o VFS_TRU64ACL_OBJ = modules/vfs_tru64acl.o VFS_CATIA_OBJ = modules/vfs_catia.o VFS_STREAMS_XATTR_OBJ = modules/vfs_streams_xattr.o +VFS_STREAMS_DEPOT_OBJ = modules/vfs_streams_depot.o VFS_CACHEPRIME_OBJ = modules/vfs_cacheprime.o VFS_PREALLOC_OBJ = modules/vfs_prealloc.o VFS_COMMIT_OBJ = modules/vfs_commit.o @@ -1752,6 +1753,10 @@ bin/streams_xattr.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_STREAMS_XATTR_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_STREAMS_XATTR_OBJ) +bin/streams_depot.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_STREAMS_DEPOT_OBJ) + @echo "Building plugin $@" + @$(SHLD_MODULE) $(VFS_STREAMS_DEPOT_OBJ) + bin/cacheprime.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_CACHEPRIME_OBJ) @echo "Building plugin $@" @$(SHLD_MODULE) $(VFS_CACHEPRIME_OBJ) diff --git a/source3/configure.in b/source3/configure.in index 38788eda39..25e3b3600b 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -6498,6 +6498,7 @@ SMB_MODULE(vfs_hpuxacl, \$(VFS_HPUXACL_OBJ), "bin/hpuxacl.$SHLIBEXT", VFS) SMB_MODULE(vfs_tru64acl, \$(VFS_TRU64ACL_OBJ), "bin/tru64acl.$SHLIBEXT", VFS) SMB_MODULE(vfs_catia, \$(VFS_CATIA_OBJ), "bin/catia.$SHLIBEXT", VFS) SMB_MODULE(vfs_streams_xattr, \$(VFS_STREAMS_XATTR_OBJ), "bin/streams_xattr.$SHLIBEXT", VFS) +SMB_MODULE(vfs_streams_depot, \$(VFS_STREAMS_DEPOT_OBJ), "bin/streams_depot.$SHLIBEXT", VFS) SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", VFS) SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS) SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS) diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c new file mode 100644 index 0000000000..68e7a75947 --- /dev/null +++ b/source3/modules/vfs_streams_depot.c @@ -0,0 +1,648 @@ +/* + * Store streams in a separate subdirectory + * + * Copyright (C) Volker Lendecke, 2007 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_VFS + +/* + * Excerpt from a mail from tridge: + * + * Volker, what I'm thinking of is this: + * /mount-point/.streams/XX/YY/aaaa.bbbb/namedstream1 + * /mount-point/.streams/XX/YY/aaaa.bbbb/namedstream2 + * + * where XX/YY is a 2 level hash based on the fsid/inode. "aaaa.bbbb" + * is the fsid/inode. "namedstreamX" is a file named after the stream + * name. + */ + +static uint32_t hash_fn(DATA_BLOB key) +{ + uint32_t value; /* Used to compute the hash value. */ + uint32_t i; /* Used to cycle through random values. */ + + /* Set the initial value from the key size. */ + for (value = 0x238F13AF * key.length, i=0; i < key.length; i++) + value = (value + (key.data[i] << (i*5 % 24))); + + return (1103515243 * value + 12345); +} + +/* + * With the hashing scheme based on the inode we need to protect against + * streams showing up on files with re-used inodes. This can happen if we + * create a stream directory from within Samba, and a local process or NFS + * client deletes the file without deleting the streams directory. When the + * inode is re-used and the stream directory is still around, the streams in + * there would be show up as belonging to the new file. + * + * There are several workarounds for this, probably the easiest one is on + * systems which have a true birthtime stat element: When the file has a later + * birthtime than the streams directory, then we have to recreate the + * directory. + * + * The other workaround is to somehow mark the file as generated by Samba with + * something that a NFS client would not do. The closest one is a special + * xattr value being set. On systems which do not support xattrs, it might be + * an option to put in a special ACL entry for a non-existing group. + */ + +#define SAMBA_XATTR_MARKER "user.SAMBA_STREAMS" + +static bool file_is_valid(vfs_handle_struct *handle, const char *path) +{ + char buf; + + DEBUG(10, ("file_is_valid (%s) called\n", path)); + + if (SMB_VFS_NEXT_GETXATTR(handle, path, SAMBA_XATTR_MARKER, + &buf, sizeof(buf)) != sizeof(buf)) { + DEBUG(10, ("GETXATTR failed: %s\n", strerror(errno))); + return false; + } + + if (buf != '1') { + DEBUG(10, ("got wrong buffer content: '%c'\n", buf)); + return false; + } + + return true; +} + +static bool mark_file_valid(vfs_handle_struct *handle, const char *path) +{ + char buf = '1'; + int ret; + + DEBUG(10, ("marking file %s as valid\n", path)); + + ret = SMB_VFS_NEXT_SETXATTR(handle, path, SAMBA_XATTR_MARKER, + &buf, sizeof(buf), 0); + + if (ret == -1) { + DEBUG(10, ("SETXATTR failed: %s\n", strerror(errno))); + return false; + } + + return true; +} + +static char *stream_dir(vfs_handle_struct *handle, const char *base_path, + const SMB_STRUCT_STAT *base_sbuf, bool create_it) +{ + uint32_t hash; + char *result = NULL; + SMB_STRUCT_STAT sbuf; + uint8_t first, second; + char *tmp; + char *id_hex; + struct file_id id; + uint8 id_buf[16]; + + const char *rootdir = lp_parm_const_string( + SNUM(handle->conn), "streams", "directory", + handle->conn->connectpath); + + if (base_sbuf == NULL) { + if (SMB_VFS_NEXT_STAT(handle, base_path, &sbuf) == -1) { + /* + * base file is not there + */ + goto fail; + } + base_sbuf = &sbuf; + } + + id = SMB_VFS_FILE_ID_CREATE(handle->conn, base_sbuf->st_dev, + base_sbuf->st_ino); + + push_file_id_16((char *)id_buf, &id); + + hash = hash_fn(data_blob_const(id_buf, sizeof(id_buf))); + + first = hash & 0xff; + second = (hash >> 8) & 0xff; + + id_hex = hex_encode(talloc_tos(), id_buf, sizeof(id_buf)); + + if (id_hex == NULL) { + errno = ENOMEM; + goto fail; + } + + result = talloc_asprintf(talloc_tos(), "%s/%2.2X/%2.2X/%s", rootdir, + first, second, id_hex); + + TALLOC_FREE(id_hex); + + if (result == NULL) { + errno = ENOMEM; + return NULL; + } + + if (SMB_VFS_NEXT_STAT(handle, result, &sbuf) == 0) { + char *newname; + + if (!S_ISDIR(sbuf.st_mode)) { + errno = EINVAL; + goto fail; + } + + if (file_is_valid(handle, base_path)) { + return result; + } + + /* + * Someone has recreated a file under an existing inode + * without deleting the streams directory. For now, just move + * it away. + */ + + again: + newname = talloc_asprintf(talloc_tos(), "lost-%lu", random()); + if (newname == NULL) { + errno = ENOMEM; + goto fail; + } + + if (SMB_VFS_NEXT_RENAME(handle, result, newname) == -1) { + if ((errno == EEXIST) || (errno == ENOTEMPTY)) { + TALLOC_FREE(newname); + goto again; + } + goto fail; + } + + TALLOC_FREE(newname); + } + + if (!create_it) { + errno = ENOENT; + goto fail; + } + + if ((SMB_VFS_NEXT_MKDIR(handle, rootdir, 0755) != 0) + && (errno != EEXIST)) { + goto fail; + } + + tmp = talloc_asprintf(result, "%s/%2.2X", rootdir, first); + if (tmp == NULL) { + errno = ENOMEM; + goto fail; + } + + if ((SMB_VFS_NEXT_MKDIR(handle, tmp, 0755) != 0) + && (errno != EEXIST)) { + goto fail; + } + + TALLOC_FREE(tmp); + + tmp = talloc_asprintf(result, "%s/%2.2X/%2.2X", rootdir, first, + second); + if (tmp == NULL) { + errno = ENOMEM; + goto fail; + } + + if ((SMB_VFS_NEXT_MKDIR(handle, tmp, 0755) != 0) + && (errno != EEXIST)) { + goto fail; + } + + TALLOC_FREE(tmp); + + if ((SMB_VFS_NEXT_MKDIR(handle, result, 0755) != 0) + && (errno != EEXIST)) { + goto fail; + } + + if (!mark_file_valid(handle, base_path)) { + goto fail; + } + + return result; + + fail: + TALLOC_FREE(result); + return NULL; +} + +static char *stream_name(vfs_handle_struct *handle, const char *fname, + bool create_dir) +{ + char *base = NULL; + char *sname = NULL; + char *id_hex = NULL; + char *dirname, *stream_fname; + + if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), fname, + &base, &sname))) { + DEBUG(10, ("split_ntfs_stream_name failed\n")); + errno = ENOMEM; + goto fail; + } + + dirname = stream_dir(handle, base, NULL, create_dir); + + if (dirname == NULL) { + goto fail; + } + + stream_fname = talloc_asprintf(talloc_tos(), "%s/:%s", dirname, sname); + + if (stream_fname == NULL) { + errno = ENOMEM; + goto fail; + } + + DEBUG(10, ("stream filename = %s\n", stream_fname)); + + TALLOC_FREE(base); + TALLOC_FREE(sname); + TALLOC_FREE(id_hex); + + return stream_fname; + + fail: + DEBUG(5, ("stream_name failed: %s\n", strerror(errno))); + TALLOC_FREE(base); + TALLOC_FREE(sname); + TALLOC_FREE(id_hex); + return NULL; +} + +static NTSTATUS walk_streams(vfs_handle_struct *handle, + const char *fname, + const SMB_STRUCT_STAT *sbuf, + char **pdirname, + bool (*fn)(const char *dirname, + const char *dirent, + void *private_data), + void *private_data) +{ + char *dirname; + SMB_STRUCT_DIR *dirhandle = NULL; + char *dirent; + + dirname = stream_dir(handle, fname, sbuf, false); + + if (dirname == NULL) { + if (errno == ENOENT) { + /* + * no stream around + */ + return NT_STATUS_OK; + } + return map_nt_error_from_unix(errno); + } + + DEBUG(10, ("walk_streams: dirname=%s\n", dirname)); + + dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dirname, NULL, 0); + + if (dirhandle == NULL) { + TALLOC_FREE(dirname); + return map_nt_error_from_unix(errno); + } + + while ((dirent = vfs_readdirname(handle->conn, dirhandle)) != NULL) { + + if (ISDOT(dirent) || ISDOTDOT(dirent)) { + continue; + } + + DEBUG(10, ("walk_streams: dirent=%s\n", dirent)); + + if (!fn(dirname, dirent, private_data)) { + break; + } + } + + SMB_VFS_NEXT_CLOSEDIR(handle, dirhandle); + + if (pdirname != NULL) { + *pdirname = dirname; + } + else { + TALLOC_FREE(dirname); + } + + return NT_STATUS_OK; +} + +static int streams_depot_stat(vfs_handle_struct *handle, const char *fname, + SMB_STRUCT_STAT *sbuf) +{ + char *stream_fname; + int ret = -1; + + DEBUG(10, ("streams_depot_stat called for [%s]\n", fname)); + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_STAT(handle, fname, sbuf); + } + + stream_fname = stream_name(handle, fname, false); + if (stream_fname == NULL) { + goto done; + } + + ret = SMB_VFS_NEXT_STAT(handle, stream_fname, sbuf); + + done: + TALLOC_FREE(stream_fname); + return ret; +} + +static int streams_depot_lstat(vfs_handle_struct *handle, const char *fname, + SMB_STRUCT_STAT *sbuf) +{ + char *stream_fname; + int ret = -1; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_LSTAT(handle, fname, sbuf); + } + + stream_fname = stream_name(handle, fname, false); + if (stream_fname == NULL) { + goto done; + } + + ret = SMB_VFS_NEXT_LSTAT(handle, stream_fname, sbuf); + + done: + TALLOC_FREE(stream_fname); + return ret; +} + +static int streams_depot_open(vfs_handle_struct *handle, const char *fname, + files_struct *fsp, int flags, mode_t mode) +{ + TALLOC_CTX *frame; + char *base = NULL; + SMB_STRUCT_STAT base_sbuf; + char *stream_fname; + int ret = -1; + + if (!is_ntfs_stream_name(fname)) { + return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); + } + + frame = talloc_stackframe(); + + if (!NT_STATUS_IS_OK(split_ntfs_stream_name(talloc_tos(), fname, + &base, NULL))) { + errno = ENOMEM; + goto done; + } + + ret = SMB_VFS_NEXT_STAT(handle, base, &base_sbuf); + + if (ret == -1) { + goto done; + } + + TALLOC_FREE(base); + + stream_fname = stream_name(handle, fname, true); + if (stream_fname == NULL) { + goto done; + } + + ret = SMB_VFS_NEXT_OPEN(handle, stream_fname, fsp, flags, mode); + + done: + TALLOC_FREE(frame); + return ret; +} + +static int streams_depot_unlink(vfs_handle_struct *handle, const char *fname) +{ + int ret = -1; + SMB_STRUCT_STAT sbuf; + + DEBUG(10, ("streams_depot_unlink called for %s\n", fname)); + + if (is_ntfs_stream_name(fname)) { + char *stream_fname; + + stream_fname = stream_name(handle, fname, false); + if (stream_fname == NULL) { + return -1; + } + + ret = SMB_VFS_NEXT_UNLINK(handle, stream_fname); + + TALLOC_FREE(stream_fname); + return ret; + } + + /* + * We potentially need to delete the per-inode streams directory + */ + + if (SMB_VFS_NEXT_STAT(handle, fname, &sbuf) == -1) { + return -1; + } + + if (sbuf.st_nlink == 1) { + char *dirname = stream_dir(handle, fname, &sbuf, false); + + if (dirname != NULL) { + SMB_VFS_NEXT_RMDIR(handle, dirname); + } + TALLOC_FREE(dirname); + } + + return SMB_VFS_NEXT_UNLINK(handle, fname); +} + +static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, + struct stream_struct **streams, + const char *name, SMB_OFF_T size, + SMB_OFF_T alloc_size) +{ + struct stream_struct *tmp; + + tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct, + (*num_streams)+1); + if (tmp == NULL) { + return false; + } + + tmp[*num_streams].name = talloc_strdup(tmp, name); + if (tmp[*num_streams].name == NULL) { + return false; + } + + tmp[*num_streams].size = size; + tmp[*num_streams].alloc_size = alloc_size; + + *streams = tmp; + *num_streams += 1; + return true; +} + +struct streaminfo_state { + TALLOC_CTX *mem_ctx; + vfs_handle_struct *handle; + unsigned int num_streams; + struct stream_struct *streams; + NTSTATUS status; +}; + +static bool collect_one_stream(const char *dirname, + const char *dirent, + void *private_data) +{ + struct streaminfo_state *state = + (struct streaminfo_state *)private_data; + char *full_sname; + SMB_STRUCT_STAT sbuf; + + if (asprintf(&full_sname, "%s/%s", dirname, dirent) == -1) { + state->status = NT_STATUS_NO_MEMORY; + return false; + } + if (SMB_VFS_NEXT_STAT(state->handle, full_sname, &sbuf) == -1) { + DEBUG(10, ("Could not stat %s: %s\n", full_sname, + strerror(errno))); + SAFE_FREE(full_sname); + return true; + } + + SAFE_FREE(full_sname); + + if (!add_one_stream(state->mem_ctx, + &state->num_streams, &state->streams, + dirent, sbuf.st_size, + get_allocation_size( + state->handle->conn, NULL, &sbuf))) { + state->status = NT_STATUS_NO_MEMORY; + return false; + } + + return true; +} + +static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle, + struct files_struct *fsp, + const char *fname, + TALLOC_CTX *mem_ctx, + unsigned int *pnum_streams, + struct stream_struct **pstreams) +{ + SMB_STRUCT_STAT sbuf; + int ret; + NTSTATUS status; + struct streaminfo_state state; + + if ((fsp != NULL) && (fsp->fh->fd != -1)) { + if (is_ntfs_stream_name(fsp->fsp_name)) { + return NT_STATUS_INVALID_PARAMETER; + } + ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf); + } + else { + if (is_ntfs_stream_name(fname)) { + return NT_STATUS_INVALID_PARAMETER; + } + ret = SMB_VFS_NEXT_STAT(handle, fname, &sbuf); + } + + if (ret == -1) { + return map_nt_error_from_unix(errno); + } + + state.streams = NULL; + state.num_streams = 0; + + if (!S_ISDIR(sbuf.st_mode)) { + if (!add_one_stream(mem_ctx, + &state.num_streams, &state.streams, + "::$DATA", sbuf.st_size, + get_allocation_size(handle->conn, fsp, + &sbuf))) { + return NT_STATUS_NO_MEMORY; + } + } + + state.mem_ctx = mem_ctx; + state.handle = handle; + state.status = NT_STATUS_OK; + + status = walk_streams(handle, fname, &sbuf, NULL, collect_one_stream, + &state); + + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(state.streams); + return status; + } + + if (!NT_STATUS_IS_OK(state.status)) { + TALLOC_FREE(state.streams); + return state.status; + } + + *pnum_streams = state.num_streams; + *pstreams = state.streams; + return NT_STATUS_OK; +} + +static int streams_depot_statvfs(struct vfs_handle_struct *handle, + const char *path, + struct vfs_statvfs_struct *statbuf) +{ + int ret; + + ret = SMB_VFS_NEXT_STATVFS(handle, path, statbuf); + statbuf->FsCapabilities |= FILE_NAMED_STREAMS; + return ret; + +} + +/* VFS operations structure */ + +static vfs_op_tuple streams_depot_ops[] = { + {SMB_VFS_OP(streams_depot_statvfs), SMB_VFS_OP_STATVFS, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_depot_open), SMB_VFS_OP_OPEN, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_depot_stat), SMB_VFS_OP_STAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_depot_lstat), SMB_VFS_OP_LSTAT, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_depot_unlink), SMB_VFS_OP_UNLINK, + SMB_VFS_LAYER_TRANSPARENT}, + {SMB_VFS_OP(streams_depot_streaminfo), SMB_VFS_OP_STREAMINFO, + SMB_VFS_LAYER_OPAQUE}, + {SMB_VFS_OP(NULL), SMB_VFS_OP_NOOP, SMB_VFS_LAYER_NOOP} +}; + +NTSTATUS vfs_streams_depot_init(void); +NTSTATUS vfs_streams_depot_init(void) +{ + return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "streams_depot", + streams_depot_ops); +} -- cgit From 014bfd35f8c57370b27a1d07c335e2d9813a1333 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 00:44:14 +0100 Subject: Some systems do not have XATTR_ defined (This used to be commit 2cac1d3919a96c480f34c93d8b9b07782d46ed23) --- source3/include/includes.h | 8 ++++++++ source3/lib/system.c | 5 ----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source3/include/includes.h b/source3/include/includes.h index 7eca8d3ddf..c6d0885ad9 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -1108,6 +1108,14 @@ char *talloc_asprintf_strupper_m(TALLOC_CTX *t, const char *fmt, ...) PRINTF_ATT #define VXFS_QUOTA #endif +#ifndef XATTR_CREATE +#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ +#endif + +#ifndef XATTR_REPLACE +#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ +#endif + #if defined(HAVE_KRB5) krb5_error_code smb_krb5_parse_name(krb5_context context, diff --git a/source3/lib/system.c b/source3/lib/system.c index eb6dcae6fb..fa50955ef6 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1917,11 +1917,6 @@ int sys_fremovexattr (int filedes, const char *name) #endif } -#if !defined(HAVE_SETXATTR) -#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */ -#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */ -#endif - int sys_setxattr (const char *path, const char *name, const void *value, size_t size, int flags) { #if defined(HAVE_SETXATTR) -- cgit From 29af710d6acc4fe7e02313b7c878dc7301feeaea Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 23:01:58 +0100 Subject: Use c99 struct initializers for REGISTRY_OPS in reg_smbconf.c. Michael (This used to be commit 96d116b003c1187869cbdbc21274a0b5cb1bf7d6) --- source3/registry/reg_smbconf.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source3/registry/reg_smbconf.c b/source3/registry/reg_smbconf.c index 8dfb745a7e..a6e478200f 100644 --- a/source3/registry/reg_smbconf.c +++ b/source3/registry/reg_smbconf.c @@ -265,13 +265,11 @@ static WERROR smbconf_set_secdesc(const char *key, */ REGISTRY_OPS smbconf_reg_ops = { - smbconf_fetch_keys, - smbconf_fetch_values, - smbconf_store_keys, - smbconf_store_values, - smbconf_reg_access_check, - smbconf_get_secdesc, - smbconf_set_secdesc, - NULL, - NULL + .fetch_subkeys = smbconf_fetch_keys, + .fetch_values = smbconf_fetch_values, + .store_subkeys = smbconf_store_keys, + .store_values = smbconf_store_values, + .reg_access_check = smbconf_reg_access_check, + .get_secdesc = smbconf_get_secdesc, + .set_secdesc = smbconf_set_secdesc, }; -- cgit From 15015b74906fd4ce6bab5c500946ca0aa7da0fa8 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 23:06:12 +0100 Subject: Use c99 struct initializers for REGISTRY_OPS in reg_printing.c Michael (This used to be commit a89bee4139666ba163385c9e7d15fbc5d623ed6f) --- source3/registry/reg_printing.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 5be0796002..a4da103d40 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -1262,9 +1262,8 @@ static bool regprint_store_reg_values( const char *key, REGVAL_CTR *values ) */ REGISTRY_OPS printing_ops = { - regprint_fetch_reg_keys, - regprint_fetch_reg_values, - regprint_store_reg_keys, - regprint_store_reg_values, - NULL, NULL, NULL, NULL, NULL + .fetch_subkeys = regprint_fetch_reg_keys, + .fetch_values = regprint_fetch_reg_values, + .store_subkeys = regprint_store_reg_keys, + .store_values = regprint_store_reg_values, }; -- cgit From cb1e0de56f180fa6da82908a73610daecd19b9d7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 23:09:38 +0100 Subject: Use c99 struct initializers for REGISTRY_OPS in reg_shares.c Michael (This used to be commit 2c4dfd7aaa3c3b384b547451f914a86f59157928) --- source3/registry/reg_shares.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/registry/reg_shares.c b/source3/registry/reg_shares.c index 4ac6e1d151..ee9e5dc5a1 100644 --- a/source3/registry/reg_shares.c +++ b/source3/registry/reg_shares.c @@ -155,11 +155,10 @@ static bool shares_store_value( const char *key, REGVAL_CTR *val ) */ REGISTRY_OPS shares_reg_ops = { - shares_subkey_info, - shares_value_info, - shares_store_subkey, - shares_store_value, - NULL, NULL, NULL, NULL, NULL + .fetch_subkeys = shares_subkey_info, + .fetch_values = shares_value_info, + .store_subkeys = shares_store_subkey, + .store_values = shares_store_value, }; -- cgit From 139340f570f006032aba2d5d98e13731e373bdfe Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 12:13:37 +0100 Subject: Volker is right: why keep commented out migrated dynamic reg overlays around?... Michael (This used to be commit a73b8d16aa0f7a3bb7417e9839e04380e6a68629) --- source3/registry/reg_dynamic.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index 07c9673c28..037bdab0cc 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -29,24 +29,6 @@ struct reg_dyn_values { int (*fetch_values) ( REGVAL_CTR *val ); }; -#if 0 -/*********************************************************************** -***********************************************************************/ - -static int netlogon_params( REGVAL_CTR *regvals ) -{ - uint32 dwValue; - - if ( !pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue) ) - dwValue = 0; - - regval_ctr_addvalue( regvals, "RefusePasswordChange", REG_DWORD, - (char*)&dwValue, sizeof(dwValue) ); - - return regval_ctr_numvals( regvals ); -} -#endif - /*********************************************************************** ***********************************************************************/ @@ -202,9 +184,6 @@ static int current_version( REGVAL_CTR *values ) ***********************************************************************/ static struct reg_dyn_values dynamic_values[] = { -#if 0 - { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/NETLOGON/PARAMETERS", &netlogon_params }, -#endif { "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRODUCTOPTIONS", &prod_options }, { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS", &tcpip_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, -- cgit From 563c4ef74082b0d06d0511fef700980d92f04d08 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 16:13:01 +0100 Subject: Use constant KEY_NETLOGON_PARAMS instead of literal key. Michael (This used to be commit daf37c954572bbf652506daae9ff0c9c365b2a9e) --- source3/registry/reg_db.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index c4bfc2b6c9..1b95c2558c 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -50,7 +50,7 @@ static const char *builtin_registry_paths[] = { "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", - "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters", + KEY_NETLOGON_PARAMS, "HKU", "HKCR", "HKPD", -- cgit From 1b2dd2dcc8a78c3b6d4ba9fe229dd6f286947b32 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 17:51:57 +0100 Subject: Fix registering Registry backends in reghook_cache_add(). This was broken in 331c0d6216e1a1607a49ed7eb4078e10138ec16a (pstring removal). Michael (This used to be commit 7d1e986f3a5ab316a8501ddaca1ba1f0867b4531) --- source3/registry/reg_cachehook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 74670aac30..22352c6112 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -56,7 +56,7 @@ bool reghook_cache_add( REGISTRY_HOOK *hook ) return false; } - key = talloc_asprintf(ctx, "//%s", hook->keyname); + key = talloc_asprintf(ctx, "\\%s", hook->keyname); if (!key) { return false; } -- cgit From c8a0b2a3a2c82312076341fb2fe53e0abed0a6fb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 22:39:33 +0100 Subject: In reg_backend_netlogon_params, delegate fetch_subkeys() to regdb. In order to be able to open the netlogon_params key (the new backend replacing the former dynamic overlay), certain methods need to be provided. Delegate these to the regdb backend (like e.g. the smbconf backend does). Michael (This used to be commit 9261b2c4bf48e133eecda9ec0095bd8edf20326c) --- source3/registry/reg_backend_netlogon_params.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source3/registry/reg_backend_netlogon_params.c b/source3/registry/reg_backend_netlogon_params.c index 507d2c5df8..ff5a33e6e4 100644 --- a/source3/registry/reg_backend_netlogon_params.c +++ b/source3/registry/reg_backend_netlogon_params.c @@ -29,6 +29,7 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY +extern REGISTRY_OPS regdb_ops; static int netlogon_params_fetch_reg_values(const char *key, REGVAL_CTR *regvals) @@ -44,7 +45,13 @@ static int netlogon_params_fetch_reg_values(const char *key, return regval_ctr_numvals( regvals ); } +static int netlogon_params_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} REGISTRY_OPS netlogon_params_reg_ops = { .fetch_values = netlogon_params_fetch_reg_values, + .fetch_subkeys = netlogon_params_fetch_subkeys, }; -- cgit From 2e47997e6e433f915bcba6cd891857c15ea95a12 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 22:42:30 +0100 Subject: Rename netlogon_params_fetch_reg_values() to netlogon_params_fetch_values(). Michael (This used to be commit 54e7c8098565495a833500d4b2a8d5240ed55c82) --- source3/registry/reg_backend_netlogon_params.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source3/registry/reg_backend_netlogon_params.c b/source3/registry/reg_backend_netlogon_params.c index ff5a33e6e4..d63cd6b31b 100644 --- a/source3/registry/reg_backend_netlogon_params.c +++ b/source3/registry/reg_backend_netlogon_params.c @@ -31,8 +31,7 @@ extern REGISTRY_OPS regdb_ops; -static int netlogon_params_fetch_reg_values(const char *key, - REGVAL_CTR *regvals) +static int netlogon_params_fetch_values(const char *key, REGVAL_CTR *regvals) { uint32 dwValue; @@ -52,6 +51,6 @@ static int netlogon_params_fetch_subkeys(const char *key, } REGISTRY_OPS netlogon_params_reg_ops = { - .fetch_values = netlogon_params_fetch_reg_values, + .fetch_values = netlogon_params_fetch_values, .fetch_subkeys = netlogon_params_fetch_subkeys, }; -- cgit From d48c5f15993c90635f4bb46f87245d9c244d7ddf Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:30:38 +0100 Subject: Some reformatting in netlogon_params_fetch_values(). Michael (This used to be commit 24f13fb72e4cbaba48235fa840b2a93bf1c5d9c3) --- source3/registry/reg_backend_netlogon_params.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source3/registry/reg_backend_netlogon_params.c b/source3/registry/reg_backend_netlogon_params.c index d63cd6b31b..71f88144c8 100644 --- a/source3/registry/reg_backend_netlogon_params.c +++ b/source3/registry/reg_backend_netlogon_params.c @@ -34,14 +34,15 @@ extern REGISTRY_OPS regdb_ops; static int netlogon_params_fetch_values(const char *key, REGVAL_CTR *regvals) { uint32 dwValue; - - if ( !pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue) ) + + if (!pdb_get_account_policy(AP_REFUSE_MACHINE_PW_CHANGE, &dwValue)) { dwValue = 0; - - regval_ctr_addvalue( regvals, "RefusePasswordChange", REG_DWORD, - (char*)&dwValue, sizeof(dwValue) ); + } + + regval_ctr_addvalue(regvals, "RefusePasswordChange", REG_DWORD, + (char*)&dwValue, sizeof(dwValue)); - return regval_ctr_numvals( regvals ); + return regval_ctr_numvals(regvals); } static int netlogon_params_fetch_subkeys(const char *key, -- cgit From 663815ec2bbb4b2566a6d72f6680b39953640bb1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 16:15:43 +0100 Subject: Add a registry backend prod_options that replaces the former dynamic overlay. Michael (This used to be commit d9b89e9d30702f64805b3a3a3612066b19c051d1) --- source3/Makefile.in | 1 + source3/include/reg_objects.h | 1 + source3/registry/reg_backend_prod_options.c | 70 +++++++++++++++++++++++++++++ source3/registry/reg_db.c | 2 +- source3/registry/reg_dynamic.c | 31 ------------- source3/registry/reg_frontend.c | 2 + 6 files changed, 75 insertions(+), 32 deletions(-) create mode 100644 source3/registry/reg_backend_prod_options.c diff --git a/source3/Makefile.in b/source3/Makefile.in index ea5e5a82a7..57605d1018 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -419,6 +419,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_smbconf.o registry/reg_api.o \ registry/reg_frontend_hilvl.o \ registry/reg_backend_netlogon_params.o \ + registry/reg_backend_prod_options.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index 3b846db681..021ed0e0fd 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -101,6 +101,7 @@ typedef struct { #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" +#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" #define KEY_TREE_ROOT "" /* diff --git a/source3/registry/reg_backend_prod_options.c b/source3/registry/reg_backend_prod_options.c new file mode 100644 index 0000000000..7be97bee06 --- /dev/null +++ b/source3/registry/reg_backend_prod_options.c @@ -0,0 +1,70 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * Product options registry backend. + * + * This replaces the former dynamic product options overlay. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +extern REGISTRY_OPS regdb_ops; + +static int prod_options_fetch_values(const char *key, REGVAL_CTR *regvals) +{ + const char *value_ascii = ""; + fstring value; + int value_length; + + switch (lp_server_role()) { + case ROLE_DOMAIN_PDC: + case ROLE_DOMAIN_BDC: + value_ascii = "LanmanNT"; + break; + case ROLE_STANDALONE: + value_ascii = "ServerNT"; + break; + case ROLE_DOMAIN_MEMBER: + value_ascii = "WinNT"; + break; + } + + value_length = push_ucs2( value, value, value_ascii, sizeof(value), + STR_TERMINATE|STR_NOALIGN ); + regval_ctr_addvalue( regvals, "ProductType", REG_SZ, value, + value_length ); + + return regval_ctr_numvals( regvals ); +} + +static int prod_options_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} + +REGISTRY_OPS prod_options_reg_ops = { + .fetch_values = prod_options_fetch_values, + .fetch_subkeys = prod_options_fetch_subkeys, +}; diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 1b95c2558c..f70e44fd51 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -47,7 +47,7 @@ static const char *builtin_registry_paths[] = { "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors", - "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions", + KEY_PROD_OPTIONS, "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", KEY_NETLOGON_PARAMS, diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index 037bdab0cc..2735e2a27a 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -32,36 +32,6 @@ struct reg_dyn_values { /*********************************************************************** ***********************************************************************/ -static int prod_options( REGVAL_CTR *regvals ) -{ - const char *value_ascii = ""; - fstring value; - int value_length; - - switch (lp_server_role()) { - case ROLE_DOMAIN_PDC: - case ROLE_DOMAIN_BDC: - value_ascii = "LanmanNT"; - break; - case ROLE_STANDALONE: - value_ascii = "ServerNT"; - break; - case ROLE_DOMAIN_MEMBER: - value_ascii = "WinNT"; - break; - } - - value_length = push_ucs2( value, value, value_ascii, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( regvals, "ProductType", REG_SZ, value, - value_length ); - - return regval_ctr_numvals( regvals ); -} - -/*********************************************************************** -***********************************************************************/ - static int tcpip_params( REGVAL_CTR *regvals ) { fstring value; @@ -184,7 +154,6 @@ static int current_version( REGVAL_CTR *values ) ***********************************************************************/ static struct reg_dyn_values dynamic_values[] = { - { "HKLM/SYSTEM/CURRENTCONTROLSET/CONTROL/PRODUCTOPTIONS", &prod_options }, { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS", &tcpip_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 6674b0ba20..32ec7f9a87 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -29,6 +29,7 @@ extern REGISTRY_OPS eventlog_ops; extern REGISTRY_OPS shares_reg_ops; extern REGISTRY_OPS smbconf_reg_ops; extern REGISTRY_OPS netlogon_params_reg_ops; +extern REGISTRY_OPS prod_options_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -42,6 +43,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_SHARES, &shares_reg_ops }, { KEY_SMBCONF, &smbconf_reg_ops }, { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops }, + { KEY_PROD_OPTIONS, &prod_options_reg_ops }, #endif { NULL, NULL } }; -- cgit From f383b853f58d54352332a60e6f0842dfd41f5ff0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:25:08 +0100 Subject: Some reformatting in prod_options_fetch_values(). Michael (This used to be commit 347b9886547516bc2a43190ae7faaf349d2c9d04) --- source3/registry/reg_backend_prod_options.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source3/registry/reg_backend_prod_options.c b/source3/registry/reg_backend_prod_options.c index 7be97bee06..7ac5c5b4b9 100644 --- a/source3/registry/reg_backend_prod_options.c +++ b/source3/registry/reg_backend_prod_options.c @@ -33,10 +33,10 @@ extern REGISTRY_OPS regdb_ops; static int prod_options_fetch_values(const char *key, REGVAL_CTR *regvals) { - const char *value_ascii = ""; - fstring value; - int value_length; - + const char *value_ascii = ""; + fstring value; + int value_length; + switch (lp_server_role()) { case ROLE_DOMAIN_PDC: case ROLE_DOMAIN_BDC: @@ -49,12 +49,12 @@ static int prod_options_fetch_values(const char *key, REGVAL_CTR *regvals) value_ascii = "WinNT"; break; } - - value_length = push_ucs2( value, value, value_ascii, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( regvals, "ProductType", REG_SZ, value, - value_length ); - + + value_length = push_ucs2(value, value, value_ascii, sizeof(value), + STR_TERMINATE|STR_NOALIGN ); + regval_ctr_addvalue(regvals, "ProductType", REG_SZ, value, + value_length); + return regval_ctr_numvals( regvals ); } -- cgit From c5a5b404b43817525590aa924f1762824f49d156 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sat, 19 Jan 2008 23:46:13 +0100 Subject: Add a registry backend tcpip_params that replaces the former dynamic overlay. Michael (This used to be commit a8a743b693a162954948ca2438ce4b842c5cba30) --- source3/Makefile.in | 1 + source3/include/reg_objects.h | 1 + source3/registry/reg_backend_tcpip_params.c | 65 +++++++++++++++++++++++++++++ source3/registry/reg_db.c | 2 +- source3/registry/reg_dynamic.c | 26 ------------ source3/registry/reg_frontend.c | 2 + 6 files changed, 70 insertions(+), 27 deletions(-) create mode 100644 source3/registry/reg_backend_tcpip_params.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 57605d1018..7416ee2b3c 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -420,6 +420,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_frontend_hilvl.o \ registry/reg_backend_netlogon_params.o \ registry/reg_backend_prod_options.o \ + registry/reg_backend_tcpip_params.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index 021ed0e0fd..d33d469de3 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -102,6 +102,7 @@ typedef struct { #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" #define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" +#define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define KEY_TREE_ROOT "" /* diff --git a/source3/registry/reg_backend_tcpip_params.c b/source3/registry/reg_backend_tcpip_params.c new file mode 100644 index 0000000000..1714bdb439 --- /dev/null +++ b/source3/registry/reg_backend_tcpip_params.c @@ -0,0 +1,65 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * TCP/IP parameters registry backend. + * + * This replaces the former dynamic tcpip parameters overlay. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +extern REGISTRY_OPS regdb_ops; + +static int tcpip_params_fetch_values(const char *key, REGVAL_CTR *regvals) +{ + fstring value; + int value_length; + char *hname; + char *mydomainname = NULL; + + hname = myhostname(); + value_length = push_ucs2( value, value, hname, sizeof(value), STR_TERMINATE|STR_NOALIGN); + regval_ctr_addvalue( regvals, "Hostname",REG_SZ, value, value_length ); + + mydomainname = get_mydnsdomname(talloc_tos()); + if (!mydomainname) { + return -1; + } + + value_length = push_ucs2( value, value, mydomainname, sizeof(value), STR_TERMINATE|STR_NOALIGN); + regval_ctr_addvalue( regvals, "Domain", REG_SZ, value, value_length ); + + return regval_ctr_numvals( regvals ); +} + +static int tcpip_params_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} + +REGISTRY_OPS tcpip_params_reg_ops = { + .fetch_values = tcpip_params_fetch_values, + .fetch_subkeys = tcpip_params_fetch_subkeys, +}; diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index f70e44fd51..ce88c56c61 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -49,7 +49,7 @@ static const char *builtin_registry_paths[] = { "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors", KEY_PROD_OPTIONS, "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", - "HKLM\\SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters", + KEY_TCPIP_PARAMS, KEY_NETLOGON_PARAMS, "HKU", "HKCR", diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index 2735e2a27a..9d20b8935c 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -32,31 +32,6 @@ struct reg_dyn_values { /*********************************************************************** ***********************************************************************/ -static int tcpip_params( REGVAL_CTR *regvals ) -{ - fstring value; - int value_length; - char *hname; - char *mydomainname = NULL; - - hname = myhostname(); - value_length = push_ucs2( value, value, hname, sizeof(value), STR_TERMINATE|STR_NOALIGN); - regval_ctr_addvalue( regvals, "Hostname",REG_SZ, value, value_length ); - - mydomainname = get_mydnsdomname(talloc_tos()); - if (!mydomainname) { - return -1; - } - - value_length = push_ucs2( value, value, mydomainname, sizeof(value), STR_TERMINATE|STR_NOALIGN); - regval_ctr_addvalue( regvals, "Domain", REG_SZ, value, value_length ); - - return regval_ctr_numvals( regvals ); -} - -/*********************************************************************** -***********************************************************************/ - static int perflib_params( REGVAL_CTR *regvals ) { int base_index = -1; @@ -154,7 +129,6 @@ static int current_version( REGVAL_CTR *values ) ***********************************************************************/ static struct reg_dyn_values dynamic_values[] = { - { "HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/TCPIP/PARAMETERS", &tcpip_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION", ¤t_version }, diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 32ec7f9a87..6ecc8011e4 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -30,6 +30,7 @@ extern REGISTRY_OPS shares_reg_ops; extern REGISTRY_OPS smbconf_reg_ops; extern REGISTRY_OPS netlogon_params_reg_ops; extern REGISTRY_OPS prod_options_reg_ops; +extern REGISTRY_OPS tcpip_params_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -44,6 +45,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_SMBCONF, &smbconf_reg_ops }, { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops }, { KEY_PROD_OPTIONS, &prod_options_reg_ops }, + { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops }, #endif { NULL, NULL } }; -- cgit From b4e3c752722f6e7d143caa810ce0f8eb9c8d12c9 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:21:45 +0100 Subject: Some reformatting in tcpip_params_fetch_values(). Michael (This used to be commit 5b3813b233dc2a60e6d5a9942b4044219d800415) --- source3/registry/reg_backend_tcpip_params.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source3/registry/reg_backend_tcpip_params.c b/source3/registry/reg_backend_tcpip_params.c index 1714bdb439..db7df5dd8f 100644 --- a/source3/registry/reg_backend_tcpip_params.c +++ b/source3/registry/reg_backend_tcpip_params.c @@ -33,24 +33,26 @@ extern REGISTRY_OPS regdb_ops; static int tcpip_params_fetch_values(const char *key, REGVAL_CTR *regvals) { - fstring value; - int value_length; - char *hname; + fstring value; + int value_length; + char *hname; char *mydomainname = NULL; hname = myhostname(); - value_length = push_ucs2( value, value, hname, sizeof(value), STR_TERMINATE|STR_NOALIGN); - regval_ctr_addvalue( regvals, "Hostname",REG_SZ, value, value_length ); + value_length = push_ucs2(value, value, hname, sizeof(value), + STR_TERMINATE|STR_NOALIGN); + regval_ctr_addvalue(regvals, "Hostname",REG_SZ, value, value_length); mydomainname = get_mydnsdomname(talloc_tos()); if (!mydomainname) { return -1; } - value_length = push_ucs2( value, value, mydomainname, sizeof(value), STR_TERMINATE|STR_NOALIGN); - regval_ctr_addvalue( regvals, "Domain", REG_SZ, value, value_length ); + value_length = push_ucs2(value, value, mydomainname, sizeof(value), + STR_TERMINATE|STR_NOALIGN); + regval_ctr_addvalue(regvals, "Domain", REG_SZ, value, value_length); - return regval_ctr_numvals( regvals ); + return regval_ctr_numvals(regvals); } static int tcpip_params_fetch_subkeys(const char *key, -- cgit From 949a88ee2f1163605a73a28920190c11c25e4609 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:00:14 +0100 Subject: Add a registry backend hkpt_params that replaces the former dynamic overlay. Michael (This used to be commit 8e8bb6ba120adf9942f612b7fd89bdbced6c1285) --- source3/Makefile.in | 1 + source3/registry/reg_backend_hkpt_params.c | 67 ++++++++++++++++++++++++++++++ source3/registry/reg_dynamic.c | 29 ------------- source3/registry/reg_frontend.c | 2 + 4 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 source3/registry/reg_backend_hkpt_params.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 7416ee2b3c..0def36dd64 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -421,6 +421,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_backend_netlogon_params.o \ registry/reg_backend_prod_options.o \ registry/reg_backend_tcpip_params.o \ + registry/reg_backend_hkpt_params.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/registry/reg_backend_hkpt_params.c b/source3/registry/reg_backend_hkpt_params.c new file mode 100644 index 0000000000..0b962e10bd --- /dev/null +++ b/source3/registry/reg_backend_hkpt_params.c @@ -0,0 +1,67 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * HKPT parameters registry backend. + * + * This replaces the former dynamic hkpt parameters overlay. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +extern REGISTRY_OPS regdb_ops; + +static int hkpt_params_fetch_values(const char *key, REGVAL_CTR *regvals) +{ + uint32 base_index; + uint32 buffer_size; + char *buffer = NULL; + + /* This is ALMOST the same as perflib_009_params, but HKPT has + a "Counters" entry instead of a "Counter" key. */ + + base_index = reg_perfcount_get_base_index(); + buffer_size = reg_perfcount_get_counter_names(base_index, &buffer); + regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer, buffer_size); + + if(buffer_size > 0) + SAFE_FREE(buffer); + + buffer_size = reg_perfcount_get_counter_help(base_index, &buffer); + regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size); + if(buffer_size > 0) + SAFE_FREE(buffer); + + return regval_ctr_numvals( regvals ); +} + +static int hkpt_params_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} + +REGISTRY_OPS hkpt_params_reg_ops = { + .fetch_values = hkpt_params_fetch_values, + .fetch_subkeys = hkpt_params_fetch_subkeys, +}; diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index 9d20b8935c..c342cd07e4 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -75,33 +75,6 @@ static int perflib_009_params( REGVAL_CTR *regvals ) /*********************************************************************** ***********************************************************************/ -static int hkpt_params( REGVAL_CTR *regvals ) -{ - uint32 base_index; - uint32 buffer_size; - char *buffer = NULL; - - /* This is ALMOST the same as perflib_009_params, but HKPT has - a "Counters" entry instead of a "Counter" key. */ - - base_index = reg_perfcount_get_base_index(); - buffer_size = reg_perfcount_get_counter_names(base_index, &buffer); - regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer, buffer_size); - - if(buffer_size > 0) - SAFE_FREE(buffer); - - buffer_size = reg_perfcount_get_counter_help(base_index, &buffer); - regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size); - if(buffer_size > 0) - SAFE_FREE(buffer); - - return regval_ctr_numvals( regvals ); -} - -/*********************************************************************** -***********************************************************************/ - static int current_version( REGVAL_CTR *values ) { const char *sysroot_string = "c:\\Windows"; @@ -122,7 +95,6 @@ static int current_version( REGVAL_CTR *values ) return regval_ctr_numvals( values ); } - /*********************************************************************** Structure holding the registry paths and pointers to the value enumeration functions @@ -132,7 +104,6 @@ static struct reg_dyn_values dynamic_values[] = { { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION", ¤t_version }, - { "HKPT", &hkpt_params }, { NULL, NULL } }; diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 6ecc8011e4..9539c2ba2f 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -31,6 +31,7 @@ extern REGISTRY_OPS smbconf_reg_ops; extern REGISTRY_OPS netlogon_params_reg_ops; extern REGISTRY_OPS prod_options_reg_ops; extern REGISTRY_OPS tcpip_params_reg_ops; +extern REGISTRY_OPS hkpt_params_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -46,6 +47,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_NETLOGON_PARAMS, &netlogon_params_reg_ops }, { KEY_PROD_OPTIONS, &prod_options_reg_ops }, { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops }, + { KEY_HKPT, &hkpt_params_reg_ops }, #endif { NULL, NULL } }; -- cgit From 8eed06fb8cc6db37d15ddc0f64744a536588ba29 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:15:31 +0100 Subject: Some reformatting in hkpt_params_fetch_values(). Michael (This used to be commit f245c4e094ad56080847e286c76976f29c95a221) --- source3/registry/reg_backend_hkpt_params.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source3/registry/reg_backend_hkpt_params.c b/source3/registry/reg_backend_hkpt_params.c index 0b962e10bd..2ed5e78e1c 100644 --- a/source3/registry/reg_backend_hkpt_params.c +++ b/source3/registry/reg_backend_hkpt_params.c @@ -39,19 +39,22 @@ static int hkpt_params_fetch_values(const char *key, REGVAL_CTR *regvals) /* This is ALMOST the same as perflib_009_params, but HKPT has a "Counters" entry instead of a "Counter" key. */ - + base_index = reg_perfcount_get_base_index(); buffer_size = reg_perfcount_get_counter_names(base_index, &buffer); - regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer, buffer_size); - - if(buffer_size > 0) + regval_ctr_addvalue(regvals, "Counters", REG_MULTI_SZ, buffer, + buffer_size); + + if(buffer_size > 0) { SAFE_FREE(buffer); - + } + buffer_size = reg_perfcount_get_counter_help(base_index, &buffer); regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size); - if(buffer_size > 0) + if(buffer_size > 0) { SAFE_FREE(buffer); - + } + return regval_ctr_numvals( regvals ); } -- cgit From 25c21fb562c6bb9c61a9e2e58d585619f18d3c84 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 01:09:52 +0100 Subject: Use some consts instead of literal strings for registry keys. Michael (This used to be commit 80024f4e1c6594c3038e86a765f763d24fd96b59) --- source3/registry/reg_db.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index ce88c56c61..fad6c8acd1 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -51,10 +51,10 @@ static const char *builtin_registry_paths[] = { "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", KEY_TCPIP_PARAMS, KEY_NETLOGON_PARAMS, - "HKU", - "HKCR", - "HKPD", - "HKPT", + KEY_HKU, + KEY_HKCR, + KEY_HKPD, + KEY_HKPT, NULL }; struct builtin_regkey_value { -- cgit From a1af15d29f1e009a80bf205397a6a0b122d67e26 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 02:23:00 +0100 Subject: Reorder the registry key name constants in a more systematic way. Michael (This used to be commit faf406a4a1baf2946ea754a0760204748be99541) --- source3/include/reg_objects.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index d33d469de3..e6fbcbdd6d 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -94,15 +94,15 @@ typedef struct { #define KEY_HKCU "HKCU" #define KEY_HKDD "HKDD" #define KEY_SERVICES "HKLM\\SYSTEM\\CurrentControlSet\\Services" -#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" -#define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" -#define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" #define KEY_EVENTLOG "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Eventlog" #define KEY_SHARES "HKLM\\SYSTEM\\CurrentControlSet\\Services\\LanmanServer\\Shares" -#define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_NETLOGON_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Netlogon\\Parameters" -#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" #define KEY_TCPIP_PARAMS "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define KEY_PROD_OPTIONS "HKLM\\SYSTEM\\CurrentControlSet\\Control\\ProductOptions" +#define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" +#define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" +#define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" +#define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_TREE_ROOT "" /* -- cgit From 2925d8357319c9872d570fe045c883a25891b59e Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 03:24:13 +0100 Subject: Add a registry backend current_version that replaces the former dynamic overlay. Make sure to only respond to the exact current version key since subkeys are registered by other backends (printing and - soon - perflib). Michael (This used to be commit 2c650bf63ccd9dc5dddbf4700831489544ded055) --- source3/Makefile.in | 1 + source3/include/reg_objects.h | 1 + source3/registry/reg_backend_current_version.c | 80 ++++++++++++++++++++++++++ source3/registry/reg_dynamic.c | 24 -------- source3/registry/reg_frontend.c | 2 + 5 files changed, 84 insertions(+), 24 deletions(-) create mode 100644 source3/registry/reg_backend_current_version.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 0def36dd64..fa40d92948 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -422,6 +422,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_backend_prod_options.o \ registry/reg_backend_tcpip_params.o \ registry/reg_backend_hkpt_params.o \ + registry/reg_backend_current_version.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index e6fbcbdd6d..24db16261d 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -102,6 +102,7 @@ typedef struct { #define KEY_PRINTING "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print" #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" +#define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_TREE_ROOT "" diff --git a/source3/registry/reg_backend_current_version.c b/source3/registry/reg_backend_current_version.c new file mode 100644 index 0000000000..51b081721c --- /dev/null +++ b/source3/registry/reg_backend_current_version.c @@ -0,0 +1,80 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * CurrentVersion registry backend. + * + * This is a virtual overlay, dynamically presenting version information. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +extern REGISTRY_OPS regdb_ops; + +#define KEY_CURRENT_VERSION_NORM "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION" + +static int current_version_fetch_values(const char *key, REGVAL_CTR *values) +{ + const char *sysroot_string = "c:\\Windows"; + fstring sysversion; + fstring value; + uint32 value_length; + char *path = NULL; + TALLOC_CTX *ctx = talloc_tos(); + + path = talloc_strdup(ctx, key); + if (path == NULL) { + return -1; + } + path = normalize_reg_path(ctx, path); + if (path == NULL) { + return -1; + } + + if (strncmp(path, KEY_CURRENT_VERSION_NORM, strlen(path)) != 0) { + return 0; + } + + value_length = push_ucs2( value, value, sysroot_string, sizeof(value), + STR_TERMINATE|STR_NOALIGN ); + regval_ctr_addvalue( values, "SystemRoot", REG_SZ, value, value_length ); + + fstr_sprintf( sysversion, "%d.%d", lp_major_announce_version(), lp_minor_announce_version() ); + value_length = push_ucs2( value, value, sysversion, sizeof(value), + STR_TERMINATE|STR_NOALIGN ); + regval_ctr_addvalue( values, "CurrentVersion", REG_SZ, value, value_length ); + + + return regval_ctr_numvals( values ); +} + +static int current_version_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} + +REGISTRY_OPS current_version_reg_ops = { + .fetch_values = current_version_fetch_values, + .fetch_subkeys = current_version_fetch_subkeys, +}; diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index c342cd07e4..ca87cc60f5 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -72,29 +72,6 @@ static int perflib_009_params( REGVAL_CTR *regvals ) return regval_ctr_numvals( regvals ); } -/*********************************************************************** -***********************************************************************/ - -static int current_version( REGVAL_CTR *values ) -{ - const char *sysroot_string = "c:\\Windows"; - fstring sysversion; - fstring value; - uint32 value_length; - - value_length = push_ucs2( value, value, sysroot_string, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( values, "SystemRoot", REG_SZ, value, value_length ); - - fstr_sprintf( sysversion, "%d.%d", lp_major_announce_version(), lp_minor_announce_version() ); - value_length = push_ucs2( value, value, sysversion, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( values, "CurrentVersion", REG_SZ, value, value_length ); - - - return regval_ctr_numvals( values ); -} - /*********************************************************************** Structure holding the registry paths and pointers to the value enumeration functions @@ -103,7 +80,6 @@ static int current_version( REGVAL_CTR *values ) static struct reg_dyn_values dynamic_values[] = { { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, - { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION", ¤t_version }, { NULL, NULL } }; diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index 9539c2ba2f..d489050904 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -32,6 +32,7 @@ extern REGISTRY_OPS netlogon_params_reg_ops; extern REGISTRY_OPS prod_options_reg_ops; extern REGISTRY_OPS tcpip_params_reg_ops; extern REGISTRY_OPS hkpt_params_reg_ops; +extern REGISTRY_OPS current_version_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -48,6 +49,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_PROD_OPTIONS, &prod_options_reg_ops }, { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops }, { KEY_HKPT, &hkpt_params_reg_ops }, + { KEY_CURRENT_VERSION, ¤t_version_reg_ops }, #endif { NULL, NULL } }; -- cgit From c4b65647ca551eeb87ec31579eda9ebf79fdceed Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 03:25:54 +0100 Subject: Some reformatting of current_version_fetch_values(). Michael (This used to be commit d2e3814db8a4a5f0fc097e9f56753888470ef213) --- source3/registry/reg_backend_current_version.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/source3/registry/reg_backend_current_version.c b/source3/registry/reg_backend_current_version.c index 51b081721c..a9d281c522 100644 --- a/source3/registry/reg_backend_current_version.c +++ b/source3/registry/reg_backend_current_version.c @@ -55,17 +55,18 @@ static int current_version_fetch_values(const char *key, REGVAL_CTR *values) return 0; } - value_length = push_ucs2( value, value, sysroot_string, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( values, "SystemRoot", REG_SZ, value, value_length ); - - fstr_sprintf( sysversion, "%d.%d", lp_major_announce_version(), lp_minor_announce_version() ); - value_length = push_ucs2( value, value, sysversion, sizeof(value), - STR_TERMINATE|STR_NOALIGN ); - regval_ctr_addvalue( values, "CurrentVersion", REG_SZ, value, value_length ); - - - return regval_ctr_numvals( values ); + value_length = push_ucs2(value, value, sysroot_string, sizeof(value), + STR_TERMINATE|STR_NOALIGN ); + regval_ctr_addvalue(values, "SystemRoot", REG_SZ, value, value_length); + + fstr_sprintf(sysversion, "%d.%d", lp_major_announce_version(), + lp_minor_announce_version()); + value_length = push_ucs2(value, value, sysversion, sizeof(value), + STR_TERMINATE|STR_NOALIGN); + regval_ctr_addvalue(values, "CurrentVersion", REG_SZ, value, + value_length); + + return regval_ctr_numvals(values); } static int current_version_fetch_subkeys(const char *key, -- cgit From c16b74cc861c031fda34ea131dadc9d4e175a8ed Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 03:39:27 +0100 Subject: Add a registry backend perflib that replaces the former dynamic overlay. Michael (This used to be commit c3fba415951329ee90c7250b4e8d539f91b227f6) --- source3/Makefile.in | 1 + source3/include/reg_objects.h | 2 + source3/registry/reg_backend_perflib.c | 106 +++++++++++++++++++++++++++++++++ source3/registry/reg_db.c | 4 +- source3/registry/reg_dynamic.c | 45 -------------- source3/registry/reg_frontend.c | 2 + 6 files changed, 113 insertions(+), 47 deletions(-) create mode 100644 source3/registry/reg_backend_perflib.c diff --git a/source3/Makefile.in b/source3/Makefile.in index fa40d92948..1dcf75847f 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -423,6 +423,7 @@ REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_pri registry/reg_backend_tcpip_params.o \ registry/reg_backend_hkpt_params.o \ registry/reg_backend_current_version.o \ + registry/reg_backend_perflib.o \ $(UTIL_REG_API_OBJ) $(UTIL_REG_SMBCONF_OBJ) RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o diff --git a/source3/include/reg_objects.h b/source3/include/reg_objects.h index 24db16261d..3df701f61c 100644 --- a/source3/include/reg_objects.h +++ b/source3/include/reg_objects.h @@ -103,6 +103,8 @@ typedef struct { #define KEY_PRINTING_2K "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers" #define KEY_PRINTING_PORTS "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Ports" #define KEY_CURRENT_VERSION "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion" +#define KEY_PERFLIB "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib" +#define KEY_PERFLIB_009 "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009" #define KEY_SMBCONF "HKLM\\SOFTWARE\\Samba\\smbconf" #define KEY_TREE_ROOT "" diff --git a/source3/registry/reg_backend_perflib.c b/source3/registry/reg_backend_perflib.c new file mode 100644 index 0000000000..999bca2682 --- /dev/null +++ b/source3/registry/reg_backend_perflib.c @@ -0,0 +1,106 @@ +/* + * Unix SMB/CIFS implementation. + * Virtual Windows Registry Layer + * Copyright (C) Gerald Carter 2002-2005 + * Copyright (C) Michael Adam 2008 + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +/* + * perflib registry backend. + * + * This is a virtual overlay, dynamically presenting perflib values. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_REGISTRY + +extern REGISTRY_OPS regdb_ops; + +#define KEY_PERFLIB_NORM "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB" +#define KEY_PERFLIB_009_NORM "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009" + +static int perflib_params( REGVAL_CTR *regvals ) +{ + int base_index = -1; + int last_counter = -1; + int last_help = -1; + int version = 0x00010001; + + base_index = reg_perfcount_get_base_index(); + regval_ctr_addvalue(regvals, "Base Index", REG_DWORD, (char *)&base_index, sizeof(base_index)); + last_counter = reg_perfcount_get_last_counter(base_index); + regval_ctr_addvalue(regvals, "Last Counter", REG_DWORD, (char *)&last_counter, sizeof(last_counter)); + last_help = reg_perfcount_get_last_help(last_counter); + regval_ctr_addvalue(regvals, "Last Help", REG_DWORD, (char *)&last_help, sizeof(last_help)); + regval_ctr_addvalue(regvals, "Version", REG_DWORD, (char *)&version, sizeof(version)); + + return regval_ctr_numvals( regvals ); +} + +static int perflib_009_params( REGVAL_CTR *regvals ) +{ + int base_index; + int buffer_size; + char *buffer = NULL; + + base_index = reg_perfcount_get_base_index(); + buffer_size = reg_perfcount_get_counter_names(base_index, &buffer); + regval_ctr_addvalue(regvals, "Counter", REG_MULTI_SZ, buffer, buffer_size); + if(buffer_size > 0) + SAFE_FREE(buffer); + buffer_size = reg_perfcount_get_counter_help(base_index, &buffer); + regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size); + if(buffer_size > 0) + SAFE_FREE(buffer); + + return regval_ctr_numvals( regvals ); +} + +static int perflib_fetch_values(const char *key, REGVAL_CTR *regvals) +{ + char *path = NULL; + TALLOC_CTX *ctx = talloc_tos(); + + path = talloc_strdup(ctx, key); + if (path == NULL) { + return -1; + } + path = normalize_reg_path(ctx, path); + if (path == NULL) { + return -1; + } + + if (strncmp(path, KEY_PERFLIB_NORM, strlen(path)) == 0) { + return perflib_params(regvals); + } else if (strncmp(path, KEY_PERFLIB_009_NORM, strlen(path)) == 0) { + return perflib_009_params(regvals); + } else { + return 0; + } +} + +static int perflib_fetch_subkeys(const char *key, + REGSUBKEY_CTR *subkey_ctr) +{ + return regdb_ops.fetch_subkeys(key, subkey_ctr); +} + +REGISTRY_OPS perflib_reg_ops = { + .fetch_values = perflib_fetch_values, + .fetch_subkeys = perflib_fetch_subkeys, +}; diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index fad6c8acd1..e162fb587f 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -44,8 +44,8 @@ static const char *builtin_registry_paths[] = { KEY_SHARES, KEY_EVENTLOG, KEY_SMBCONF, - "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", - "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib\\009", + KEY_PERFLIB, + KEY_PERFLIB_009, "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Print\\Monitors", KEY_PROD_OPTIONS, "HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\DefaultUserConfiguration", diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c index ca87cc60f5..97cb462615 100644 --- a/source3/registry/reg_dynamic.c +++ b/source3/registry/reg_dynamic.c @@ -29,57 +29,12 @@ struct reg_dyn_values { int (*fetch_values) ( REGVAL_CTR *val ); }; -/*********************************************************************** -***********************************************************************/ - -static int perflib_params( REGVAL_CTR *regvals ) -{ - int base_index = -1; - int last_counter = -1; - int last_help = -1; - int version = 0x00010001; - - base_index = reg_perfcount_get_base_index(); - regval_ctr_addvalue(regvals, "Base Index", REG_DWORD, (char *)&base_index, sizeof(base_index)); - last_counter = reg_perfcount_get_last_counter(base_index); - regval_ctr_addvalue(regvals, "Last Counter", REG_DWORD, (char *)&last_counter, sizeof(last_counter)); - last_help = reg_perfcount_get_last_help(last_counter); - regval_ctr_addvalue(regvals, "Last Help", REG_DWORD, (char *)&last_help, sizeof(last_help)); - regval_ctr_addvalue(regvals, "Version", REG_DWORD, (char *)&version, sizeof(version)); - - return regval_ctr_numvals( regvals ); -} - -/*********************************************************************** -***********************************************************************/ - -static int perflib_009_params( REGVAL_CTR *regvals ) -{ - int base_index; - int buffer_size; - char *buffer = NULL; - - base_index = reg_perfcount_get_base_index(); - buffer_size = reg_perfcount_get_counter_names(base_index, &buffer); - regval_ctr_addvalue(regvals, "Counter", REG_MULTI_SZ, buffer, buffer_size); - if(buffer_size > 0) - SAFE_FREE(buffer); - buffer_size = reg_perfcount_get_counter_help(base_index, &buffer); - regval_ctr_addvalue(regvals, "Help", REG_MULTI_SZ, buffer, buffer_size); - if(buffer_size > 0) - SAFE_FREE(buffer); - - return regval_ctr_numvals( regvals ); -} - /*********************************************************************** Structure holding the registry paths and pointers to the value enumeration functions ***********************************************************************/ static struct reg_dyn_values dynamic_values[] = { - { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB", &perflib_params }, - { "HKLM/SOFTWARE/MICROSOFT/WINDOWS NT/CURRENTVERSION/PERFLIB/009", &perflib_009_params }, { NULL, NULL } }; diff --git a/source3/registry/reg_frontend.c b/source3/registry/reg_frontend.c index d489050904..9a35eb2263 100644 --- a/source3/registry/reg_frontend.c +++ b/source3/registry/reg_frontend.c @@ -33,6 +33,7 @@ extern REGISTRY_OPS prod_options_reg_ops; extern REGISTRY_OPS tcpip_params_reg_ops; extern REGISTRY_OPS hkpt_params_reg_ops; extern REGISTRY_OPS current_version_reg_ops; +extern REGISTRY_OPS perflib_reg_ops; extern REGISTRY_OPS regdb_ops; /* these are the default */ /* array of REGISTRY_HOOK's which are read into a tree for easy access */ @@ -50,6 +51,7 @@ REGISTRY_HOOK reg_hooks[] = { { KEY_TCPIP_PARAMS, &tcpip_params_reg_ops }, { KEY_HKPT, &hkpt_params_reg_ops }, { KEY_CURRENT_VERSION, ¤t_version_reg_ops }, + { KEY_PERFLIB, &perflib_reg_ops }, #endif { NULL, NULL } }; -- cgit From e45dacce898021bbce0ba5b2c18dc8e103931e51 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Jan 2008 03:45:40 +0100 Subject: Remove the dynamic registry overlay. It is unnecessary now the dynamic functions have been made registry backends of their own. Michael (This used to be commit e327953bd6b11aeb6f2ae48b49550a942eae8e88) --- source3/Makefile.in | 3 +- source3/registry/reg_dynamic.c | 92 ----------------------------------- source3/registry/reg_frontend_hilvl.c | 11 ----- 3 files changed, 1 insertion(+), 105 deletions(-) delete mode 100644 source3/registry/reg_dynamic.c diff --git a/source3/Makefile.in b/source3/Makefile.in index 1dcf75847f..b32fc2fe77 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -415,7 +415,7 @@ REGOBJS_OBJ = registry/reg_objects.o REGISTRY_OBJ = registry/reg_frontend.o registry/reg_cachehook.o registry/reg_printing.o \ registry/reg_db.o registry/reg_eventlog.o registry/reg_shares.o \ - registry/reg_util.o registry/reg_dynamic.o registry/reg_perfcount.o \ + registry/reg_util.o registry/reg_perfcount.o \ registry/reg_smbconf.o registry/reg_api.o \ registry/reg_frontend_hilvl.o \ registry/reg_backend_netlogon_params.o \ @@ -741,7 +741,6 @@ REG_API_OBJ = registry/reg_api.o \ registry/reg_cachehook.o \ registry/reg_eventlog.o \ registry/reg_perfcount.o \ - registry/reg_dynamic.o \ \ lib/util_nttoken.o \ $(UTIL_REG_API_OBJ) \ diff --git a/source3/registry/reg_dynamic.c b/source3/registry/reg_dynamic.c deleted file mode 100644 index 97cb462615..0000000000 --- a/source3/registry/reg_dynamic.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Unix SMB/CIFS implementation. - * Virtual Windows Registry Layer - * Copyright (C) Gerald Carter 2002-2005 - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -/* Implementation of registry frontend view functions. */ - -#include "includes.h" - -#undef DBGC_CLASS -#define DBGC_CLASS DBGC_REGISTRY - -struct reg_dyn_values { - const char *path; - int (*fetch_values) ( REGVAL_CTR *val ); -}; - -/*********************************************************************** - Structure holding the registry paths and pointers to the value - enumeration functions -***********************************************************************/ - -static struct reg_dyn_values dynamic_values[] = { - { NULL, NULL } -}; - -/*********************************************************************** -***********************************************************************/ - -int fetch_dynamic_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) -{ - int i; - char *path = NULL; - TALLOC_CTX *ctx = talloc_tos(); - - path = talloc_strdup(ctx, key->name); - if (!path) { - return -1; - } - path = normalize_reg_path(ctx, path); - if (!path) { - return -1; - } - - for ( i=0; dynamic_values[i].path; i++ ) { - if ( strcmp( path, dynamic_values[i].path ) == 0 ) - return dynamic_values[i].fetch_values( val ); - } - - return -1; -} - -/*********************************************************************** -***********************************************************************/ - -bool check_dynamic_reg_values( REGISTRY_KEY *key ) -{ - int i; - char *path = NULL; - TALLOC_CTX *ctx = talloc_tos(); - - path = talloc_strdup(ctx, key->name); - if (!path) { - return false; - } - path = normalize_reg_path(ctx, path); - if (!path) { - return false; - } - - for ( i=0; dynamic_values[i].path; i++ ) { - /* can't write to dynamic keys */ - if ( strcmp( path, dynamic_values[i].path ) == 0 ) - return true; - } - - return false; -} diff --git a/source3/registry/reg_frontend_hilvl.c b/source3/registry/reg_frontend_hilvl.c index cd02eeef74..6819d06704 100644 --- a/source3/registry/reg_frontend_hilvl.c +++ b/source3/registry/reg_frontend_hilvl.c @@ -87,9 +87,6 @@ bool store_reg_keys( REGISTRY_KEY *key, REGSUBKEY_CTR *subkeys ) bool store_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { - if ( check_dynamic_reg_values( key ) ) - return false; - if ( key->hook && key->hook->ops && key->hook->ops->store_values ) return key->hook->ops->store_values( key->name, val ); @@ -122,14 +119,6 @@ int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) if ( key->hook && key->hook->ops && key->hook->ops->fetch_values ) result = key->hook->ops->fetch_values( key->name, val ); - /* if the backend lookup returned no data, try the dynamic overlay */ - - if ( result == 0 ) { - result = fetch_dynamic_reg_values( key, val ); - - return ( result != -1 ) ? result : 0; - } - return result; } -- cgit From 7745674f0cbf5be272ad20fdd1e5edd45165e849 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 16:08:52 +0100 Subject: Add some debugging output to reg_cachehook.c Michael (This used to be commit 2a278928805f4497e8afa28bdca433cbedc4a8d7) --- source3/registry/reg_cachehook.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index 22352c6112..f9851c7810 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -37,6 +37,11 @@ bool reghook_cache_init( void ) { if (cache_tree == NULL) { cache_tree = pathtree_init(&default_hook, NULL); + if (cache_tree !=0) { + DEBUG(10, ("reghook_cache_init: new tree with default " + "ops %p for key [%s]\n", (void *)®db_ops, + KEY_TREE_ROOT)); + } } return (cache_tree != NULL); @@ -65,7 +70,8 @@ bool reghook_cache_add( REGISTRY_HOOK *hook ) return false; } - DEBUG(10,("reghook_cache_add: Adding key [%s]\n", key)); + DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n", + (void *)hook->ops, key)); return pathtree_add( cache_tree, key, hook ); } @@ -102,6 +108,9 @@ REGISTRY_HOOK* reghook_cache_find( const char *keyname ) DEBUG(10,("reghook_cache_find: Searching for keyname [%s]\n", key)); hook = (REGISTRY_HOOK *)pathtree_find( cache_tree, key ) ; + + DEBUG(10, ("reghook_cache_find: found ops %p for key [%s]\n", + hook ? (void *)hook->ops : 0, key)); SAFE_FREE( key ); -- cgit From 6c5a831e96982ce0954c09de126205e334ff3a31 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 17:57:32 +0100 Subject: Add a debug message to fetch_reg_values(). Michael (This used to be commit 239aa59cc1b78f7fb82aa66418cdf92517ebc123) --- source3/registry/reg_frontend_hilvl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/registry/reg_frontend_hilvl.c b/source3/registry/reg_frontend_hilvl.c index 6819d06704..e6e7613457 100644 --- a/source3/registry/reg_frontend_hilvl.c +++ b/source3/registry/reg_frontend_hilvl.c @@ -116,6 +116,9 @@ int fetch_reg_values( REGISTRY_KEY *key, REGVAL_CTR *val ) { int result = -1; + DEBUG(10, ("fetch_reg_values called for key '%s' (ops %p)\n", key->name, + (key->hook && key->hook->ops) ? (void *)key->hook->ops : NULL)); + if ( key->hook && key->hook->ops && key->hook->ops->fetch_values ) result = key->hook->ops->fetch_values( key->name, val ); -- cgit From 536bff422969f79e92e90ca959716624fbb96ed1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 18 Jan 2008 16:06:37 +0100 Subject: Do an explicit init_globals() when restarting for "config backend = registry". Michael (This used to be commit 487c43f9284598a3c60b06fc60e5c50844e11b87) --- source3/param/loadparm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 0d3fbbf77c..0796a78dd3 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -5725,6 +5725,7 @@ bool lp_load(const char *pszFname, */ config_backend = CONFIG_BACKEND_REGISTRY; /* start over */ + init_globals(false); return lp_load(pszFname, global_only, save_defaults, add_ipc, initialize_globals); } -- cgit From 0bb6fb7b6f8ea1c039e710f55bba779363716f2d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 19 Jan 2008 21:53:49 -0800 Subject: Couple of minor fixes for POSIX pathname processing in the new stream code. (1) In smbd/filename, don't split the name at ':' if we know it's a posix path (this should be parameterized....). (2). When calling posix_mkdir, we get the flag FILE_FLAG_POSIX_SEMANTICS passed to open_directory(). I know for a posix client lp_posix_pathnames should be true (which is checked for in is_ntfs_stream_name() but we have an explicit flag here, so let's use it. Jeremy. (This used to be commit 7bb7a0def6518784befa75e5303289d2b4d36dd4) --- source3/smbd/filename.c | 18 ++++++++++-------- source3/smbd/open.c | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 1d44c7498e..10e9583049 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -214,16 +214,18 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } - stream = strchr_m(name, ':'); + if (!lp_posix_pathnames()) { + stream = strchr_m(name, ':'); - if (stream != NULL) { - char *tmp = talloc_strdup(ctx, stream); - if (tmp == NULL) { - TALLOC_FREE(name); - return NT_STATUS_NO_MEMORY; + if (stream != NULL) { + char *tmp = talloc_strdup(ctx, stream); + if (tmp == NULL) { + TALLOC_FREE(name); + return NT_STATUS_NO_MEMORY; + } + *stream = '\0'; + stream = tmp; } - *stream = '\0'; - stream = tmp; } /* diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 0d6e07a032..ad221c3227 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2106,7 +2106,7 @@ NTSTATUS open_directory(connection_struct *conn, (unsigned int)create_disposition, (unsigned int)file_attributes)); - if (is_ntfs_stream_name(fname)) { + if (!(file_attributes & FILE_FLAG_POSIX_SEMANTICS) && is_ntfs_stream_name(fname)) { DEBUG(2, ("open_directory: %s is a stream name!\n", fname)); return NT_STATUS_NOT_A_DIRECTORY; } -- cgit From 611609ee2584cc0703c0524ae712ee385ae006f4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 09:03:32 +0100 Subject: Fix a segfault MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointed out by Steven Danneman on irc, thanks! Jerry, Günther, please check! (This used to be commit 9e71c89ac648040739ef2161a2e6c4299be1e35b) --- source3/winbindd/winbindd_cm.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 908228717e..ef159f0670 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -613,7 +613,13 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, DS_RETURN_DNS_NAME, &domain_info); if (W_ERROR_IS_OK(werr)) { - fstrcpy(tmp, domain_info->domain_controller_name); + tmp = talloc_strdup( + mem_ctx, domain_info->domain_controller_name); + if (tmp == NULL) { + DEBUG(0, ("talloc_strdup failed\n")); + talloc_destroy(mem_ctx); + return false; + } if (strlen(domain->alt_name) == 0) { fstrcpy(domain->alt_name, domain_info->domain_name); @@ -635,11 +641,10 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, /* And restore our original timeout. */ cli_set_timeout(netlogon_pipe->cli, orig_timeout); - talloc_destroy(mem_ctx); - if (!W_ERROR_IS_OK(werr)) { DEBUG(10, ("rpccli_netlogon_getanydcname failed: %s\n", dos_errstr(werr))); + talloc_destroy(mem_ctx); return False; } @@ -654,6 +659,8 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain, fstrcpy(dcname, p); + talloc_destroy(mem_ctx); + DEBUG(10, ("rpccli_netlogon_getanydcname returned %s\n", dcname)); if (!resolve_name(dcname, dc_ss, 0x20)) { -- cgit From e1d01878f5e7c4a0f7d90ae0463bd6c11774d910 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 11:10:06 +0100 Subject: Complete the ea->xattr rename in vfs_xattr_tdb (This used to be commit dac468216e7e103b6897f33ec3608412f77265cf) --- source3/modules/vfs_xattr_tdb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 597dd38eaf..0acca51c5d 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -558,7 +558,8 @@ static bool xattr_tdb_init(int snum, struct db_context **p_db) struct db_context *db; const char *dbname; - dbname = lp_parm_const_string(snum, "ea", "tdb", lock_path("eas.tdb")); + dbname = lp_parm_const_string(snum, "xattr", "tdb", + lock_path("xattr.tdb")); if (dbname == NULL) { errno = ENOTSUP; @@ -660,7 +661,7 @@ static int xattr_tdb_rmdir(vfs_handle_struct *handle, const char *path) * Destructor for the VFS private data */ -static void close_ea_db(void **data) +static void close_xattr_db(void **data) { struct db_context **p_db = (struct db_context **)data; TALLOC_FREE(*p_db); @@ -688,14 +689,14 @@ static int xattr_tdb_connect(vfs_handle_struct *handle, const char *service, } if (!xattr_tdb_init(snum, &db)) { - DEBUG(5, ("Could not init ea tdb\n")); + DEBUG(5, ("Could not init xattr tdb\n")); lp_do_parameter(snum, "ea support", "False"); return 0; } lp_do_parameter(snum, "ea support", "True"); - SMB_VFS_HANDLE_SET_DATA(handle, db, close_ea_db, + SMB_VFS_HANDLE_SET_DATA(handle, db, close_xattr_db, struct db_context, return -1); return 0; -- cgit From 0b9314db5ace99096d7f8afa7f449f8e734a6b64 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 11:20:58 +0100 Subject: Support XATTR_CREATE and XATTR_REPLACE in vfs_xattr_tdb (This used to be commit 3509ee597f0977aadd4c70cfe8830a6aa95cd71f) --- source3/modules/vfs_xattr_tdb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 0acca51c5d..7416fa785a 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -269,6 +269,11 @@ static int xattr_tdb_setattr(struct db_context *db_ctx, for (i=0; inum_xattrs; i++) { if (strcmp(attribs->xattrs[i].name, name) == 0) { + if (flags & XATTR_CREATE) { + TALLOC_FREE(rec); + errno = EEXIST; + return -1; + } break; } } @@ -276,6 +281,12 @@ static int xattr_tdb_setattr(struct db_context *db_ctx, if (i == attribs->num_xattrs) { struct tdb_xattr *tmp; + if (flags & XATTR_REPLACE) { + TALLOC_FREE(rec); + errno = ENOATTR; + return -1; + } + tmp = TALLOC_REALLOC_ARRAY( attribs, attribs->xattrs, struct tdb_xattr, attribs->num_xattrs + 1); -- cgit From a6fcaf73d7ae238283cd107260ae215d31b05ac4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 13:49:38 +0100 Subject: Really remove the _NEXT_ from vfs_xattr_tdb.c This must have been lost somewhere in my patch-mangling (This used to be commit c1794375d1fa27d72ec32946bb4bd7b9f96e59fc) --- source3/modules/vfs_streams_xattr.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 3701cddfb5..104ed638db 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -131,7 +131,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname, goto fail; } - if (SMB_VFS_NEXT_STAT(handle, base, sbuf) == -1) { + if (SMB_VFS_STAT(handle->conn, base, sbuf) == -1) { goto fail; } @@ -178,7 +178,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle, const char *fname, goto fail; } - if (SMB_VFS_NEXT_LSTAT(handle, base, sbuf) == -1) { + if (SMB_VFS_LSTAT(handle->conn, base, sbuf) == -1) { goto fail; } @@ -248,7 +248,7 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, baseflags &= ~O_EXCL; baseflags &= ~O_CREAT; - hostfd = SMB_VFS_NEXT_OPEN(handle, base, fsp, baseflags, mode); + hostfd = SMB_VFS_OPEN(handle->conn, base, fsp, baseflags, mode); /* It is legit to open a stream on a directory, but the base * fd has to be read-only. @@ -256,8 +256,8 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, if ((hostfd == -1) && (errno == EISDIR)) { baseflags &= ~O_ACCMODE; baseflags |= O_RDONLY; - hostfd = SMB_VFS_NEXT_OPEN(handle, fname, fsp, baseflags, - mode); + hostfd = SMB_VFS_OPEN(handle->conn, fname, fsp, baseflags, + mode); } if (hostfd == -1) { @@ -289,8 +289,12 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, */ char null = '\0'; - if (SMB_VFS_NEXT_SETXATTR( - handle, base, xattr_name, &null, sizeof(null), + DEBUG(10, ("creating attribute %s on file %s\n", + xattr_name, base)); + + if (SMB_VFS_SETXATTR( + handle->conn, base, xattr_name, + &null, sizeof(null), flags & O_EXCL ? XATTR_CREATE : 0) == -1) { goto fail; } @@ -299,8 +303,9 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, if (flags & O_TRUNC) { char null = '\0'; - if (SMB_VFS_NEXT_SETXATTR( - handle, base, xattr_name, &null, sizeof(null), + if (SMB_VFS_SETXATTR( + handle->conn, base, xattr_name, + &null, sizeof(null), flags & O_EXCL ? XATTR_CREATE : 0) == -1) { goto fail; } @@ -332,7 +337,7 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, * BUGBUGBUG -- we would need to call fd_close_posix here, but * we don't have a full fsp yet */ - SMB_VFS_NEXT_CLOSE(handle, fsp, hostfd); + SMB_VFS_CLOSE(fsp, hostfd); } TALLOC_FREE(frame); @@ -364,7 +369,7 @@ static int streams_xattr_unlink(vfs_handle_struct *handle, const char *fname) goto fail; } - ret = SMB_VFS_NEXT_REMOVEXATTR(handle, base, xattr_name); + ret = SMB_VFS_REMOVEXATTR(handle->conn, base, xattr_name); if ((ret == -1) && (errno == ENOATTR)) { errno = ENOENT; @@ -497,13 +502,13 @@ static NTSTATUS streams_xattr_streaminfo(vfs_handle_struct *handle, if (is_ntfs_stream_name(fsp->fsp_name)) { return NT_STATUS_INVALID_PARAMETER; } - ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf); + ret = SMB_VFS_FSTAT(fsp, &sbuf); } else { if (is_ntfs_stream_name(fname)) { return NT_STATUS_INVALID_PARAMETER; } - ret = SMB_VFS_NEXT_STAT(handle, fname, &sbuf); + ret = SMB_VFS_STAT(handle->conn, fname, &sbuf); } if (ret == -1) { @@ -595,8 +600,8 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, memcpy(ea.value.data + offset, data, n); - ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, sio->xattr_name, - ea.value.data, ea.value.length, 0); + ret = SMB_VFS_FSETXATTR(fsp->base_fsp, sio->xattr_name, + ea.value.data, ea.value.length, 0); TALLOC_FREE(ea.value.data); -- cgit From a39771d3d20280b289478da758089a1035415d65 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 13:51:52 +0100 Subject: For pread/pwrite we need to do the setxattr on base_fsp (This used to be commit d481dddc81699aba79e48bca79bfb10e586b5cbb) --- source3/modules/vfs_streams_xattr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 104ed638db..7d7ec02fe7 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -576,8 +576,8 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } - status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base, - sio->xattr_name, &ea); + status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp, + sio->base, sio->xattr_name, &ea); if (!NT_STATUS_IS_OK(status)) { return -1; } @@ -622,8 +622,8 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle, return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset); } - status = get_ea_value(talloc_tos(), handle->conn, fsp, sio->base, - sio->xattr_name, &ea); + status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp, + sio->base, sio->xattr_name, &ea); if (!NT_STATUS_IS_OK(status)) { return -1; } -- cgit From 4222fa62e927500f21f386ac57dd599234f7d8b1 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 13:55:27 +0100 Subject: Add some DEBUG (This used to be commit 8db25aba63b1dffb0dfbc74012c7ebd0ce4d5682) --- source3/modules/vfs_streams_xattr.c | 12 ++++++++++++ source3/modules/vfs_xattr_tdb.c | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 7d7ec02fe7..e304810a02 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -92,6 +92,8 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, struct stream_io *io = (struct stream_io *) VFS_FETCH_FSP_EXTENSION(handle, fsp); + DEBUG(10, ("streams_xattr_fstat called for %d\n", fsp->fh->fd)); + if (io == NULL) { return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf); } @@ -105,6 +107,8 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, return -1; } + DEBUG(10, ("sbuf->st_size = %d\n", (int)sbuf->st_size)); + sbuf->st_ino = stream_inode(sbuf, io->xattr_name); sbuf->st_mode &= ~S_IFMT; sbuf->st_mode |= S_IFREG; @@ -219,6 +223,8 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, int baseflags; int hostfd = -1; + DEBUG(10, ("streams_xattr_open called for %s\n", fname)); + if (!is_ntfs_stream_name(fname)) { return SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode); } @@ -267,6 +273,8 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, status = get_ea_value(talloc_tos(), handle->conn, fsp, base, xattr_name, &ea); + DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status))); + if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { /* @@ -274,6 +282,8 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, * O_CREAT, the higher levels should have created the base * file for us. */ + DEBUG(10, ("streams_xattr_open: base file %s not around, " + "returning ENOENT\n", base)); errno = ENOENT; goto fail; } @@ -572,6 +582,8 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, NTSTATUS status; int ret; + DEBUG(10, ("streams_xattr_pwrite called for %d bytes\n", (int)n)); + if (sio == NULL) { return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset); } diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 7416fa785a..208066bedc 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -165,6 +165,9 @@ static ssize_t xattr_tdb_getattr(struct db_context *db_ctx, ssize_t result = -1; NTSTATUS status; + DEBUG(10, ("xattr_tdb_getattr called for file %s, name %s\n", + file_id_string_tos(id), name)); + status = xattr_tdb_load_attrs(talloc_tos(), db_ctx, id, &attribs); if (!NT_STATUS_IS_OK(status)) { @@ -250,6 +253,9 @@ static int xattr_tdb_setattr(struct db_context *db_ctx, struct tdb_xattrs *attribs; uint32_t i; + DEBUG(10, ("xattr_tdb_setattr called for file %s, name %s\n", + file_id_string_tos(id), name)); + rec = xattr_tdb_lock_attrs(talloc_tos(), db_ctx, id); if (rec == NULL) { -- cgit From 6fcbb1111d06cd158cc6f1178418fe7299830197 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 14:05:36 +0100 Subject: In streams_xattr_pwrite, base_fsp does not have an fd These bugs haven't shown up when I did my tests with real xattrs, not with the xattr_tdb backend. It worked because the stream fsp does has the base file as fd. (This used to be commit b7022f8f7bf83c9c5e73e98d1477b7da766e8c5f) --- source3/modules/vfs_streams_xattr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index e304810a02..4fc25f0e83 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -612,7 +612,8 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, memcpy(ea.value.data + offset, data, n); - ret = SMB_VFS_FSETXATTR(fsp->base_fsp, sio->xattr_name, + ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name, + sio->xattr_name, ea.value.data, ea.value.length, 0); TALLOC_FREE(ea.value.data); -- cgit From fe57c149f0916e895055e2a9faf5eac8724912fb Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 14:09:08 +0100 Subject: Do not use an unfinished fsp in streams_xattr_open (This used to be commit 023b313d0d4ed3beb8d77177bc8141cadeb86658) --- source3/modules/vfs_streams_xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 4fc25f0e83..d0112a5d74 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -270,7 +270,7 @@ static int streams_xattr_open(vfs_handle_struct *handle, const char *fname, goto fail; } - status = get_ea_value(talloc_tos(), handle->conn, fsp, base, + status = get_ea_value(talloc_tos(), handle->conn, NULL, base, xattr_name, &ea); DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status))); -- cgit From f87d08f6222f3e86b771c9c8ef669c1872118f6b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 14:43:30 +0100 Subject: Don't test split_ntfs_stream_name This is a hot code path, and if it has a :, the name will be split later on anyway. (This used to be commit 9f7f6b812d89decea1456ccdc37978e645d11a63) --- source3/smbd/reply.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 61ec611b6b..5a5eb1e190 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -168,9 +168,6 @@ static NTSTATUS check_path_syntax_internal(char *path, *d = '\0'; - if (NT_STATUS_IS_OK(ret) && !posix_path) { - ret = split_ntfs_stream_name(NULL, path, NULL, NULL); - } return ret; } -- cgit From 896ec681816b38d85e3dfbb45e9df8993de42899 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 14:44:07 +0100 Subject: NT_STATUS_OBJECT_NAME_NOT_FOUND also means "no streams around :-)" (This used to be commit 96b9a7b3eb92c9f133a3f43ffc4d57d0212e4ebd) --- source3/smbd/open.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ad221c3227..f55728665f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2464,7 +2464,8 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn, status = SMB_VFS_STREAMINFO(conn, NULL, fname, talloc_tos(), &num_streams, &stream_info); - if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED) + || NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) { DEBUG(10, ("no streams around\n")); TALLOC_FREE(frame); return NT_STATUS_OK; -- cgit From bf7f13c9a7aebd228d9ba4d45a69809b7a1a8d99 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 15:09:53 +0100 Subject: Fix valgrind errors (This used to be commit d7e6ec2258350c564053371361c8f1d7d0f775b1) --- source3/modules/vfs_streams_xattr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index d0112a5d74..87bcf22fb3 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -121,7 +121,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname, SMB_STRUCT_STAT *sbuf) { NTSTATUS status; - char *base, *sname; + char *base = NULL, *sname = NULL; int result = -1; char *xattr_name; @@ -132,7 +132,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle, const char *fname, status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname); if (!NT_STATUS_IS_OK(status)) { errno = EINVAL; - goto fail; + return -1; } if (SMB_VFS_STAT(handle->conn, base, sbuf) == -1) { -- cgit From 152c720ddbff3566d64d7e09561354820ff840c9 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 14:10:51 +0100 Subject: Active RAW-STREAMS in make test (This used to be commit 63ee2ef775b48fcaecccf4dc7ef3601ceb8053c5) --- source3/script/tests/selftest.sh | 2 +- source3/script/tests/test_posix_s3.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 5a170b2117..c6232cf301 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -186,7 +186,7 @@ cat >$SERVERCONFFILE<