From 34a92c6285513acff08c7c9ad67474243559fd2f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 30 Jan 2008 11:11:27 +0100 Subject: Re-enable async I/O for non-TSM systems The logic was wrong: A "SMB_VFS_AIO_FORCE()==False" disabled async I/O, whereas a "SMB_VFS_AIO_FORCE()==True" should enforce it regardless of other settings. Alexander, please check! (This used to be commit 46882ad9927c95caadeb7fb03c1d7491bbe1fb22) --- source3/smbd/aio.c | 6 ++++-- source3/smbd/reply.c | 11 ++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 9c25f69c97..86fdfe31b7 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -202,7 +202,8 @@ bool schedule_aio_read_and_X(connection_struct *conn, size_t bufsize; size_t min_aio_read_size = lp_aio_read_size(SNUM(conn)); - if (!min_aio_read_size || (smb_maxcnt < min_aio_read_size)) { + if ((!min_aio_read_size || (smb_maxcnt < min_aio_read_size)) + && !SMB_VFS_AIO_FORCE(fsp)) { /* Too small a read for aio request. */ DEBUG(10,("schedule_aio_read_and_X: read size (%u) too small " "for minimum aio_read of %u\n", @@ -284,7 +285,8 @@ bool schedule_aio_write_and_X(connection_struct *conn, bool write_through = BITSETW(req->inbuf+smb_vwv7,0); size_t min_aio_write_size = lp_aio_write_size(SNUM(conn)); - if (!min_aio_write_size || (numtowrite < min_aio_write_size)) { + if ((!min_aio_write_size || (numtowrite < min_aio_write_size)) + && !SMB_VFS_AIO_FORCE(fsp)) { /* Too small a write for aio request. */ DEBUG(10,("schedule_aio_write_and_X: write size (%u) too " "small for minimum aio_write of %u\n", diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 4ea81a3819..18376031ec 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3338,11 +3338,7 @@ void reply_read_and_X(struct smb_request *req) return; } - /* 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 && + if (!big_readX && schedule_aio_read_and_X(conn, req, fsp, startpos, smb_maxcnt)) { END_PROFILE(SMBreadX); return; @@ -4012,10 +4008,7 @@ void reply_write_and_X(struct smb_request *req) nwritten = 0; } else { - /* 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) && + if ((req->unread_bytes == 0) && schedule_aio_write_and_X(conn, req, fsp, data, startpos, numtowrite)) { END_PROFILE(SMBwriteX); -- cgit From 3850c2f451ea43f65c040f4e107f400005272206 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:48:20 +0100 Subject: Fix build warning. Guenther (This used to be commit a3417be934e34af2525ddb731af288034d51432b) --- source3/nsswitch/libwbclient/wbclient.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source3/nsswitch/libwbclient/wbclient.c b/source3/nsswitch/libwbclient/wbclient.c index 304e49cf55..2f76f76635 100644 --- a/source3/nsswitch/libwbclient/wbclient.c +++ b/source3/nsswitch/libwbclient/wbclient.c @@ -78,7 +78,6 @@ wbcErr wbcRequestResponse(int cmd, break; } -done: return wbc_status; } -- cgit From a626fa59cc1df3e154c062c433f3c1e1d6f87029 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Mon, 28 Jan 2008 11:28:38 +0100 Subject: ntlm_auth: Add a blackbox test. (This used to be commit f02b74fc067074d8e48e186a7b7255a244592f7d) --- source3/script/tests/test_ntlm_auth_s3.sh | 21 +++ source3/script/tests/tests_all.sh | 1 + source3/torture/test_ntlm_auth.py | 212 ++++++++++++++++++++++++++++++ 3 files changed, 234 insertions(+) create mode 100755 source3/script/tests/test_ntlm_auth_s3.sh create mode 100755 source3/torture/test_ntlm_auth.py diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh new file mode 100755 index 0000000000..8568da97e4 --- /dev/null +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +incdir=`dirname $0` +. $incdir/test_functions.sh + +failed=0 + +(/usr/bin/env python --version > /dev/null 2&>1) + +if $? -ne 0: +then + echo "Python binary not found in path. Skipping ntlm_auth tests." + exit 0 +fi + +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth || failed=`expr $failed + 1` +# This should work even with NTLMv2 +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` + + +testok $0 $failed diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 259e28e6e7..369cf3ebe3 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -6,6 +6,7 @@ $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP || failed=`expr $failed + $?` echo "Testing encrypted" $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" || failed=`expr $failed + $?` $SCRIPTDIR/test_wbinfo_s3.sh $WORKGROUP $SERVER $USERNAME $PASSWORD || failed=`expr $failed + $?` +$SCRIPTDIR/test_ntlm_auth_s3.sh || failed=`expr $failed + $?` eval "$LIB_PATH_VAR="\$SAMBA4SHAREDDIR:\$$LIB_PATH_VAR"; export $LIB_PATH_VAR" eval echo "$LIB_PATH_VAR=\$$LIB_PATH_VAR" diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py new file mode 100755 index 0000000000..3e7cc0551f --- /dev/null +++ b/source3/torture/test_ntlm_auth.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python + +# Unix SMB/CIFS implementation. +# A test for the ntlm_auth tool +# 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 . +# +"""Test ntlm_auth +This test program will start ntlm_auth with the given command line switches and +see if it will get the expected results. +""" + +import os +import sys +from optparse import OptionParser + +class ReadChildError(Exception): + pass + +class WriteChildError(Exception): + pass + +def readLine(pipe): + """readLine(pipe) -> str + Read a line from the child's pipe, returns the string read. + Throws ReadChildError if the read fails. + """ + buf = os.read(pipe, 2047) + newline = buf.find('\n') + if newline == -1: + raise ReadChildError() + return buf[:newline] + +def writeLine(pipe, buf): + """writeLine(pipe, buf) -> nul + Write a line to the child's pipe. + Raises WriteChildError if the write fails. + """ + written = os.write(pipe, buf) + if written != len(buf): + raise WriteChildError() + os.write(pipe, "\n") + +def parseCommandLine(): + """parseCommandLine() -> (opts, ntlm_auth_path) + Parse the command line. + Return a tuple consisting of the options and the path to ntlm_auth. + """ + usage = "usage: %prog [options] path/to/ntlm_auth" + parser = OptionParser(usage) + + parser.set_defaults(client_username="foo") + parser.set_defaults(client_password="secret") + parser.set_defaults(client_domain="FOO") + parser.set_defaults(client_helper="ntlmssp-client-1") + + parser.set_defaults(server_username="foo") + parser.set_defaults(server_password="secret") + parser.set_defaults(server_domain="FOO") + parser.set_defaults(server_helper="squid-2.5-ntlmssp") + + parser.add_option("--client-username", dest="client_username",\ + help="User name for the client. [default: foo]") + parser.add_option("--client-password", dest="client_password",\ + help="Password the client will send. [default: secret]") + parser.add_option("--client-domain", dest="client_domain",\ + help="Domain the client authenticates for. [default: FOO]") + parser.add_option("--client-helper", dest="client_helper",\ + help="Helper mode for the ntlm_auth client. [default: ntlmssp-client-1]") + + parser.add_option("--server-username", dest="server_username",\ + help="User name server uses for local auth. [default: foo]") + parser.add_option("--server-password", dest="server_password",\ + help="Password server uses for local auth. [default: secret]") + parser.add_option("--server-domain", dest="server_domain",\ + help="Domain server uses for local auth. [default: FOO]") + parser.add_option("--server-helper", dest="server_helper",\ + help="Helper mode for the ntlm_auth server. [default: squid-2.5-server]") + + (opts, args) = parser.parse_args() + if len(args) != 1: + parser.error("Invalid number of arguments.") + + if not os.access(args[0], os.X_OK): + parser.error("%s is not executable." % args[0]) + + return (opts, args[0]) + + +def main(): + """main() -> int + Run the test. + Returns 0 if test succeeded, <>0 otherwise. + """ + (opts, ntlm_auth_path) = parseCommandLine() + + (client_in_r, client_in_w) = os.pipe() + (client_out_r, client_out_w) = os.pipe() + + client_pid = os.fork() + + if not client_pid: + # We're in the client child + os.close(0) + os.close(1) + + os.dup2(client_out_r, 0) + os.close(client_out_r) + os.close(client_out_w) + + os.dup2(client_in_w, 1) + os.close(client_in_r) + os.close(client_in_w) + + client_args = [] + client_args.append("--helper-protocol=%s" % opts.client_helper) + client_args.append("--username=%s" % opts.client_username) + client_args.append("--password=%s" % opts.client_password) + client_args.append("--domain=%s" % opts.client_domain) + + os.execv(ntlm_auth_path, client_args) + + client_in = client_in_r + os.close(client_in_w) + + client_out = client_out_w + os.close(client_out_r) + + (server_in_r, server_in_w) = os.pipe() + (server_out_r, server_out_w) = os.pipe() + + server_pid = os.fork() + + if not server_pid: + # We're in the server child + os.close(0) + os.close(1) + + os.dup2(server_out_r, 0) + os.close(server_out_r) + os.close(server_out_w) + + os.dup2(server_in_w, 1) + os.close(server_in_r) + os.close(server_in_w) + + server_args = [] + server_args.append("--helper-protocol=%s" % opts.server_helper) + server_args.append("--username=%s" % opts.server_username) + server_args.append("--password=%s" % opts.server_password) + server_args.append("--domain=%s" % opts.server_domain) + + os.execv(ntlm_auth_path, server_args) + + server_in = server_in_r + os.close(server_in_w) + + server_out = server_out_w + os.close(server_out_r) + + # We're in the parent + writeLine(client_out, "YR") + buf = readLine(client_in) + + if buf.count("YR ", 0, 3) != 1: + sys.exit(1) + + writeLine(server_out, buf) + buf = readLine(server_in) + + if buf.count("TT ", 0, 3) != 1: + sys.exit(2) + + writeLine(client_out, buf) + buf = readLine(client_in) + + if buf.count("AF ", 0, 3) != 1: + sys.exit(3) + + # Client sends 'AF ' but server expects 'KK ' + buf = buf.replace("AF", "KK", 1) + + writeLine(server_out, buf) + buf = readLine(server_in) + + if buf.count("AF ", 0, 3) != 1: + sys.exit(4) + + os.close(server_in) + os.close(server_out) + os.close(client_in) + os.close(client_out) + os.waitpid(server_pid, 0) + os.waitpid(client_pid, 0) + sys.exit(0) + +if __name__ == "__main__": + main() + + -- cgit From 582e224af5e55909e4dfd4051f2e5b5011ec14e1 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 30 Jan 2008 16:59:40 +0100 Subject: ntlm_auth: Fix typos in the torture test script. This should fix the build farm. Sorry, wonder why it worked on my box before. (This used to be commit bfa919cde57a26cd2ae7397281923792b7afe83a) --- source3/script/tests/test_ntlm_auth_s3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh index 8568da97e4..6a52e59771 100755 --- a/source3/script/tests/test_ntlm_auth_s3.sh +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -5,9 +5,9 @@ incdir=`dirname $0` failed=0 -(/usr/bin/env python --version > /dev/null 2&>1) +(/usr/bin/env python --version > /dev/null 2>&1) -if $? -ne 0: +if test $? -ne 0; then echo "Python binary not found in path. Skipping ntlm_auth tests." exit 0 -- cgit From 5b5d56d84af1657b1aec29c134af5ad6be4348eb Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 30 Jan 2008 17:57:32 +0100 Subject: ntlm_auth: test should honour configfile option to run on build farm. (This used to be commit 11c9c1536b153047ba387b9804f34a6555a5ae26) --- source3/script/tests/test_ntlm_auth_s3.sh | 4 ++-- source3/torture/test_ntlm_auth.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh index 6a52e59771..6bcb3e2066 100755 --- a/source3/script/tests/test_ntlm_auth_s3.sh +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -13,9 +13,9 @@ then exit 0 fi -testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth || failed=`expr $failed + 1` +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile $CONFFILE || failed=`expr $failed + 1` # This should work even with NTLMv2 -testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile $CONFFILE --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` testok $0 $failed diff --git a/source3/torture/test_ntlm_auth.py b/source3/torture/test_ntlm_auth.py index 3e7cc0551f..12a4dae398 100755 --- a/source3/torture/test_ntlm_auth.py +++ b/source3/torture/test_ntlm_auth.py @@ -70,6 +70,7 @@ def parseCommandLine(): parser.set_defaults(server_password="secret") parser.set_defaults(server_domain="FOO") parser.set_defaults(server_helper="squid-2.5-ntlmssp") + parser.set_defaults(config_file="/etc/samba/smb.conf") parser.add_option("--client-username", dest="client_username",\ help="User name for the client. [default: foo]") @@ -89,6 +90,9 @@ def parseCommandLine(): parser.add_option("--server-helper", dest="server_helper",\ help="Helper mode for the ntlm_auth server. [default: squid-2.5-server]") + parser.add_option("-s", "--configfile", dest="config_file",\ + help="Path to smb.conf file. [default:/etc/samba/smb.conf") + (opts, args) = parser.parse_args() if len(args) != 1: parser.error("Invalid number of arguments.") @@ -129,6 +133,7 @@ def main(): client_args.append("--username=%s" % opts.client_username) client_args.append("--password=%s" % opts.client_password) client_args.append("--domain=%s" % opts.client_domain) + client_args.append("--configfile=%s" % opts.config_file) os.execv(ntlm_auth_path, client_args) @@ -161,6 +166,7 @@ def main(): server_args.append("--username=%s" % opts.server_username) server_args.append("--password=%s" % opts.server_password) server_args.append("--domain=%s" % opts.server_domain) + server_args.append("--configfile=%s" % opts.config_file) os.execv(ntlm_auth_path, server_args) -- cgit From afaacdeb8d98420fafd6c2ae428e404e60b239f2 Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Wed, 30 Jan 2008 18:34:24 +0100 Subject: ntlm_auth: Fix another typo in the test. This _should_ be the last one. (This used to be commit d12c49e60f4390707c924b9e9f12fa9333b006e2) --- source3/script/tests/test_ntlm_auth_s3.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh index 6bcb3e2066..6c97f2e650 100755 --- a/source3/script/tests/test_ntlm_auth_s3.sh +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -13,9 +13,9 @@ then exit 0 fi -testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile $CONFFILE || failed=`expr $failed + 1` +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile=$CONFFILE || failed=`expr $failed + 1` # This should work even with NTLMv2 -testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile $CONFFILE --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` +testit "ntlm_auth" $VALGRIND $SRCDIR/torture/test_ntlm_auth.py $BINDIR/ntlm_auth --configfile=$CONFFILE --client-domain=fOo --server-domain=fOo || failed=`expr $failed + 1` testok $0 $failed -- cgit From 8daaa5d99bfd848c76f98de952289a26f93cca3c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 30 Jan 2008 19:56:05 +0100 Subject: Fix some IBM checker warnings (This used to be commit 0341b0be49fef5e6003a170100388b5c47a41e67) --- source3/torture/cmd_vfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index f3b98862fe..82a28bd868 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -575,7 +575,7 @@ static NTSTATUS cmd_fstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, } fd = atoi(argv[1]); - if (fd < 0 || fd > 1024) { + if (fd < 0 || fd >= 1024) { printf("fstat: error=%d (file descriptor out of range)\n", EBADF); return NT_STATUS_OK; } @@ -710,7 +710,7 @@ static NTSTATUS cmd_fchmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, fd = atoi(argv[1]); mode = atoi(argv[2]); - if (fd < 0 || fd > 1024) { + if (fd < 0 || fd >= 1024) { printf("fchmod: error=%d (file descriptor out of range)\n", EBADF); return NT_STATUS_OK; } @@ -763,7 +763,7 @@ static NTSTATUS cmd_fchown(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, uid = atoi(argv[2]); gid = atoi(argv[3]); fd = atoi(argv[1]); - if (fd < 0 || fd > 1024) { + if (fd < 0 || fd >= 1024) { printf("fchown: faliure=%d (file descriptor out of range)\n", EBADF); return NT_STATUS_OK; } @@ -822,7 +822,7 @@ static NTSTATUS cmd_ftruncate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int ar fd = atoi(argv[1]); off = atoi(argv[2]); - if (fd < 0 || fd > 1024) { + if (fd < 0 || fd >= 1024) { printf("ftruncate: error=%d (file descriptor out of range)\n", EBADF); return NT_STATUS_OK; } -- cgit From 6b5980e47e86df77e43324e705d8509dea4ac0d4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 31 Jan 2008 09:48:20 +1100 Subject: merged tdb transaction fix (This used to be commit 1a1c7954368a7f168a57f86f4f857cf70258e37a) --- source3/lib/tdb/common/transaction.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/lib/tdb/common/transaction.c b/source3/lib/tdb/common/transaction.c index c3e7a4e2c0..4e2127be64 100644 --- a/source3/lib/tdb/common/transaction.c +++ b/source3/lib/tdb/common/transaction.c @@ -321,6 +321,9 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, if (blk == tdb->transaction->num_blocks-1 && off + len > tdb->transaction->last_block_size) { + if (off >= tdb->transaction->last_block_size) { + return 0; + } len = tdb->transaction->last_block_size - off; } -- cgit From a8209904a5fc9766acbf894353612f8b028ff17f Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Thu, 31 Jan 2008 09:42:03 +0100 Subject: ntlm_auth: Parse configfile after parsing it's location, not before. (This used to be commit cf671ca35bff09af56c67e789a86a3b86093b5fb) --- source3/utils/ntlm_auth.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 3e2093a194..a3a403d7bd 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -2322,7 +2322,8 @@ enum { { "use-cached-creds", 0, POPT_ARG_NONE, &use_cached_creds, OPT_USE_CACHED_CREDS, "Use cached credentials if no password is given"}, { "diagnostics", 0, POPT_ARG_NONE, &diagnostics, OPT_DIAGNOSTICS, "Perform diagnostics on the authentictaion chain"}, { "require-membership-of", 0, POPT_ARG_STRING, &require_membership_of, OPT_REQUIRE_MEMBERSHIP, "Require that a user be a member of this group (either name or SID) for authentication to succeed" }, - POPT_COMMON_SAMBA + POPT_COMMON_CONFIGFILE + POPT_COMMON_VERSION POPT_TABLEEND }; @@ -2330,14 +2331,6 @@ enum { load_case_tables(); dbf = x_stderr; - - /* Samba client initialisation */ - - if (!lp_load(get_dyn_CONFIGFILE(), True, False, False, True)) { - d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n", - get_dyn_CONFIGFILE(), strerror(errno)); - exit(1); - } /* Parse options */ @@ -2350,6 +2343,18 @@ enum { return 1; } + while((opt = poptGetNextOpt(pc)) != -1) { + /* Get generic config options like --configfile */ + } + + poptFreeContext(pc); + + if (!lp_load(get_dyn_CONFIGFILE(), True, False, False, True)) { + d_fprintf(stderr, "ntlm_auth: error opening config file %s. Error was %s\n", + get_dyn_CONFIGFILE(), strerror(errno)); + exit(1); + } + pc = poptGetContext(NULL, argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); -- cgit From 43ac44e3cff5ee7a7542214a678ddcb80a3195ca Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 31 Jan 2008 01:53:26 +0100 Subject: Fix netlogon IDL for netr_GetDcName that returns WERROR. (didn't we fix this a couple of times already?) Guenther (This used to be commit 9ca1505d44e2c4459487c8e2f943a861e2dffb1e) --- source3/librpc/idl/netlogon.idl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source3/librpc/idl/netlogon.idl b/source3/librpc/idl/netlogon.idl index 30b1119067..4eb1bff94f 100644 --- a/source3/librpc/idl/netlogon.idl +++ b/source3/librpc/idl/netlogon.idl @@ -758,7 +758,7 @@ interface netlogon /*****************/ /* 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 -- cgit From 6c764172e541decc0fa4b0314f4d26ea859c0dfe Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 31 Jan 2008 01:50:49 +0100 Subject: When running with debug level > 10, dump ads_struct in ads_connect(). Guenther (This used to be commit 2dd7c64fa8845fe502789068b877f5eaf060afc7) --- source3/libads/ldap.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 28bc7793d7..7b0adc2fc3 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -391,6 +391,13 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) /* try with a user specified server */ + if (DEBUGLEVEL >= 11) { + char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads); + DEBUG(11,("ads_connect: entering\n")); + DEBUGADD(11,("%s\n", s)); + TALLOC_FREE(s); + } + if (ads->server.ldap_server && ads_try_connect(ads, ads->server.ldap_server)) { goto got_connection; @@ -401,7 +408,8 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads) goto got_connection; } - return ADS_ERROR_NT(ntstatus); + status = ADS_ERROR_NT(ntstatus); + goto out; got_connection: @@ -438,12 +446,14 @@ got_connection: /* If the caller() requested no LDAP bind, then we are done */ if (ads->auth.flags & ADS_AUTH_NO_BIND) { - return ADS_SUCCESS; + status = ADS_SUCCESS; + goto out; } ads->ldap.mem_ctx = talloc_init("ads LDAP connection memory"); if (!ads->ldap.mem_ctx) { - return ADS_ERROR_NT(NT_STATUS_NO_MEMORY); + status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY); + goto out; } /* Otherwise setup the TCP LDAP session */ @@ -451,7 +461,8 @@ got_connection: ads->ldap.ld = ldap_open_with_timeout(ads->config.ldap_server_name, LDAP_PORT, lp_ldap_timeout()); if (ads->ldap.ld == NULL) { - return ADS_ERROR(LDAP_OPERATIONS_ERROR); + status = ADS_ERROR(LDAP_OPERATIONS_ERROR); + goto out; } DEBUG(3,("Connected to LDAP server %s\n", ads->config.ldap_server_name)); @@ -466,27 +477,40 @@ got_connection: status = ADS_ERROR(smb_ldap_start_tls(ads->ldap.ld, version)); if (!ADS_ERR_OK(status)) { - return status; + goto out; } /* fill in the current time and offsets */ status = ads_current_time( ads ); if ( !ADS_ERR_OK(status) ) { - return status; + goto out; } /* Now do the bind */ if (ads->auth.flags & ADS_AUTH_ANON_BIND) { - return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, NULL, NULL)); + status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, NULL, NULL)); + goto out; } if (ads->auth.flags & ADS_AUTH_SIMPLE_BIND) { - return ADS_ERROR(ldap_simple_bind_s( ads->ldap.ld, ads->auth.user_name, ads->auth.password)); + status = ADS_ERROR(ldap_simple_bind_s(ads->ldap.ld, ads->auth.user_name, ads->auth.password)); + goto out; + } + + status = ads_sasl_bind(ads); + + out: + if (DEBUGLEVEL >= 11) { + char *s = NDR_PRINT_STRUCT_STRING(talloc_tos(), ads_struct, ads); + DEBUG(11,("ads_connect: leaving with: %s\n", + ads_errstr(status))); + DEBUGADD(11,("%s\n", s)); + TALLOC_FREE(s); } - return ads_sasl_bind(ads); + return status; } /** -- cgit From 5334b364c21599fe055b32bbbd1e8cf7488b1fa7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:39:20 +0100 Subject: Remove rpccli_samr_close and use pidl generated function instead. Guenther (This used to be commit 64f0889401855ab76953bfae5db4fe4df19ad8a5) --- source3/libnet/libnet_join.c | 12 ++-- source3/rpc_client/cli_samr.c | 38 ------------ source3/rpcclient/cmd_samr.c | 134 ++++++++++++++++++++-------------------- source3/utils/net_domain.c | 12 ++-- source3/utils/net_rpc.c | 34 +++++----- source3/utils/net_rpc_join.c | 4 +- source3/utils/net_rpc_sh_acct.c | 4 +- source3/winbindd/winbindd_pam.c | 6 +- source3/winbindd/winbindd_rpc.c | 6 +- 9 files changed, 107 insertions(+), 143 deletions(-) diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index 3c6cea31bb..c34afc7cae 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -704,7 +704,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, } if (NT_STATUS_IS_OK(status)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); } } @@ -769,7 +769,7 @@ static NTSTATUS libnet_join_joindomain_rpc(TALLOC_CTX *mem_ctx, goto done; } - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); cli_rpc_pipe_close(pipe_hnd); status = NT_STATUS_OK; @@ -877,7 +877,7 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol, 16, &qctr); if (!NT_STATUS_IS_OK(status)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); goto done; } @@ -890,12 +890,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx, status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, &cli->user_session_key, &ctr); - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); done: if (pipe_hnd) { - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); - rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol); cli_rpc_pipe_close(pipe_hnd); } diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index a752717e8c..2fb3768866 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -95,44 +95,6 @@ NTSTATUS rpccli_samr_connect4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, return result; } -/* Close SAMR handle */ - -NTSTATUS rpccli_samr_close(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - POLICY_HND *connect_pol) -{ - prs_struct qbuf, rbuf; - SAMR_Q_CLOSE_HND q; - SAMR_R_CLOSE_HND r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_close\n")); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - /* Marshall data and send request */ - - init_samr_q_close_hnd(&q, connect_pol); - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_CLOSE_HND, - q, r, - qbuf, rbuf, - samr_io_q_close_hnd, - samr_io_r_close_hnd, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - if (NT_STATUS_IS_OK(result = r.status)) { -#ifdef __INSURE__ - SAFE_FREE(connect_pol->marker); -#endif - *connect_pol = r.pol; - } - - return result; -} - /* Open handle on a domain */ NTSTATUS rpccli_samr_open_domain(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index ae22a68deb..11d9c983df 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -435,9 +435,9 @@ static NTSTATUS cmd_samr_query_user(struct rpc_pipe_client *cli, break; } - rpccli_samr_close(cli, mem_ctx, &user_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; @@ -589,9 +589,9 @@ static NTSTATUS cmd_samr_query_group(struct rpc_pipe_client *cli, display_group_info_ctr(group_ctr); - rpccli_samr_close(cli, mem_ctx, &group_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &group_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -657,9 +657,9 @@ static NTSTATUS cmd_samr_query_usergroups(struct rpc_pipe_client *cli, user_gids[i].g_rid, user_gids[i].attr); } - rpccli_samr_close(cli, mem_ctx, &user_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -750,8 +750,8 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli, printf("\tgroup rid:[0x%x]\n", alias_rids[i]); } - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -820,9 +820,9 @@ static NTSTATUS cmd_samr_query_groupmem(struct rpc_pipe_client *cli, group_attrs[i]); } - rpccli_samr_close(cli, mem_ctx, &group_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &group_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -896,10 +896,10 @@ static NTSTATUS cmd_samr_enum_dom_users(struct rpc_pipe_client *cli, done: if (got_domain_pol) - rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (got_connect_pol) - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); return result; } @@ -969,10 +969,10 @@ static NTSTATUS cmd_samr_enum_dom_groups(struct rpc_pipe_client *cli, done: if (got_domain_pol) - rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (got_connect_pol) - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); return result; } @@ -1048,10 +1048,10 @@ static NTSTATUS cmd_samr_enum_als_groups(struct rpc_pipe_client *cli, done: if (got_domain_pol) - rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (got_connect_pol) - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); return result; } @@ -1123,9 +1123,9 @@ static NTSTATUS cmd_samr_query_aliasmem(struct rpc_pipe_client *cli, printf("\tsid:[%s]\n", sid_str); } - rpccli_samr_close(cli, mem_ctx, &alias_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &alias_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -1200,8 +1200,8 @@ static NTSTATUS cmd_samr_delete_alias(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -1336,8 +1336,8 @@ static NTSTATUS cmd_samr_query_dispinfo(struct rpc_pipe_client *cli, } } while ( NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -1434,9 +1434,9 @@ static NTSTATUS cmd_samr_query_dominfo(struct rpc_pipe_client *cli, } done: - - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); return result; } @@ -1496,13 +1496,13 @@ static NTSTATUS cmd_samr_create_dom_user(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &user_pol); + result = rpccli_samr_Close(cli, mem_ctx, &user_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &domain_pol); + result = rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = rpccli_samr_Close(cli, mem_ctx, &connect_pol); if (!NT_STATUS_IS_OK(result)) goto done; done: @@ -1556,13 +1556,13 @@ static NTSTATUS cmd_samr_create_dom_group(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &group_pol); + result = rpccli_samr_Close(cli, mem_ctx, &group_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &domain_pol); + result = rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = rpccli_samr_Close(cli, mem_ctx, &connect_pol); if (!NT_STATUS_IS_OK(result)) goto done; done: @@ -1615,13 +1615,13 @@ static NTSTATUS cmd_samr_create_dom_alias(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &alias_pol); + result = rpccli_samr_Close(cli, mem_ctx, &alias_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &domain_pol); + result = rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = rpccli_samr_Close(cli, mem_ctx, &connect_pol); if (!NT_STATUS_IS_OK(result)) goto done; done: @@ -1675,8 +1675,8 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli, num_names = argc - 2; if ((names = TALLOC_ARRAY(mem_ctx, const char *, num_names)) == NULL) { - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); result = NT_STATUS_NO_MEMORY; goto done; } @@ -1697,8 +1697,8 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli, printf("name %s: 0x%x (%d)\n", names[i], rids[i], name_types[i]); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -1747,8 +1747,8 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli, num_rids = argc - 2; if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) { - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); result = NT_STATUS_NO_MEMORY; goto done; } @@ -1768,8 +1768,8 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli, for (i = 0; i < num_names; i++) printf("rid 0x%x: %s (%d)\n", rids[i], names[i], name_types[i]); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -1838,9 +1838,9 @@ static NTSTATUS cmd_samr_delete_dom_group(struct rpc_pipe_client *cli, /* Display results */ - rpccli_samr_close(cli, mem_ctx, &group_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &group_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; @@ -1910,9 +1910,9 @@ static NTSTATUS cmd_samr_delete_dom_user(struct rpc_pipe_client *cli, /* Display results */ - rpccli_samr_close(cli, mem_ctx, &user_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; @@ -1998,9 +1998,9 @@ static NTSTATUS cmd_samr_query_sec_obj(struct rpc_pipe_client *cli, display_sec_desc(sec_desc_buf->sd); - rpccli_samr_close(cli, mem_ctx, &user_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: talloc_destroy(ctx); return result; @@ -2047,13 +2047,15 @@ static NTSTATUS cmd_samr_get_usrdom_pwinfo(struct rpc_pipe_client *cli, result = rpccli_samr_GetUserPwInfo(cli, mem_ctx, &user_pol, &info); if (NT_STATUS_IS_OK(result)) { printf("min_password_length: %d\n", info.min_password_length); - display_password_properties(info.password_properties); + printf("%s\n", + NDR_PRINT_STRUCT_STRING(mem_ctx, + samr_PasswordProperties, &info.password_properties)); } done: - rpccli_samr_close(cli, mem_ctx, &user_pol); - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); return result; } @@ -2127,8 +2129,8 @@ static NTSTATUS cmd_samr_lookup_domain(struct rpc_pipe_client *cli, domain_name,sid_string); } - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); + rpccli_samr_Close(cli, mem_ctx, &domain_pol); + rpccli_samr_Close(cli, mem_ctx, &connect_pol); done: return result; } @@ -2176,10 +2178,10 @@ static NTSTATUS cmd_samr_chgpasswd2(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &domain_pol); + result = rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = rpccli_samr_Close(cli, mem_ctx, &connect_pol); if (!NT_STATUS_IS_OK(result)) goto done; done: @@ -2255,10 +2257,10 @@ static NTSTATUS cmd_samr_chgpasswd3(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &domain_pol); + result = rpccli_samr_Close(cli, mem_ctx, &domain_pol); if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = rpccli_samr_Close(cli, mem_ctx, &connect_pol); if (!NT_STATUS_IS_OK(result)) goto done; done: diff --git a/source3/utils/net_domain.c b/source3/utils/net_domain.c index 1c34a3b60e..b15f61bf63 100644 --- a/source3/utils/net_domain.c +++ b/source3/utils/net_domain.c @@ -108,7 +108,7 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli, status = rpccli_samr_query_userinfo(pipe_hnd, mem_ctx, &user_pol, 16, &qctr); if ( !NT_STATUS_IS_OK(status) ) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); goto done; } @@ -123,11 +123,11 @@ NTSTATUS netdom_leave_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli, status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, &cli->user_session_key, &ctr); - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); done: - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); - rpccli_samr_close(pipe_hnd, mem_ctx, &sam_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol); cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ @@ -274,7 +274,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli, /* We *must* do this.... don't ask... */ if (NT_STATUS_IS_OK(status)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); } status = rpccli_samr_lookup_names(pipe_hnd, mem_ctx, @@ -344,7 +344,7 @@ NTSTATUS netdom_join_domain( TALLOC_CTX *mem_ctx, struct cli_state *cli, return status; } - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ return status; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 46fbcfb8ca..2140829649 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1401,13 +1401,13 @@ static NTSTATUS rpc_sh_handle_user(TALLOC_CTX *mem_ctx, done: if (is_valid_policy_hnd(&user_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); } if (is_valid_policy_hnd(&domain_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); } if (is_valid_policy_hnd(&connect_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); } return result; } @@ -1824,7 +1824,7 @@ static NTSTATUS rpc_group_delete_internals(const DOM_SID *domain_sid, group_is_primary = True; } - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); } if (group_is_primary) { @@ -2131,7 +2131,7 @@ static NTSTATUS rpc_add_groupmem(struct rpc_pipe_client *pipe_hnd, result = rpccli_samr_add_groupmem(pipe_hnd, mem_ctx, &group_pol, rids[0]); done: - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); return result; } @@ -2194,7 +2194,7 @@ static NTSTATUS rpc_add_aliasmem(struct rpc_pipe_client *pipe_hnd, } done: - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); return result; } @@ -2308,7 +2308,7 @@ static NTSTATUS rpc_del_groupmem(struct rpc_pipe_client *pipe_hnd, result = rpccli_samr_del_groupmem(pipe_hnd, mem_ctx, &group_pol, rids[0]); done: - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); return result; } @@ -2368,7 +2368,7 @@ static NTSTATUS rpc_del_aliasmem(struct rpc_pipe_client *pipe_hnd, return result; done: - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); return result; } @@ -2571,7 +2571,7 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid, (NT_STATUS_IS_OK(rpccli_samr_query_alias_info(pipe_hnd, mem_ctx, &alias_pol, 3, &ctr))) && - (NT_STATUS_IS_OK(rpccli_samr_close(pipe_hnd, mem_ctx, + (NT_STATUS_IS_OK(rpccli_samr_Close(pipe_hnd, mem_ctx, &alias_pol)))) { description = unistr2_to_ascii_talloc(mem_ctx, ctr.alias.info3.description.string); @@ -2587,7 +2587,7 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid, } } } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); /* Get builtin policy handle */ result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol, @@ -2626,7 +2626,7 @@ static NTSTATUS rpc_group_list_internals(const DOM_SID *domain_sid, (NT_STATUS_IS_OK(rpccli_samr_query_alias_info(pipe_hnd, mem_ctx, &alias_pol, 3, &ctr))) && - (NT_STATUS_IS_OK(rpccli_samr_close(pipe_hnd, mem_ctx, + (NT_STATUS_IS_OK(rpccli_samr_Close(pipe_hnd, mem_ctx, &alias_pol)))) { description = unistr2_to_ascii_talloc(mem_ctx, ctr.alias.info3.description.string); @@ -2838,7 +2838,7 @@ static NTSTATUS rpc_group_members_internals(const DOM_SID *domain_sid, DOM_SID sid_Builtin; - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); string_to_sid(&sid_Builtin, "S-1-5-32"); @@ -4045,7 +4045,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd, if (!NT_STATUS_IS_OK(result)) goto done; - result = rpccli_samr_close(pipe_hnd, mem_ctx, &alias_pol); + result = rpccli_samr_Close(pipe_hnd, mem_ctx, &alias_pol); if (!NT_STATUS_IS_OK(result)) goto done; @@ -4069,7 +4069,7 @@ static NTSTATUS rpc_fetch_domain_aliases(struct rpc_pipe_client *pipe_hnd, result = NT_STATUS_OK; done: - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); return result; } @@ -4169,7 +4169,7 @@ static NTSTATUS rpc_aliaslist_internals(const DOM_SID *domain_sid, result = rpc_fetch_domain_aliases(pipe_hnd, mem_ctx, &connect_pol, domain_sid); - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); done: return result; } @@ -6286,12 +6286,12 @@ static int rpc_trustdom_list(int argc, const char **argv) } while (NT_STATUS_EQUAL(nt_status, STATUS_MORE_ENTRIES)); /* close opened samr and domain policy handles */ - nt_status = rpccli_samr_close(pipe_hnd, mem_ctx, &domain_hnd); + nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_hnd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("Couldn't properly close domain policy handle for domain %s\n", domain_name)); }; - nt_status = rpccli_samr_close(pipe_hnd, mem_ctx, &connect_hnd); + nt_status = rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_hnd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(0, ("Couldn't properly close samr policy handle for domain %s\n", domain_name)); }; diff --git a/source3/utils/net_rpc_join.c b/source3/utils/net_rpc_join.c index 271219938e..de8661b0df 100644 --- a/source3/utils/net_rpc_join.c +++ b/source3/utils/net_rpc_join.c @@ -280,7 +280,7 @@ int net_rpc_join_newstyle(int argc, const char **argv) /* We *must* do this.... don't ask... */ if (NT_STATUS_IS_OK(result)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); } CHECK_RPC_ERR_DEBUG(rpccli_samr_lookup_names(pipe_hnd, mem_ctx, @@ -353,7 +353,7 @@ int net_rpc_join_newstyle(int argc, const char **argv) result = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16, &cli->user_session_key, &ctr); - rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); cli_rpc_pipe_close(pipe_hnd); /* Done with this pipe */ /* Now check the whole process from top-to-bottom */ diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index ac0ffca1f3..f5b0c2e0d7 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -118,10 +118,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, done: if (is_valid_policy_hnd(&domain_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); } if (is_valid_policy_hnd(&connect_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); } return result; diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c index ea9a07d388..59ca15a623 100644 --- a/source3/winbindd/winbindd_pam.c +++ b/source3/winbindd/winbindd_pam.c @@ -1356,14 +1356,14 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain, if (!NT_STATUS_IS_OK(status_tmp)) { DEBUG(3, ("could not query user info on SAMR pipe: %s\n", nt_errstr(status_tmp))); - rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol); + rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol); goto done; } acct_flags = user_ctr->info.id16->acb_info; if (acct_flags == 0) { - rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol); + rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol); goto done; } @@ -1371,7 +1371,7 @@ NTSTATUS winbindd_dual_pam_auth_samlogon(struct winbindd_domain *domain, DEBUG(10,("successfully retrieved acct_flags 0x%x\n", acct_flags)); - rpccli_samr_close(samr_pipe, state->mem_ctx, &user_pol); + rpccli_samr_Close(samr_pipe, state->mem_ctx, &user_pol); } *info3 = my_info3; diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index 34ba0498e0..47a8d430b2 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -480,7 +480,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain, result = rpccli_samr_query_userinfo(cli, mem_ctx, &user_pol, 0x15, &ctr); - rpccli_samr_close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); if (!NT_STATUS_IS_OK(result)) return result; @@ -555,7 +555,7 @@ static NTSTATUS lookup_usergroups(struct winbindd_domain *domain, result = rpccli_samr_query_usergroups(cli, mem_ctx, &user_pol, num_groups, &user_groups); - rpccli_samr_close(cli, mem_ctx, &user_pol); + rpccli_samr_Close(cli, mem_ctx, &user_pol); if (!NT_STATUS_IS_OK(result) || (*num_groups) == 0) return result; @@ -721,7 +721,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, /* And restore our original timeout. */ cli_set_timeout(cli->cli, orig_timeout); - rpccli_samr_close(cli, mem_ctx, &group_pol); + rpccli_samr_Close(cli, mem_ctx, &group_pol); if (!NT_STATUS_IS_OK(result)) return result; -- cgit From 3d507a2fcab9da3d9ba928fbe1d30f2642ab4e93 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:53:09 +0100 Subject: Let _samr_Close() use pidl generated server code. Guenther (This used to be commit 2df3408079fc382d00d01a0b82b0b8e1ffeba6e4) --- source3/Makefile.in | 3 +- source3/configure.in | 4 +- source3/rpc_server/srv_pipe.c | 2 +- source3/rpc_server/srv_samr.c | 40 +-- source3/rpc_server/srv_samr_nt.c | 686 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 702 insertions(+), 33 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index bcffe0d0e4..30b9cdd79b 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -467,7 +467,8 @@ RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_ls RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \ - rpc_server/srv_samr_util.o + rpc_server/srv_samr_util.o \ + librpc/gen_ndr/srv_samr.o RPC_INITSHUTDOWN_OBJ = librpc/gen_ndr/srv_initshutdown.o rpc_server/srv_initshutdown_nt.o diff --git a/source3/configure.in b/source3/configure.in index 7878cd96da..a054590b96 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -704,7 +704,7 @@ AC_SUBST(DYNEXP) dnl Add modules that have to be built by default here dnl These have to be built static: -default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr rpc_winreg rpc_initshutdown rpc_dssetup 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" +default_static_modules="pdb_smbpasswd pdb_tdbsam rpc_lsa rpc_samr2 rpc_winreg rpc_initshutdown rpc_dssetup 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 vfs_streams_xattr" @@ -6443,7 +6443,7 @@ SMB_MODULE(rpc_netdfs, \$(RPC_DFS_OBJ), "bin/librpc_netdfs.$SHLIBEXT", RPC) SMB_MODULE(rpc_srvsvc2, \$(RPC_SVC_OBJ), "bin/librpc_svcsvc2.$SHLIBEXT", RPC) SMB_MODULE(rpc_spoolss, \$(RPC_SPOOLSS_OBJ), "bin/librpc_spoolss.$SHLIBEXT", RPC) SMB_MODULE(rpc_eventlog2, \$(RPC_EVENTLOG_OBJ), "bin/librpc_eventlog2.$SHLIBEXT", RPC) -SMB_MODULE(rpc_samr, \$(RPC_SAMR_OBJ), "bin/librpc_samr.$SHLIBEXT", RPC) +SMB_MODULE(rpc_samr2, \$(RPC_SAMR_OBJ), "bin/librpc_samr2.$SHLIBEXT", RPC) SMB_MODULE(rpc_rpcecho, \$(RPC_ECHO_OBJ), "bin/librpc_rpcecho.$SHLIBEXT", RPC) SMB_SUBSYSTEM(RPC,smbd/server.o) diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 06694a2701..8c7c43f686 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -2367,7 +2367,7 @@ void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns ) dssetup_get_pipe_fns( &cmds, &n_cmds ); break; case PI_SAMR: - samr_get_pipe_fns( &cmds, &n_cmds ); + samr2_get_pipe_fns( &cmds, &n_cmds ); break; case PI_NETLOGON: netlog_get_pipe_fns( &cmds, &n_cmds ); diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index a1deac083d..e2ffdefcd6 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -36,33 +36,33 @@ #define DBGC_CLASS DBGC_RPC_SRV /******************************************************************* - api_samr_close_hnd ********************************************************************/ -static bool api_samr_close_hnd(pipes_struct *p) +static bool proxy_samr_call(pipes_struct *p, uint8 opnum) { - SAMR_Q_CLOSE_HND q_u; - SAMR_R_CLOSE_HND r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; + struct api_struct *fns; + int n_fns; - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); + samr_get_pipe_fns(&fns, &n_fns); - if(!samr_io_q_close_hnd("", &q_u, data, 0)) { - DEBUG(0,("api_samr_close_hnd: unable to unmarshall SAMR_Q_CLOSE_HND.\n")); - return False; + if (opnum >= n_fns) { + return false; } - r_u.status = _samr_close_hnd(p, &q_u, &r_u); - - /* store the response in the SMB stream */ - if(!samr_io_r_close_hnd("", &r_u, rdata, 0)) { - DEBUG(0,("api_samr_close_hnd: unable to marshall SAMR_R_CLOSE_HND.\n")); - return False; + if (fns[opnum].opnum != opnum) { + smb_panic("SAMR function table not sorted"); } - return True; + return fns[opnum].fn(p); +} + +/******************************************************************* + api_samr_close_hnd + ********************************************************************/ + +static bool api_samr_close_hnd(pipes_struct *p) +{ + return proxy_samr_call(p, NDR_SAMR_CLOSE); } /******************************************************************* @@ -1557,14 +1557,14 @@ static struct api_struct api_samr_cmds [] = {"SAMR_CONNECT5" , SAMR_CONNECT5 , api_samr_connect5 } }; -void samr_get_pipe_fns( struct api_struct **fns, int *n_fns ) +void samr2_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) +NTSTATUS rpc_samr2_init(void) { return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct)); diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index 01ce932afa..e80327367b 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -543,20 +543,18 @@ static uint32 count_sam_aliases(struct disp_info *info) } /******************************************************************* - _samr_close_hnd + _samr_Close ********************************************************************/ -NTSTATUS _samr_close_hnd(pipes_struct *p, SAMR_Q_CLOSE_HND *q_u, SAMR_R_CLOSE_HND *r_u) +NTSTATUS _samr_Close(pipes_struct *p, struct samr_Close *r) { - r_u->status = NT_STATUS_OK; - - /* close the policy handle */ - if (!close_policy_hnd(p, &q_u->pol)) - return NT_STATUS_OBJECT_NAME_INVALID; + if (!close_policy_hnd(p, r->in.handle)) { + return NT_STATUS_INVALID_HANDLE; + } - DEBUG(5,("samr_reply_close_hnd: %d\n", __LINE__)); + ZERO_STRUCT(r->out.handle); - return r_u->status; + return NT_STATUS_OK; } /******************************************************************* @@ -5059,3 +5057,673 @@ NTSTATUS _samr_set_dom_info(pipes_struct *p, SAMR_Q_SET_DOMAIN_INFO *q_u, SAMR_R return r_u->status; } + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Connect(pipes_struct *p, + struct samr_Connect *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetSecurity(pipes_struct *p, + struct samr_SetSecurity *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QuerySecurity(pipes_struct *p, + struct samr_QuerySecurity *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Shutdown(pipes_struct *p, + struct samr_Shutdown *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_LookupDomain(pipes_struct *p, + struct samr_LookupDomain *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_EnumDomains(pipes_struct *p, + struct samr_EnumDomains *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_OpenDomain(pipes_struct *p, + struct samr_OpenDomain *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryDomainInfo(pipes_struct *p, + struct samr_QueryDomainInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetDomainInfo(pipes_struct *p, + struct samr_SetDomainInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_CreateDomainGroup(pipes_struct *p, + struct samr_CreateDomainGroup *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_EnumDomainGroups(pipes_struct *p, + struct samr_EnumDomainGroups *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_CreateUser(pipes_struct *p, + struct samr_CreateUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_EnumDomainUsers(pipes_struct *p, + struct samr_EnumDomainUsers *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_CreateDomAlias(pipes_struct *p, + struct samr_CreateDomAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_EnumDomainAliases(pipes_struct *p, + struct samr_EnumDomainAliases *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetAliasMembership(pipes_struct *p, + struct samr_GetAliasMembership *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_LookupNames(pipes_struct *p, + struct samr_LookupNames *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_LookupRids(pipes_struct *p, + struct samr_LookupRids *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_OpenGroup(pipes_struct *p, + struct samr_OpenGroup *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryGroupInfo(pipes_struct *p, + struct samr_QueryGroupInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetGroupInfo(pipes_struct *p, + struct samr_SetGroupInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_AddGroupMember(pipes_struct *p, + struct samr_AddGroupMember *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_DeleteDomainGroup(pipes_struct *p, + struct samr_DeleteDomainGroup *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_DeleteGroupMember(pipes_struct *p, + struct samr_DeleteGroupMember *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryGroupMember(pipes_struct *p, + struct samr_QueryGroupMember *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetMemberAttributesOfGroup(pipes_struct *p, + struct samr_SetMemberAttributesOfGroup *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_OpenAlias(pipes_struct *p, + struct samr_OpenAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryAliasInfo(pipes_struct *p, + struct samr_QueryAliasInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetAliasInfo(pipes_struct *p, + struct samr_SetAliasInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_DeleteDomAlias(pipes_struct *p, + struct samr_DeleteDomAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_AddAliasMember(pipes_struct *p, + struct samr_AddAliasMember *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_DeleteAliasMember(pipes_struct *p, + struct samr_DeleteAliasMember *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetMembersInAlias(pipes_struct *p, + struct samr_GetMembersInAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_OpenUser(pipes_struct *p, + struct samr_OpenUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_DeleteUser(pipes_struct *p, + struct samr_DeleteUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryUserInfo(pipes_struct *p, + struct samr_QueryUserInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetUserInfo(pipes_struct *p, + struct samr_SetUserInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_ChangePasswordUser(pipes_struct *p, + struct samr_ChangePasswordUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetGroupsForUser(pipes_struct *p, + struct samr_GetGroupsForUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryDisplayInfo(pipes_struct *p, + struct samr_QueryDisplayInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetDisplayEnumerationIndex(pipes_struct *p, + struct samr_GetDisplayEnumerationIndex *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_TestPrivateFunctionsDomain(pipes_struct *p, + struct samr_TestPrivateFunctionsDomain *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_TestPrivateFunctionsUser(pipes_struct *p, + struct samr_TestPrivateFunctionsUser *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetUserPwInfo(pipes_struct *p, + struct samr_GetUserPwInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_RemoveMemberFromForeignDomain(pipes_struct *p, + struct samr_RemoveMemberFromForeignDomain *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryDomainInfo2(pipes_struct *p, + struct samr_QueryDomainInfo2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryUserInfo2(pipes_struct *p, + struct samr_QueryUserInfo2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryDisplayInfo2(pipes_struct *p, + struct samr_QueryDisplayInfo2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetDisplayEnumerationIndex2(pipes_struct *p, + struct samr_GetDisplayEnumerationIndex2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_CreateUser2(pipes_struct *p, + struct samr_CreateUser2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_QueryDisplayInfo3(pipes_struct *p, + struct samr_QueryDisplayInfo3 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_AddMultipleMembersToAlias(pipes_struct *p, + struct samr_AddMultipleMembersToAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_RemoveMultipleMembersFromAlias(pipes_struct *p, + struct samr_RemoveMultipleMembersFromAlias *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_OemChangePasswordUser2(pipes_struct *p, + struct samr_OemChangePasswordUser2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, + struct samr_ChangePasswordUser2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, + struct samr_GetDomPwInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Connect2(pipes_struct *p, + struct samr_Connect2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetUserInfo2(pipes_struct *p, + struct samr_SetUserInfo2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetBootKeyInformation(pipes_struct *p, + struct samr_SetBootKeyInformation *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_GetBootKeyInformation(pipes_struct *p, + struct samr_GetBootKeyInformation *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Connect3(pipes_struct *p, + struct samr_Connect3 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Connect4(pipes_struct *p, + struct samr_Connect4 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_ChangePasswordUser3(pipes_struct *p, + struct samr_ChangePasswordUser3 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_Connect5(pipes_struct *p, + struct samr_Connect5 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_RidToSid(pipes_struct *p, + struct samr_RidToSid *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_SetDsrmPassword(pipes_struct *p, + struct samr_SetDsrmPassword *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _samr_ValidatePassword(pipes_struct *p, + struct samr_ValidatePassword *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} -- cgit From d1f545062535b67a62c69ccb4440ecad069cfe93 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:54:11 +0100 Subject: Remove unused samr_close marshalling. Guenther (This used to be commit 93d2ad944772513520de22aecffda15f38907b4e) --- source3/include/rpc_samr.h | 17 ------------- source3/rpc_parse/parse_samr.c | 55 ------------------------------------------ 2 files changed, 72 deletions(-) diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 9f4645b691..93fc89751c 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -445,23 +445,6 @@ typedef struct sam_user_info_9 } SAM_USER_INFO_9; -/* SAMR_Q_CLOSE_HND - probably a policy handle close */ -typedef struct q_samr_close_hnd_info -{ - POLICY_HND pol; /* policy handle */ - -} SAMR_Q_CLOSE_HND; - - -/* SAMR_R_CLOSE_HND - probably a policy handle close */ -typedef struct r_samr_close_hnd_info -{ - POLICY_HND pol; /* policy handle */ - NTSTATUS status; /* return status */ - -} SAMR_R_CLOSE_HND; - - /**************************************************************************** SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this *****************************************************************************/ diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 23add3dffd..0e01da59ec 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -28,61 +28,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -inits a SAMR_Q_CLOSE_HND structure. -********************************************************************/ - -void init_samr_q_close_hnd(SAMR_Q_CLOSE_HND * q_c, POLICY_HND *hnd) -{ - DEBUG(5, ("init_samr_q_close_hnd\n")); - - q_c->pol = *hnd; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_close_hnd(const char *desc, SAMR_Q_CLOSE_HND * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_close_hnd"); - depth++; - - if(!prs_align(ps)) - return False; - - return smb_io_pol_hnd("pol", &q_u->pol, ps, depth); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_close_hnd(const char *desc, SAMR_R_CLOSE_HND * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_close_hnd"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("pol", &r_u->pol, ps, depth)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - /******************************************************************* inits a SAMR_Q_LOOKUP_DOMAIN structure. ********************************************************************/ -- cgit From 8dc7fe774e8e913e464b7661caf669145d5ff2f7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 31 Jan 2008 01:23:49 +0100 Subject: Cleanup status codes inside _net_logon_ctrl2() reply structs. Guenther (This used to be commit 1acb9daf809acab15bc390f6598814549b88368c) --- source3/rpc_server/srv_netlog_nt.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 5003af8ce7..fd90e88015 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -42,14 +42,6 @@ static void init_net_r_req_chal(NET_R_REQ_CHAL *r_c, r_c->status = status; } -/************************************************************************* - error messages cropping up when using nltest.exe... - *************************************************************************/ - -#define ERROR_NO_SUCH_DOMAIN 0x54b -#define ERROR_NO_LOGON_SERVERS 0x51f -#define NO_ERROR 0x0 - /************************************************************************* net_reply_logon_ctrl: *************************************************************************/ @@ -97,7 +89,7 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C r_u->status = NT_STATUS_OK; - tc_status = ERROR_NO_SUCH_DOMAIN; + tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN); fstrcpy( dc_name, "" ); switch ( q_u->function_code ) { @@ -108,13 +100,13 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C break; if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) { - tc_status = ERROR_NO_LOGON_SERVERS; + tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS); break; } fstr_sprintf( dc_name, "\\\\%s", dc_name2 ); - tc_status = NO_ERROR; + tc_status = W_ERROR_V(WERR_OK); break; @@ -125,13 +117,13 @@ NTSTATUS _net_logon_ctrl2(pipes_struct *p, NET_Q_LOGON_CTRL2 *q_u, NET_R_LOGON_C break; if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) { - tc_status = ERROR_NO_LOGON_SERVERS; + tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS); break; } fstr_sprintf( dc_name, "\\\\%s", dc_name2 ); - tc_status = NO_ERROR; + tc_status = W_ERROR_V(WERR_OK); break; -- cgit From 2e2fa2c66ed8cd1ada68bc22ff257490495a29f0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 21:55:03 +0100 Subject: Use pidl for samr_GetDomPwInfo() server-side. Guenther (This used to be commit 60fe8ade74d24d49f0fed0aae360a3b00edcd2b4) --- source3/rpc_server/srv_samr.c | 23 +---------------------- source3/rpc_server/srv_samr_nt.c | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index e2ffdefcd6..c05d126c4c 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -1350,28 +1350,7 @@ static bool api_samr_set_aliasinfo(pipes_struct *p) static bool api_samr_get_dom_pwinfo(pipes_struct *p) { - SAMR_Q_GET_DOM_PWINFO q_u; - SAMR_R_GET_DOM_PWINFO r_u; - - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!samr_io_q_get_dom_pwinfo("", &q_u, data, 0)) { - DEBUG(0,("api_samr_get_dom_pwinfo: unable to unmarshall SAMR_Q_GET_DOM_PWINFO.\n")); - return False; - } - - r_u.status = _samr_get_dom_pwinfo(p, &q_u, &r_u); - - if (!samr_io_r_get_dom_pwinfo("", &r_u, rdata, 0)) { - DEBUG(0,("api_samr_get_dom_pwinfo: unable to marshall SAMR_R_GET_DOM_PWINFO.\n")); - return False; - } - - return True; + return proxy_samr_call(p, NDR_SAMR_GETDOMPWINFO); } /******************************************************************* diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index e80327367b..986fe9a62e 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -4810,23 +4810,24 @@ NTSTATUS _samr_set_aliasinfo(pipes_struct *p, SAMR_Q_SET_ALIASINFO *q_u, SAMR_R_ return status; } -/********************************************************************* - _samr_get_dom_pwinfo -*********************************************************************/ +/**************************************************************** + _samr_GetDomPwInfo +****************************************************************/ -NTSTATUS _samr_get_dom_pwinfo(pipes_struct *p, SAMR_Q_GET_DOM_PWINFO *q_u, SAMR_R_GET_DOM_PWINFO *r_u) +NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, + struct samr_GetDomPwInfo *r) { /* Perform access check. Since this rpc does not require a policy handle it will not be caught by the access checks on SAMR_CONNECT or SAMR_CONNECT_ANON. */ if (!pipe_access_check(p)) { - DEBUG(3, ("access denied to samr_get_dom_pwinfo\n")); - r_u->status = NT_STATUS_ACCESS_DENIED; - return r_u->status; + DEBUG(3, ("access denied to _samr_GetDomPwInfo\n")); + return NT_STATUS_ACCESS_DENIED; } /* Actually, returning zeros here works quite well :-). */ + ZERO_STRUCTP(r->out.info); return NT_STATUS_OK; } @@ -5611,16 +5612,6 @@ NTSTATUS _samr_ChangePasswordUser2(pipes_struct *p, /**************************************************************** ****************************************************************/ -NTSTATUS _samr_GetDomPwInfo(pipes_struct *p, - struct samr_GetDomPwInfo *r) -{ - p->rng_fault_state = true; - return NT_STATUS_NOT_IMPLEMENTED; -} - -/**************************************************************** -****************************************************************/ - NTSTATUS _samr_Connect2(pipes_struct *p, struct samr_Connect2 *r) { -- cgit From 8953619787e9e0ca2101f54b0807c9e1d9991104 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 21:56:00 +0100 Subject: Remove old, unused marshalling code for SAMR_GET_DOM_PWINFO. Guenther (This used to be commit d74ab657df051b7bad616dbe7fe7732a653ffe6d) --- source3/include/rpc_samr.h | 18 ----------- source3/rpc_parse/parse_samr.c | 71 ------------------------------------------ 2 files changed, 89 deletions(-) diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 93fc89751c..1f6cb95b5a 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -1806,24 +1806,6 @@ typedef struct r_samr_connect_info5 } SAMR_R_CONNECT5; -/* SAMR_Q_GET_DOM_PWINFO */ -typedef struct q_samr_get_dom_pwinfo -{ - uint32 ptr; - UNIHDR hdr_srv_name; - UNISTR2 uni_srv_name; - -} SAMR_Q_GET_DOM_PWINFO; - -/* SAMR_R_GET_DOM_PWINFO */ -typedef struct r_samr_get_dom_pwinfo -{ - uint16 min_pwd_length; - uint32 password_properties; - NTSTATUS status; - -} SAMR_R_GET_DOM_PWINFO; - /* SAMR_ENC_PASSWD */ typedef struct enc_passwd_info { diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 0e01da59ec..37f9ba05d6 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -7283,77 +7283,6 @@ bool samr_io_r_connect_anon(const char *desc, SAMR_R_CONNECT_ANON * r_u, return True; } -/******************************************************************* -inits a SAMR_Q_GET_DOM_PWINFO structure. -********************************************************************/ - -void init_samr_q_get_dom_pwinfo(SAMR_Q_GET_DOM_PWINFO * q_u, - char *srv_name) -{ - DEBUG(5, ("init_samr_q_get_dom_pwinfo\n")); - - q_u->ptr = 1; - init_unistr2(&q_u->uni_srv_name, srv_name, UNI_FLAGS_NONE); - init_uni_hdr(&q_u->hdr_srv_name, &q_u->uni_srv_name); -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_get_dom_pwinfo(const char *desc, SAMR_Q_GET_DOM_PWINFO * q_u, - prs_struct *ps, int depth) -{ - if (q_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_get_dom_pwinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr", ps, depth, &q_u->ptr)) - return False; - if (q_u->ptr != 0) { - if(!smb_io_unihdr("", &q_u->hdr_srv_name, ps, depth)) - return False; - if(!smb_io_unistr2("", &q_u->uni_srv_name, q_u->hdr_srv_name.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_get_dom_pwinfo(const char *desc, SAMR_R_GET_DOM_PWINFO * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_get_dom_pwinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint16("min_pwd_length", ps, depth, &r_u->min_pwd_length)) - return False; - if(!prs_align(ps)) - return False; - if(!prs_uint32("password_properties", ps, depth, &r_u->password_properties)) - return False; - - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - /******************************************************************* make a SAMR_ENC_PASSWD structure. ********************************************************************/ -- cgit From 09454362cf75ecb7db58560604b567611e89d5ef Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 31 Jan 2008 00:38:12 +0100 Subject: Enable build of pidl generated netlogon server. Guenther (This used to be commit cb0fad1c97e1b590791fc0661f8ada1cdaa69318) --- source3/Makefile.in | 3 +- source3/rpc_server/srv_netlog_nt.c | 472 +++++++++++++++++++++++++++++++++++++ 2 files changed, 474 insertions(+), 1 deletion(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 30b9cdd79b..4625feda06 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -464,7 +464,8 @@ REG_API_OBJ = registry/reg_api.o \ RPC_LSA_OBJ = rpc_server/srv_lsa.o rpc_server/srv_lsa_nt.o librpc/gen_ndr/srv_lsa.o -RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o +RPC_NETLOG_OBJ = rpc_server/srv_netlog.o rpc_server/srv_netlog_nt.o \ + librpc/gen_ndr/srv_netlogon.o RPC_SAMR_OBJ = rpc_server/srv_samr.o rpc_server/srv_samr_nt.o \ rpc_server/srv_samr_util.o \ diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index fd90e88015..3a7075ecd6 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -1136,3 +1136,475 @@ NTSTATUS _net_sam_logon_ex(pipes_struct *p, NET_Q_SAM_LOGON_EX *q_u, NET_R_SAM_L return status; } #endif /* JERRY */ + + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonUasLogon(pipes_struct *p, + struct netr_LogonUasLogon *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonUasLogoff(pipes_struct *p, + struct netr_LogonUasLogoff *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_LogonSamLogon(pipes_struct *p, + struct netr_LogonSamLogon *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_LogonSamLogoff(pipes_struct *p, + struct netr_LogonSamLogoff *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerReqChallenge(pipes_struct *p, + struct netr_ServerReqChallenge *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerAuthenticate(pipes_struct *p, + struct netr_ServerAuthenticate *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerPasswordSet(pipes_struct *p, + struct netr_ServerPasswordSet *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_DatabaseDeltas(pipes_struct *p, + struct netr_DatabaseDeltas *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_DatabaseSync(pipes_struct *p, + struct netr_DatabaseSync *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_AccountDeltas(pipes_struct *p, + struct netr_AccountDeltas *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_AccountSync(pipes_struct *p, + struct netr_AccountSync *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonControl(pipes_struct *p, + struct netr_LogonControl *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_GetDcName(pipes_struct *p, + struct netr_GetDcName *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_GetAnyDCName(pipes_struct *p, + struct netr_GetAnyDCName *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonControl2(pipes_struct *p, + struct netr_LogonControl2 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerAuthenticate2(pipes_struct *p, + struct netr_ServerAuthenticate2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_DatabaseSync2(pipes_struct *p, + struct netr_DatabaseSync2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_DatabaseRedo(pipes_struct *p, + struct netr_DatabaseRedo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonControl2Ex(pipes_struct *p, + struct netr_LogonControl2Ex *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NetrEnumerateTrustedDomains(pipes_struct *p, + struct netr_NetrEnumerateTrustedDomains *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRGetDCName(pipes_struct *p, + struct netr_DsRGetDCName *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONDUMMYROUTINE1(pipes_struct *p, + struct netr_NETRLOGONDUMMYROUTINE1 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONSETSERVICEBITS(pipes_struct *p, + struct netr_NETRLOGONSETSERVICEBITS *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_LogonGetTrustRid(pipes_struct *p, + struct netr_LogonGetTrustRid *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONCOMPUTESERVERDIGEST(pipes_struct *p, + struct netr_NETRLOGONCOMPUTESERVERDIGEST *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONCOMPUTECLIENTDIGEST(pipes_struct *p, + struct netr_NETRLOGONCOMPUTECLIENTDIGEST *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerAuthenticate3(pipes_struct *p, + struct netr_ServerAuthenticate3 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRGetDCNameEx(pipes_struct *p, + struct netr_DsRGetDCNameEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRGetSiteName(pipes_struct *p, + struct netr_DsRGetSiteName *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_LogonGetDomainInfo(pipes_struct *p, + struct netr_LogonGetDomainInfo *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerPasswordSet2(pipes_struct *p, + struct netr_ServerPasswordSet2 *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_ServerPasswordGet(pipes_struct *p, + struct netr_ServerPasswordGet *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONSENDTOSAM(pipes_struct *p, + struct netr_NETRLOGONSENDTOSAM *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRAddressToSitenamesW(pipes_struct *p, + struct netr_DsRAddressToSitenamesW *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRGetDCNameEx2(pipes_struct *p, + struct netr_DsRGetDCNameEx2 *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(pipes_struct *p, + struct netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NetrEnumerateTrustedDomainsEx(pipes_struct *p, + struct netr_NetrEnumerateTrustedDomainsEx *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRAddressToSitenamesExW(pipes_struct *p, + struct netr_DsRAddressToSitenamesExW *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsrGetDcSiteCoverageW(pipes_struct *p, + struct netr_DsrGetDcSiteCoverageW *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_LogonSamLogonEx(pipes_struct *p, + struct netr_LogonSamLogonEx *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsrEnumerateDomainTrusts(pipes_struct *p, + struct netr_DsrEnumerateDomainTrusts *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsrDeregisterDNSHostRecords(pipes_struct *p, + struct netr_DsrDeregisterDNSHostRecords *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_ServerTrustPasswordsGet(pipes_struct *p, + struct netr_ServerTrustPasswordsGet *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_DsRGetForestTrustInformation(pipes_struct *p, + struct netr_DsRGetForestTrustInformation *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_GetForestTrustInformation(pipes_struct *p, + struct netr_GetForestTrustInformation *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + +/**************************************************************** +****************************************************************/ + +NTSTATUS _netr_LogonSamLogonWithFlags(pipes_struct *p, + struct netr_LogonSamLogonWithFlags *r) +{ + p->rng_fault_state = true; + return NT_STATUS_NOT_IMPLEMENTED; +} + +/**************************************************************** +****************************************************************/ + +WERROR _netr_NETRSERVERGETTRUSTINFO(pipes_struct *p, + struct netr_NETRSERVERGETTRUSTINFO *r) +{ + p->rng_fault_state = true; + return WERR_NOT_SUPPORTED; +} + -- cgit