From b78a3886a7674cb310fdd8e61fad4386a24af652 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Fri, 12 Apr 2002 04:17:29 +0000
Subject: set the default hashing scheme in head to "hash2"
it seems to be a much better scheme
(This used to be commit c8e2250ab1eae3aebecd8669e63f95f8656ae361)
---
source3/param/loadparm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index bdd710f5fe..462464d68f 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1243,6 +1243,9 @@ static void init_globals(void)
string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR);
string_set(&Globals.szPassdbBackend, "smbpasswd");
+ /* use the new 'hash2' method by default */
+ string_set(&Globals.szManglingMethod, "hash2");
+
string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
/* using UTF8 by default allows us to support all chars */
--
cgit
From f435873a6cb4fdc70de66cebd684f124aa9eed83 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Fri, 12 Apr 2002 08:22:50 +0000
Subject: Remove : from the list seperators, as this is used to seperate out
components in the passdb module selection (after the : you have the options).
Andrew Bartlett
(This used to be commit 6949b630f10ebb76e8e59ca7e832f53571f2c20a)
---
source3/include/local.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/include/local.h b/source3/include/local.h
index 1ecd63738e..24f3fa7724 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -77,7 +77,7 @@
#define MAX_PASS_LEN 200
/* separators for lists */
-#define LIST_SEP " \t,;:\n\r"
+#define LIST_SEP " \t,;\n\r"
/* wchar separators for lists */
#define LIST_SEP_W wchar_list_sep
--
cgit
From d621bf11ea8a2bb2ada2953c9d2c5d1b47041286 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Fri, 12 Apr 2002 12:52:18 +0000
Subject: fixed the display of the 'size on disk' property of files from w2k.
(This used to be commit 699a1d9f46fcc9d6aad56ed1b44d1295ee828b2b)
---
source3/smbd/trans2.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 1972e9c8c8..adae7e0b3c 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1352,12 +1352,13 @@ static int call_trans2qfsinfo(connection_struct *conn,
break;
case SMB_QUERY_FS_SIZE_INFO:
{
- SMB_BIG_UINT dfree,dsize,bsize;
+ SMB_BIG_UINT dfree,dsize,bsize, secs_per_unit;
data_len = 24;
conn->vfs_ops.disk_free(conn,".",False,&bsize,&dfree,&dsize);
- SBIG_UINT(pdata,0,dsize);
- SBIG_UINT(pdata,8,dfree);
- SIVAL(pdata,16,bsize/512);
+ secs_per_unit = 2;
+ SBIG_UINT(pdata,0,dsize*(bsize/(512*secs_per_unit)));
+ SBIG_UINT(pdata,8,dfree*(bsize/(512*secs_per_unit)));
+ SIVAL(pdata,16,secs_per_unit);
SIVAL(pdata,20,512);
break;
}
--
cgit
From 45b291b851834f4c4dffb1a2eb8d5afd53d5823d Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sat, 13 Apr 2002 00:58:04 +0000
Subject: when background printing wasn't enabled printing was completely
broken as the pid was 0 (This used to be commit
f16033635f5125758a3d2c3b0780d5bd2bd7bdbd)
---
source3/printing/printing.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index ad5acb1505..a28d95fcc8 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -536,7 +536,10 @@ update the internal database from the system print queue for a queue
****************************************************************************/
static void print_queue_update(int snum)
{
- message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE, &snum, sizeof(snum), False);
+ if (background_lpq_updater_pid > 0) {
+ message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE,
+ &snum, sizeof(snum), False);
+ }
}
/****************************************************************************
--
cgit
From 5c2dfd959c0facc299bca62356d1221bcea653bf Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Sat, 13 Apr 2002 02:24:07 +0000
Subject: Tidy up winbindd debug. Added Bill Moran's hide unreadable fix.
Jeremy. (This used to be commit a9895fcb30cdcb572cd254b0d370d79f95c7214d)
---
source3/nsswitch/winbindd.c | 7 +++----
source3/smbd/dir.c | 10 +++++++++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index e9ee2a7693..479be79574 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -397,11 +397,8 @@ static void client_read(struct winbindd_cli_state *state)
} while (n == -1 && errno == EINTR);
- DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n, sizeof(state->request) - n - state->read_buf_len ));
-
- /* Read failed, kill client */
-
if (n == -1 || n == 0) {
+ /* Read failed, kill client */
DEBUG(5,("read failed on sock %d, pid %d: %s\n",
state->sock, state->pid,
(n == -1) ? strerror(errno) : "EOF"));
@@ -410,6 +407,8 @@ static void client_read(struct winbindd_cli_state *state)
return;
}
+ DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n, sizeof(state->request) - n - state->read_buf_len ));
+
/* Update client state */
state->read_buf_len += n;
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index f56e0e9ef0..d224e4bdbe 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -680,7 +680,15 @@ static BOOL user_can_read_file(connection_struct *conn, char *name)
ZERO_STRUCT(ste);
- /* if we can't stat it does not show it */
+ /*
+ * If user is a member of the Admin group
+ * we never hide files from them.
+ */
+
+ if (conn->admin_user)
+ return True;
+
+ /* If we can't stat it does not show it */
if (vfs_stat(conn, name, &ste) != 0)
return False;
--
cgit
From 2248a889099b3b9452b74eeaa7350d4e0ea82d6a Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 03:23:08 +0000
Subject: Make our atomic increment code actually do this during its
first/second run.
The previous code would return the same value for both the initial and second
call, only incrementing on later calls.
Andrew Bartlett
(This used to be commit a4594d9efeca1f67dea57be8323fb4bd986318ce)
---
source3/tdb/tdbutil.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index 3e16a03047..bc39082f63 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -219,15 +219,22 @@ int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, char *keystr, int32 *oldval, int
return -1;
if ((val = tdb_fetch_int32(tdb, keystr)) == -1) {
- if (tdb_error(tdb) != TDB_ERR_NOEXIST)
+ /* The lookup failed */
+ if (tdb_error(tdb) != TDB_ERR_NOEXIST) {
+ /* but not becouse it didn't exist */
goto err_out;
-
+ }
+
+ /* Start with 'old' value */
val = *oldval;
} else {
+ /* It worked, set return value (oldval) to tdb data */
*oldval = val;
- val += change_val;
}
+
+ /* Increment value for storage and return next time */
+ val += change_val;
if (tdb_store_int32(tdb, keystr, val) == -1)
goto err_out;
@@ -253,15 +260,23 @@ BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, char *keystr, uint32 *oldval, ui
return False;
if (!tdb_fetch_uint32(tdb, keystr, &val)) {
- if (tdb_error(tdb) != TDB_ERR_NOEXIST)
+ /* It failed */
+ if (tdb_error(tdb) != TDB_ERR_NOEXIST) {
+ /* and not becouse it didn't exist */
goto err_out;
+ }
+ /* Start with 'old' value */
val = *oldval;
} else {
+ /* it worked, set return value (oldval) to tdb data */
*oldval = val;
- val += change_val;
+
}
+
+ /* get a new value to store */
+ val += change_val;
if (!tdb_store_uint32(tdb, keystr, val))
goto err_out;
--
cgit
From cc60b069836cbc355e828675e6f089b6ef22b32e Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 08:16:41 +0000
Subject: This is the 'multiple pdb backends' patch from ctrlsoft, aka Jelmer
Vernooij .
This patch also includes major rework of pdbedit to use popt, and the addition
of -i paramter (allowing the user to specify which PDBs is being
operated on) and -e to export a pdb - useful for backup and testing etc.
Use of -i and -e gets us pdb2pdb functionality for transition between backends,
much like the sam2sam in TNG.
Andrew Bartlett
(This used to be commit c10def37f506d3f2bab442418ac08fdb62659b02)
---
examples/README | 4 +-
examples/pdb/README | 6 +
source3/include/passdb.h | 24 ++-
source3/include/smb.h | 2 +
source3/passdb/pdb_interface.c | 300 +++++++++++++++++++----------
source3/passdb/pdb_ldap.c | 32 +--
source3/passdb/pdb_smbpasswd.c | 34 ++--
source3/passdb/pdb_tdb.c | 38 ++--
source3/utils/pdbedit.c | 428 +++++++++++------------------------------
9 files changed, 386 insertions(+), 482 deletions(-)
diff --git a/examples/README b/examples/README
index ba47cf912f..3e11ed4ad8 100644
--- a/examples/README
+++ b/examples/README
@@ -1,7 +1,7 @@
Copyright(C) Samba-Team 1993-1997
-This directory contains example config files and related material for
-Samba.
+This directory contains example samba extensions, example config files and
+related material for Samba.
At a minimum please refer to the smb.conf.default file for current
information regarding global and share parameter settings.
diff --git a/examples/pdb/README b/examples/pdb/README
index ccc39248aa..9ca03bf593 100644
--- a/examples/pdb/README
+++ b/examples/pdb/README
@@ -7,3 +7,9 @@ a pdb plugin. It just prints the name of the function that is executed using
DEBUG. Maybe it's nice to include some of the arguments to the function in the
future too..
+To debug passdb backends, try to run gdb on the 'pdbedit' executable. That's really much easier than restarting smbd constantly and attaching with your debugger.
+
+New passdb plugins should go into the samba lib directory, (/usr/lib/samba/ for
+most distributions) and should be prefixed with 'pdb_'. An example would be:
+/usr/lib/samba/pdb_test.so
+
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index f17b043fb2..9e14718994 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -29,7 +29,8 @@
typedef struct pdb_context
{
- struct pdb_methods *pdb_selected;
+ struct pdb_methods *pdb_methods;
+ struct pdb_methods *pwent_methods;
/* These functions are wrappers for the functions listed above.
They may do extra things like re-reading a SAM_ACCOUNT on update */
@@ -59,22 +60,27 @@ typedef struct pdb_context
typedef struct pdb_methods
{
const char *name; /* What name got this module */
+ struct pdb_context *parent;
- BOOL (*setsampwent)(struct pdb_context *, BOOL update);
+ /* Use macros from dlinklist.h on these two */
+ struct pdb_methods *next;
+ struct pdb_methods *prev;
+
+ BOOL (*setsampwent)(struct pdb_methods *, BOOL update);
- void (*endsampwent)(struct pdb_context *);
+ void (*endsampwent)(struct pdb_methods *);
- BOOL (*getsampwent)(struct pdb_context *, SAM_ACCOUNT *user);
+ BOOL (*getsampwent)(struct pdb_methods *, SAM_ACCOUNT *user);
- BOOL (*getsampwnam)(struct pdb_context *, SAM_ACCOUNT *sam_acct, const char *username);
+ BOOL (*getsampwnam)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, const char *username);
- BOOL (*getsampwrid)(struct pdb_context *, SAM_ACCOUNT *sam_acct, uint32 rid);
+ BOOL (*getsampwrid)(struct pdb_methods *, SAM_ACCOUNT *sam_acct, uint32 rid);
- BOOL (*add_sam_account)(struct pdb_context *, const SAM_ACCOUNT *sampass);
+ BOOL (*add_sam_account)(struct pdb_methods *, const SAM_ACCOUNT *sampass);
- BOOL (*update_sam_account)(struct pdb_context *, const SAM_ACCOUNT *sampass);
+ BOOL (*update_sam_account)(struct pdb_methods *, const SAM_ACCOUNT *sampass);
- BOOL (*delete_sam_account)(struct pdb_context *, const SAM_ACCOUNT *username);
+ BOOL (*delete_sam_account)(struct pdb_methods *, const SAM_ACCOUNT *username);
void *private_data; /* Private data of some kind */
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 8963528e9a..52b475ff27 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -595,6 +595,8 @@ typedef struct sam_passwd
void (*free_fn)(struct sam_passwd **);
+ struct pdb_methods *methods;
+
struct user_data {
/* initiailization flags */
uint32 init_flag;
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 435b627da6..e454bf3c25 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1,18 +1,19 @@
/*
Unix SMB/CIFS implementation.
Password and authentication handling
- Copyright (C) Andrew Bartlett 2002
-
+ Copyright (C) Andrew Bartlett 2002
+ Copyright (C) Jelmer Vernooij 2002
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
@@ -29,102 +30,182 @@ const struct pdb_init_function_entry builtin_pdb_init_functions[] = {
{ "tdbsam_nua", pdb_init_tdbsam_nua },
{ "ldapsam", pdb_init_ldapsam },
{ "ldapsam_nua", pdb_init_ldapsam_nua },
-#if 0
- { "nisplus", pdb_init_nisplus },
- { "unix", pdb_init_unix },
-#endif
{ "plugin", pdb_init_plugin },
{ NULL, NULL}
};
static BOOL context_setsampwent(struct pdb_context *context, BOOL update)
{
- if ((!context) || (!context->pdb_selected)) {
+ if ((!context) || (!context->pdb_methods) || (!context->pdb_methods->setsampwent)) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
+
+ context->pwent_methods = context->pdb_methods;
- return context->pdb_selected->setsampwent(context, update);
+ while(!(context->pwent_methods->setsampwent(context->pwent_methods, update))){
+ context->pwent_methods = context->pwent_methods->next;
+ if(context->pwent_methods == NULL)return False;
+ }
+ return True;
}
static void context_endsampwent(struct pdb_context *context)
{
- if ((!context) || (!context->pdb_selected)) {
+ if ((!context)){
DEBUG(0, ("invalid pdb_context specified!\n"));
return;
}
-
- context->pdb_selected->endsampwent(context);
+
+ if(context->pwent_methods && context->pwent_methods->endsampwent)
+ context->pwent_methods->endsampwent(context->pwent_methods);
+
+ /* So we won't get strange data when calling getsampwent now */
+ context->pwent_methods = NULL;
}
static BOOL context_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user)
{
- if ((!context) || (!context->pdb_selected)) {
+ if ((!context) || (!context->pwent_methods)) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
+ /* Loop until we find something useful */
+ while((!context->pwent_methods->getsampwent) ||
+ context->pwent_methods->getsampwent(context->pwent_methods, user) == False){
+
+ if(context->pwent_methods->endsampwent)
+ context->pwent_methods->endsampwent(context->pwent_methods);
+
+ context->pwent_methods = context->pwent_methods->next;
+
+ /* All methods are checked now. There are no more entries */
+ if(context->pwent_methods == NULL)return False;
- return context->pdb_selected->getsampwent(context, user);
+ if(!context->pwent_methods->setsampwent){
+ DEBUG(0, ("invalid context->pwent_methods->setsampwent\n"));
+ return False;
+ }
+
+ context->pwent_methods->setsampwent(context->pwent_methods, False);
+ }
+ user->methods = context->pwent_methods;
+ return True;
}
static BOOL context_getsampwnam(struct pdb_context *context, SAM_ACCOUNT *sam_acct, const char *username)
{
- if ((!context) || (!context->pdb_selected)) {
+ struct pdb_methods *curmethods;
+ if ((!context)) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
-
- return context->pdb_selected->getsampwnam(context, sam_acct, username);
+ curmethods = context->pdb_methods;
+ while(curmethods){
+ if(curmethods->getsampwnam && curmethods->getsampwnam(curmethods, sam_acct, username) == True){
+ sam_acct->methods = curmethods;
+ return True;
+ }
+ curmethods = curmethods->next;
+ }
+
+ return False;
}
static BOOL context_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_acct, uint32 rid)
{
- if ((!context) || (!context->pdb_selected)) {
+ struct pdb_methods *curmethods;
+ if ((!context)) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
- return context->pdb_selected->getsampwrid(context, sam_acct, rid);
+ curmethods = context->pdb_methods;
+
+ while(curmethods){
+ if(curmethods->getsampwrid && curmethods->getsampwrid(curmethods, sam_acct, rid) == True){
+ sam_acct->methods = curmethods;
+ return True;
+ }
+ curmethods = curmethods->next;
+ }
+
+ return False;
}
static BOOL context_add_sam_account(struct pdb_context *context, SAM_ACCOUNT *sam_acct)
{
- if ((!context) || (!context->pdb_selected)) {
+ if ((!context) || (!context->pdb_methods) || (!context->pdb_methods->add_sam_account)) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
-
+
/** @todo This is where a 're-read on add' should be done */
-
- return context->pdb_selected->add_sam_account(context, sam_acct);
+ /* We now add a new account to the first database listed.
+ * Should we? */
+
+ return context->pdb_methods->add_sam_account(context->pdb_methods, sam_acct);
}
static BOOL context_update_sam_account(struct pdb_context *context, SAM_ACCOUNT *sam_acct)
{
- if ((!context) || (!context->pdb_selected)) {
+ if (!context) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
-
+
+ if(!sam_acct || !sam_acct->methods){
+ DEBUG(0, ("invalid sam_acct specified\n"));
+ return False;
+ }
+
+ if(!sam_acct->methods->update_sam_account){
+ DEBUG(0, ("invalid sam_acct->methods\n"));
+ return False;
+ }
+
/** @todo This is where a 're-read on update' should be done */
-
- return context->pdb_selected->update_sam_account(context, sam_acct);
+
+ return sam_acct->methods->update_sam_account(sam_acct->methods, sam_acct);
}
static BOOL context_delete_sam_account(struct pdb_context *context, SAM_ACCOUNT *sam_acct)
{
- if ((!context) || (!context->pdb_selected)) {
+ struct pdb_methods *pdb_selected;
+ if (!context) {
DEBUG(0, ("invalid pdb_context specified!\n"));
return False;
}
+
+ if(!sam_acct->methods){
+ pdb_selected = context->pdb_methods;
+ /* There's no passdb backend specified for this account.
+ * Try to delete it in every passdb available */
+ while(pdb_selected){
+ if(pdb_selected->delete_sam_account && pdb_selected->delete_sam_account(pdb_selected, sam_acct)){
+ return True;
+ }
+ pdb_selected = pdb_selected->next;
+ }
+ return False;
+ }
+
+ if(!sam_acct->methods->delete_sam_account){
+ DEBUG(0,("invalid sam_acct->methods->delete_sam_account\n"));
+ return False;
+ }
- return context->pdb_selected->delete_sam_account(context, sam_acct);
+ return sam_acct->methods->delete_sam_account(sam_acct->methods, sam_acct);
}
static void free_pdb_context(struct pdb_context **context)
{
- if (((*context)->pdb_selected) && ((*context)->pdb_selected->free_private_data)) {
- (*context)->pdb_selected->free_private_data((*context)->pdb_selected->private_data);
+ struct pdb_methods *pdb_selected = (*context)->pdb_methods;
+
+ while(pdb_selected){
+ if(pdb_selected->free_private_data)
+ pdb_selected->free_private_data(pdb_selected->private_data);
+ pdb_selected = pdb_selected->next;
}
talloc_destroy((*context)->mem_ctx);
@@ -132,13 +213,57 @@ static void free_pdb_context(struct pdb_context **context)
}
/******************************************************************
- Make a pdb_context from scratch.
-*******************************************************************/
+ Make a pdb_methods from scratch
+ *******************************************************************/
+
+static NTSTATUS make_pdb_methods_name(struct pdb_methods **methods, struct pdb_context *context, const char *selected)
+{
+ char *module_name = smb_xstrdup(selected);
+ char *module_location = NULL, *p;
+ NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
+ int i;
+
+ p = strchr(module_name, ':');
+
+ if (p) {
+ *p = 0;
+ module_location = p+1;
+ trim_string(module_location, " ", " ");
+ }
+
+ trim_string(module_name, " ", " ");
+
+ DEBUG(5,("Attempting to find an passdb backend to match %s (%s)\n", selected, module_name));
+ for (i = 0; builtin_pdb_init_functions[i].name; i++)
+ {
+ if (strequal(builtin_pdb_init_functions[i].name, module_name))
+ {
+ DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_name, i));
+ if (NT_STATUS_IS_OK(nt_status
+ = builtin_pdb_init_functions[i].init(context, methods, module_location))) {
+ DEBUG(5,("pdb backend %s has a valid init\n", selected));
+ } else {
+ DEBUG(0,("pdb backend %s did not correctly init (error was %s)\n", selected, nt_errstr(nt_status)));
+ }
+ break;
+ }
+ }
+
+ if (!*methods) {
+ DEBUG(0,("failed to select passdb backed!\n"));
+ return nt_status;
+ }
+ return NT_STATUS_OK;
+}
+
+/******************************************************************
+ Make a pdb_context from scratch.
+ *******************************************************************/
static NTSTATUS make_pdb_context(struct pdb_context **context)
{
TALLOC_CTX *mem_ctx;
-
+
mem_ctx = talloc_init_named("pdb_context internal allocation context");
if (!mem_ctx) {
@@ -165,77 +290,58 @@ static NTSTATUS make_pdb_context(struct pdb_context **context)
(*context)->pdb_update_sam_account = context_update_sam_account;
(*context)->pdb_delete_sam_account = context_delete_sam_account;
+ (*context)->pdb_methods = NULL;
+ (*context)->pwent_methods = NULL;
+
(*context)->free_fn = free_pdb_context;
-
+
return NT_STATUS_OK;
}
/******************************************************************
- Make a pdb_context, given a text string.
-*******************************************************************/
+ Make a pdb_context, given a text string.
+ *******************************************************************/
NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selected)
{
- /* HINT: Don't store 'selected' becouse its often an lp_ string and
- will 'go away' */
+ /* HINT: Don't store 'selected' becouse its often an lp_ string and will 'go away' */
+ char *conf = smb_xstrdup(selected);
+ char *confcur = conf, *confnext;
+ struct pdb_methods *curmethods, *tmpmethods;
NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
- int i;
- char *module_name = smb_xstrdup(selected);
- char *module_location = NULL;
- char *p;
- p = strchr(module_name, ':');
-
- if (p) {
- *p = 0;
-
- module_location = p+1;
-
- trim_string(module_location, " ", " ");
+ if(!NT_STATUS_IS_OK(nt_status = make_pdb_context(context))){
+ return nt_status;
}
- trim_string(module_name, " ", " ");
-
- if (!NT_STATUS_IS_OK(nt_status = make_pdb_context(context)))
- goto done;
-
- DEBUG(5,("Attempting to find an passdb backend to match %s (%s)\n",
- selected, module_name));
-
- for (i = 0; builtin_pdb_init_functions[i].name; i++) {
- if (strequal(builtin_pdb_init_functions[i].name,
- module_name)) {
-
- DEBUG(5,("Found pdb backend %s (at pos %d)\n",
- module_name, i));
-
- if (NT_STATUS_IS_OK(nt_status = builtin_pdb_init_functions[i].init(*context, &(*context)->pdb_selected, module_location))) {
- DEBUG(5,("pdb backend %s has a valid init\n", selected));
- } else {
- DEBUG(0,("pdb backend %s did not correctly init (error was %s)\n", selected, nt_errstr(nt_status)));
- (*context)->pdb_selected = NULL;
- }
- break;
+ while(confcur){
+ if(strchr(confcur, ' ')){
+ confnext = strchr(confcur,' ');
+ *confnext = '\0';
+ confnext++;
+ }else confnext = NULL;
+
+ /* Try to initialise pdb */
+ DEBUG(5,("Trying to load: %s\n", confcur));
+ if(!NT_STATUS_IS_OK(make_pdb_methods_name(&curmethods, *context, confcur))){
+ DEBUG(5, ("Loading %s failed!\n", confcur));
+ SAFE_FREE(curmethods);
+ continue;
}
+ curmethods->parent = *context;
+ DLIST_ADD_END((*context)->pdb_methods, curmethods, tmpmethods);
+
+ if(!confnext)break;
+ confcur = confnext;
}
-
- if (!(*context)->pdb_selected) {
- DEBUG(0,("failed to select passdb backed!\n"));
- talloc_destroy((*context)->mem_ctx);
- *context = NULL;
- goto done;
- }
+ SAFE_FREE(conf);
nt_status = NT_STATUS_OK;
- done:
- SAFE_FREE(module_name);
-
return nt_status;
}
-
/******************************************************************
Return an already initialised pdb_context, to facilitate backward
compatibility (see functions below).
@@ -244,20 +350,20 @@ NTSTATUS make_pdb_context_name(struct pdb_context **context, const char *selecte
static struct pdb_context *pdb_get_static_context(BOOL reload)
{
static struct pdb_context *pdb_context = NULL;
-
+
if ((pdb_context) && (reload)) {
pdb_context->free_fn(&pdb_context);
if (!NT_STATUS_IS_OK(make_pdb_context_name(&pdb_context, lp_passdb_backend()))) {
return NULL;
}
}
-
+
if (!pdb_context) {
if (!NT_STATUS_IS_OK(make_pdb_context_name(&pdb_context, lp_passdb_backend()))) {
return NULL;
}
}
-
+
return pdb_context;
}
@@ -347,21 +453,21 @@ BOOL pdb_update_sam_account(SAM_ACCOUNT *sam_acct)
BOOL pdb_delete_sam_account(SAM_ACCOUNT *sam_acct)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
-
+
if (!pdb_context) {
return False;
}
-
+
return pdb_context->pdb_delete_sam_account(pdb_context, sam_acct);
}
#endif /* !defined(WITH_NISPLUS_SAM) */
/***************************************************************
- Initialize the static context (at smbd startup etc).
+ Initialize the static context (at smbd startup etc).
- If uninitialised, context will auto-init on first use.
-***************************************************************/
+ If uninitialised, context will auto-init on first use.
+ ***************************************************************/
BOOL initialize_password_db(BOOL reload)
{
@@ -381,11 +487,3 @@ NTSTATUS make_pdb_methods(TALLOC_CTX *mem_ctx, PDB_METHODS **methods)
return NT_STATUS_OK;
}
-
-
-
-
-
-
-
-
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 02bb43b7ff..dc6b9f97ff 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1006,9 +1006,9 @@ static uint32 ldapsam_get_next_available_nua_rid(struct ldapsam_privates *ldap_s
/**********************************************************************
Connect to LDAP server for password enumeration
*********************************************************************/
-static BOOL ldapsam_setsampwent(struct pdb_context *context, BOOL update)
+static BOOL ldapsam_setsampwent(struct pdb_methods *my_methods, BOOL update)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
int rc;
pstring filter;
@@ -1054,9 +1054,9 @@ static BOOL ldapsam_setsampwent(struct pdb_context *context, BOOL update)
/**********************************************************************
End enumeration of the LDAP password list
*********************************************************************/
-static void ldapsam_endsampwent(struct pdb_context *context)
+static void ldapsam_endsampwent(struct pdb_methods *my_methods)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
if (ldap_state->ldap_struct && ldap_state->result)
{
ldap_msgfree(ldap_state->result);
@@ -1069,9 +1069,9 @@ static void ldapsam_endsampwent(struct pdb_context *context)
/**********************************************************************
Get the next entry in the LDAP password database
*********************************************************************/
-static BOOL ldapsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT * user)
+static BOOL ldapsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT * user)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
BOOL ret = False;
while (!ret) {
@@ -1093,9 +1093,9 @@ static BOOL ldapsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT * user)
/**********************************************************************
Get SAM_ACCOUNT entry from LDAP by username
*********************************************************************/
-static BOOL ldapsam_getsampwnam(struct pdb_context *context, SAM_ACCOUNT * user, const char *sname)
+static BOOL ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const char *sname)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
LDAP *ldap_struct;
LDAPMessage *result;
LDAPMessage *entry;
@@ -1144,9 +1144,9 @@ static BOOL ldapsam_getsampwnam(struct pdb_context *context, SAM_ACCOUNT * user,
/**********************************************************************
Get SAM_ACCOUNT entry from LDAP by rid
*********************************************************************/
-static BOOL ldapsam_getsampwrid(struct pdb_context *context, SAM_ACCOUNT * user, uint32 rid)
+static BOOL ldapsam_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, uint32 rid)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
LDAP *ldap_struct;
LDAPMessage *result;
LDAPMessage *entry;
@@ -1199,9 +1199,9 @@ static BOOL ldapsam_getsampwrid(struct pdb_context *context, SAM_ACCOUNT * user,
/**********************************************************************
Delete entry from LDAP for username
*********************************************************************/
-static BOOL ldapsam_delete_sam_account(struct pdb_context *context, const SAM_ACCOUNT * sam_acct)
+static BOOL ldapsam_delete_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT * sam_acct)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
const char *sname;
int rc;
char *dn;
@@ -1259,9 +1259,9 @@ static BOOL ldapsam_delete_sam_account(struct pdb_context *context, const SAM_AC
/**********************************************************************
Update SAM_ACCOUNT
*********************************************************************/
-static BOOL ldapsam_update_sam_account(struct pdb_context *context, const SAM_ACCOUNT * newpwd)
+static BOOL ldapsam_update_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT * newpwd)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
int rc;
char *dn;
LDAP *ldap_struct;
@@ -1326,9 +1326,9 @@ static BOOL ldapsam_update_sam_account(struct pdb_context *context, const SAM_AC
/**********************************************************************
Add SAM_ACCOUNT to LDAP
*********************************************************************/
-static BOOL ldapsam_add_sam_account(struct pdb_context *context, const SAM_ACCOUNT * newpwd)
+static BOOL ldapsam_add_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT * newpwd)
{
- struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)context->pdb_selected->private_data;
+ struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
int rc;
pstring filter;
LDAP *ldap_struct = NULL;
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 89a4217c3b..18c949c592 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -198,7 +198,7 @@ static FILE *startsmbfilepwent(const char *pfile, enum pwf_access_type type, int
DEBUG(10, ("startsmbfilepwent_internal: opening file %s\n", pfile));
if((fp = sys_fopen(pfile, open_mode)) == NULL) {
- DEBUG(2, ("startsmbfilepwent_internal: unable to open file %s. Error was %s\n", pfile, strerror(errno) ));
+ DEBUG(0, ("startsmbfilepwent_internal: unable to open file %s. Error was %s\n", pfile, strerror(errno) ));
return NULL;
}
@@ -1340,9 +1340,9 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, SAM_AC
/*****************************************************************
Functions to be implemented by the new passdb API
****************************************************************/
-static BOOL smbpasswd_setsampwent (struct pdb_context *context, BOOL update)
+static BOOL smbpasswd_setsampwent (struct pdb_methods *my_methods, BOOL update)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
smbpasswd_state->pw_file = startsmbfilepwent(smbpasswd_state->smbpasswd_file,
update ? PWF_UPDATE : PWF_READ,
@@ -1370,17 +1370,17 @@ static BOOL smbpasswd_setsampwent (struct pdb_context *context, BOOL update)
return (smbpasswd_state->pw_file != NULL);
}
-static void smbpasswd_endsampwent (struct pdb_context *context)
+static void smbpasswd_endsampwent (struct pdb_methods *my_methods)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
endsmbfilepwent(smbpasswd_state->pw_file, &(smbpasswd_state->pw_file_lock_depth));
}
/*****************************************************************
****************************************************************/
-static BOOL smbpasswd_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user)
+static BOOL smbpasswd_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *user)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd *pw_buf=NULL;
BOOL done = False;
DEBUG(5,("pdb_getsampwent\n"));
@@ -1419,9 +1419,9 @@ static BOOL smbpasswd_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user
call getpwnam() for unix account information until we have found
the correct entry
***************************************************************/
-static BOOL smbpasswd_getsampwnam(struct pdb_context *context, SAM_ACCOUNT *sam_acct, const char *username)
+static BOOL smbpasswd_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_acct, const char *username)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd *smb_pw;
void *fp = NULL;
char *domain = NULL;
@@ -1489,9 +1489,9 @@ static BOOL smbpasswd_getsampwnam(struct pdb_context *context, SAM_ACCOUNT *sam_
}
-static BOOL smbpasswd_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_acct,uint32 rid)
+static BOOL smbpasswd_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT *sam_acct,uint32 rid)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd *smb_pw;
void *fp = NULL;
@@ -1533,9 +1533,9 @@ static BOOL smbpasswd_getsampwrid(struct pdb_context *context, SAM_ACCOUNT *sam_
return True;
}
-static BOOL smbpasswd_add_sam_account(struct pdb_context *context, const SAM_ACCOUNT *sampass)
+static BOOL smbpasswd_add_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT *sampass)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd smb_pw;
/* convert the SAM_ACCOUNT */
@@ -1551,9 +1551,9 @@ static BOOL smbpasswd_add_sam_account(struct pdb_context *context, const SAM_ACC
return True;
}
-static BOOL smbpasswd_update_sam_account(struct pdb_context *context, const SAM_ACCOUNT *sampass)
+static BOOL smbpasswd_update_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT *sampass)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
struct smb_passwd smb_pw;
/* convert the SAM_ACCOUNT */
@@ -1567,9 +1567,9 @@ static BOOL smbpasswd_update_sam_account(struct pdb_context *context, const SAM_
return True;
}
-static BOOL smbpasswd_delete_sam_account (struct pdb_context *context, const SAM_ACCOUNT *sampass)
+static BOOL smbpasswd_delete_sam_account (struct pdb_methods *my_methods, const SAM_ACCOUNT *sampass)
{
- struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)context->pdb_selected->private_data;
+ struct smbpasswd_privates *smbpasswd_state = (struct smbpasswd_privates*)my_methods->private_data;
const char *username = pdb_get_username(sampass);
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index a8edac917e..7092caa15e 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -462,9 +462,9 @@ static uint32 init_buffer_from_sam (struct tdbsam_privates *tdb_state,
Open the TDB passwd database for SAM account enumeration.
****************************************************************/
-static BOOL tdbsam_setsampwent(struct pdb_context *context, BOOL update)
+static BOOL tdbsam_setsampwent(struct pdb_methods *my_methods, BOOL update)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
/* Open tdb passwd */
if (!(tdb_state->passwd_tdb = tdb_open_log(tdb_state->tdbsam_location, 0, TDB_DEFAULT, update?(O_RDWR|O_CREAT):O_RDONLY, 0600)))
@@ -490,9 +490,9 @@ static void close_tdb(struct tdbsam_privates *tdb_state)
End enumeration of the TDB passwd list.
****************************************************************/
-static void tdbsam_endsampwent(struct pdb_context *context)
+static void tdbsam_endsampwent(struct pdb_methods *my_methods)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
close_tdb(tdb_state);
DEBUG(7, ("endtdbpwent: closed sam database.\n"));
@@ -502,9 +502,9 @@ static void tdbsam_endsampwent(struct pdb_context *context)
Get one SAM_ACCOUNT from the TDB (next in line)
*****************************************************************/
-static BOOL tdbsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user)
+static BOOL tdbsam_getsampwent(struct pdb_methods *my_methods, SAM_ACCOUNT *user)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_DATA data;
char *prefix = USERPREFIX;
int prefixlen = strlen (prefix);
@@ -550,9 +550,9 @@ static BOOL tdbsam_getsampwent(struct pdb_context *context, SAM_ACCOUNT *user)
Lookup a name in the SAM TDB
******************************************************************/
-static BOOL tdbsam_getsampwnam (struct pdb_context *context, SAM_ACCOUNT *user, const char *sname)
+static BOOL tdbsam_getsampwnam (struct pdb_methods *my_methods, SAM_ACCOUNT *user, const char *sname)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_CONTEXT *pwd_tdb;
TDB_DATA data, key;
fstring keystr;
@@ -606,9 +606,9 @@ static BOOL tdbsam_getsampwnam (struct pdb_context *context, SAM_ACCOUNT *user,
Search by rid
**************************************************************************/
-static BOOL tdbsam_getsampwrid (struct pdb_context *context, SAM_ACCOUNT *user, uint32 rid)
+static BOOL tdbsam_getsampwrid (struct pdb_methods *my_methods, SAM_ACCOUNT *user, uint32 rid)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_CONTEXT *pwd_tdb;
TDB_DATA data, key;
fstring keystr;
@@ -644,16 +644,16 @@ static BOOL tdbsam_getsampwrid (struct pdb_context *context, SAM_ACCOUNT *user,
tdb_close (pwd_tdb);
- return tdbsam_getsampwnam (context, user, name);
+ return tdbsam_getsampwnam (my_methods, user, name);
}
/***************************************************************************
Delete a SAM_ACCOUNT
****************************************************************************/
-static BOOL tdbsam_delete_sam_account(struct pdb_context *context, const SAM_ACCOUNT *sam_pass)
+static BOOL tdbsam_delete_sam_account(struct pdb_methods *my_methods, const SAM_ACCOUNT *sam_pass)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_CONTEXT *pwd_tdb;
TDB_DATA key;
fstring keystr;
@@ -707,9 +707,9 @@ static BOOL tdbsam_delete_sam_account(struct pdb_context *context, const SAM_ACC
Update the TDB SAM
****************************************************************************/
-static BOOL tdb_update_sam(struct pdb_context *context, const SAM_ACCOUNT* newpwd, int flag)
+static BOOL tdb_update_sam(struct pdb_methods *my_methods, const SAM_ACCOUNT* newpwd, int flag)
{
- struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)context->pdb_selected->private_data;
+ struct tdbsam_privates *tdb_state = (struct tdbsam_privates *)my_methods->private_data;
TDB_CONTEXT *pwd_tdb = NULL;
TDB_DATA key, data;
uint8 *buf = NULL;
@@ -823,18 +823,18 @@ done:
Modifies an existing SAM_ACCOUNT
****************************************************************************/
-static BOOL tdbsam_update_sam_account (struct pdb_context *context, const SAM_ACCOUNT *newpwd)
+static BOOL tdbsam_update_sam_account (struct pdb_methods *my_methods, const SAM_ACCOUNT *newpwd)
{
- return (tdb_update_sam(context, newpwd, TDB_MODIFY));
+ return (tdb_update_sam(my_methods, newpwd, TDB_MODIFY));
}
/***************************************************************************
Adds an existing SAM_ACCOUNT
****************************************************************************/
-static BOOL tdbsam_add_sam_account (struct pdb_context *context, const SAM_ACCOUNT *newpwd)
+static BOOL tdbsam_add_sam_account (struct pdb_methods *my_methods, const SAM_ACCOUNT *newpwd)
{
- return (tdb_update_sam(context, newpwd, TDB_INSERT));
+ return (tdb_update_sam(my_methods, newpwd, TDB_INSERT));
}
static void free_private_data(void **vp)
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 1fb1f2355b..421a72923a 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -4,6 +4,7 @@
Copyright (C) Simo Sorce 2000
Copyright (C) Andrew Bartlett 2001
+ Copyright (C) Jelmer Vernooij 2002
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
@@ -25,40 +26,40 @@
extern pstring global_myname;
extern BOOL AllowDebugChange;
-/*
- * Next two lines needed for SunOS and don't
- * hurt anything else...
- */
-extern char *optarg;
-extern int optind;
-
/*********************************************************
- Print command usage on stderr and die.
-**********************************************************/
-static void usage(void)
-{
- if (getuid() == 0) {
- printf("pdbedit options\n");
- } else {
- printf("You need to be root to use this tool!\n");
+ Add all currently available users to another db
+ ********************************************************/
+
+int export_database (struct pdb_context *in, char *db){
+ struct pdb_context *context;
+ SAM_ACCOUNT *user = NULL;
+
+ if(!NT_STATUS_IS_OK(make_pdb_context_name(&context, db))){
+ fprintf(stderr, "Can't initialize %s.\n", db);
+ return 1;
+ }
+
+ if(!in->pdb_setsampwent(in, 0)){
+ fprintf(stderr, "Can't sampwent!\n");
+ return 1;
+ }
+
+ if(!NT_STATUS_IS_OK(pdb_init_sam(&user))){
+ fprintf(stderr, "Can't initialize new SAM_ACCOUNT!\n");
+ return 1;
}
- printf("(actually to add a user you need to use smbpasswd)\n");
- printf("options:\n");
- printf(" -l list usernames\n");
- printf(" -v verbose output\n");
- printf(" -w smbpasswd file style\n");
- printf(" -u username print user's info\n");
- printf(" -f fullname set Full Name\n");
- printf(" -h homedir set home directory\n");
- printf(" -d drive set home dir drive\n");
- printf(" -s script set logon script\n");
- printf(" -p profile set profile path\n");
- printf(" -a create new account\n");
- printf(" -m it is a machine trust\n");
- printf(" -x delete this user\n");
- printf(" -i file import account from file (smbpasswd style)\n");
- printf(" -D debuglevel set DEBUGELEVEL (default = 1)\n");
- exit(1);
+
+ while(in->pdb_getsampwent(in,user)){
+ context->pdb_add_sam_account(context,user);
+ if(!NT_STATUS_IS_OK(pdb_reset_sam(user))){
+ fprintf(stderr, "Can't reset SAM_ACCOUNT!\n");
+ return 1;
+ }
+ }
+
+ in->pdb_endsampwent(in);
+
+ return 0;
}
/*********************************************************
@@ -126,7 +127,7 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
Get an Print User Info
**********************************************************/
-static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
+static int print_user_info (struct pdb_context *in, char *username, BOOL verbosity, BOOL smbpwdstyle)
{
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
@@ -135,7 +136,7 @@ static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
return -1;
}
- ret = pdb_getsampwnam (sam_pwent, username);
+ ret = in->pdb_getsampwnam (in, sam_pwent, username);
if (ret==False) {
fprintf (stderr, "Username not found!\n");
@@ -152,13 +153,13 @@ static int print_user_info (char *username, BOOL verbosity, BOOL smbpwdstyle)
/*********************************************************
List Users
**********************************************************/
-static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
+static int print_users_list (struct pdb_context *in, BOOL verbosity, BOOL smbpwdstyle)
{
SAM_ACCOUNT *sam_pwent=NULL;
BOOL check, ret;
errno = 0; /* testing --simo */
- check = pdb_setsampwent(False);
+ check = in->pdb_setsampwent(in, False);
if (check && errno == ENOENT) {
fprintf (stderr,"Password database not found!\n");
exit(1);
@@ -167,7 +168,7 @@ static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
check = True;
if (!(NT_STATUS_IS_OK(pdb_init_sam(&sam_pwent)))) return 1;
- while (check && (ret = pdb_getsampwent (sam_pwent))) {
+ while (check && (ret = in->pdb_getsampwent (in, sam_pwent))) {
if (verbosity)
printf ("---------------\n");
print_sam_info (sam_pwent, verbosity, smbpwdstyle);
@@ -176,7 +177,7 @@ static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
}
if (check) pdb_free_sam(&sam_pwent);
- pdb_endsampwent();
+ in->pdb_endsampwent(in);
return 0;
}
@@ -184,14 +185,14 @@ static int print_users_list (BOOL verbosity, BOOL smbpwdstyle)
Set User Info
**********************************************************/
-static int set_user_info (char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
+static int set_user_info (struct pdb_context *in, char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
{
SAM_ACCOUNT *sam_pwent=NULL;
BOOL ret;
pdb_init_sam(&sam_pwent);
- ret = pdb_getsampwnam (sam_pwent, username);
+ ret = in->pdb_getsampwnam (in, sam_pwent, username);
if (ret==False) {
fprintf (stderr, "Username not found!\n");
pdb_free_sam(&sam_pwent);
@@ -209,8 +210,8 @@ static int set_user_info (char *username, char *fullname, char *homedir, char *d
if (profile)
pdb_set_profile_path (sam_pwent, profile, True);
- if (pdb_update_sam_account (sam_pwent))
- print_user_info (username, True, False);
+ if (in->pdb_update_sam_account (in, sam_pwent))
+ print_user_info (in, username, True, False);
else {
fprintf (stderr, "Unable to modify entry!\n");
pdb_free_sam(&sam_pwent);
@@ -223,7 +224,7 @@ static int set_user_info (char *username, char *fullname, char *homedir, char *d
/*********************************************************
Add New User
**********************************************************/
-static int new_user (char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
+static int new_user (struct pdb_context *in, char *username, char *fullname, char *homedir, char *drive, char *script, char *profile)
{
SAM_ACCOUNT *sam_pwent=NULL;
struct passwd *pwd = NULL;
@@ -265,8 +266,8 @@ static int new_user (char *username, char *fullname, char *homedir, char *drive,
pdb_set_acct_ctrl (sam_pwent, ACB_NORMAL);
- if (pdb_add_sam_account (sam_pwent)) {
- print_user_info (username, True, False);
+ if (in->pdb_add_sam_account (in, sam_pwent)) {
+ print_user_info (in, username, True, False);
} else {
fprintf (stderr, "Unable to add user! (does it alredy exist?)\n");
pdb_free_sam (&sam_pwent);
@@ -280,7 +281,7 @@ static int new_user (char *username, char *fullname, char *homedir, char *drive,
Add New Machine
**********************************************************/
-static int new_machine (char *machinename)
+static int new_machine (struct pdb_context *in, char *machinename)
{
SAM_ACCOUNT *sam_pwent=NULL;
char name[16];
@@ -307,8 +308,8 @@ static int new_machine (char *machinename)
pdb_set_group_rid(sam_pwent, DOMAIN_GROUP_RID_COMPUTERS);
- if (pdb_add_sam_account (sam_pwent)) {
- print_user_info (name, True, False);
+ if (in->pdb_add_sam_account (in, sam_pwent)) {
+ print_user_info (in, name, True, False);
} else {
fprintf (stderr, "Unable to add machine! (does it already exist?)\n");
pdb_free_sam (&sam_pwent);
@@ -322,7 +323,7 @@ static int new_machine (char *machinename)
Delete user entry
**********************************************************/
-static int delete_user_entry (char *username)
+static int delete_user_entry (struct pdb_context *in, char *username)
{
SAM_ACCOUNT *samaccount = NULL;
@@ -330,19 +331,19 @@ static int delete_user_entry (char *username)
return -1;
}
- if (!pdb_getsampwnam(samaccount, username)) {
+ if (!in->pdb_getsampwnam(in, samaccount, username)) {
fprintf (stderr, "user %s does not exist in the passdb\n", username);
return -1;
}
- return pdb_delete_sam_account (samaccount);
+ return in->pdb_delete_sam_account (in, samaccount);
}
/*********************************************************
Delete machine entry
**********************************************************/
-static int delete_machine_entry (char *machinename)
+static int delete_machine_entry (struct pdb_context *in, char *machinename)
{
char name[16];
SAM_ACCOUNT *samaccount = NULL;
@@ -355,189 +356,12 @@ static int delete_machine_entry (char *machinename)
return -1;
}
- if (!pdb_getsampwnam(samaccount, name)) {
+ if (!in->pdb_getsampwnam(in, samaccount, name)) {
fprintf (stderr, "user %s does not exist in the passdb\n", name);
return -1;
}
- return pdb_delete_sam_account (samaccount);
-}
-
-/*********************************************************
- Import smbpasswd style file
-**********************************************************/
-
-static int import_users (char *filename)
-{
- FILE *fp = NULL;
- SAM_ACCOUNT *sam_pwent = NULL;
- static pstring user_name;
- static unsigned char smbpwd[16];
- static unsigned char smbntpwd[16];
- char linebuf[256];
- size_t linebuf_len;
- unsigned char c;
- unsigned char *p;
- long uidval;
- int line = 0;
- int good = 0;
- struct passwd *pwd;
-
- if((fp = sys_fopen(filename, "rb")) == NULL) {
- fprintf (stderr, "%s\n", strerror (ferror (fp)));
- return -1;
- }
-
- while (!feof(fp)) {
- /*Get a new line*/
- linebuf[0] = '\0';
- fgets(linebuf, 256, fp);
- if (ferror(fp)) {
- fprintf (stderr, "%s\n", strerror (ferror (fp)));
- return -1;
- }
- if ((linebuf_len = strlen(linebuf)) == 0) {
- line++;
- continue;
- }
- if (linebuf[linebuf_len - 1] != '\n') {
- c = '\0';
- while (!ferror(fp) && !feof(fp)) {
- c = fgetc(fp);
- if (c == '\n') break;
- }
- } else
- linebuf[linebuf_len - 1] = '\0';
- linebuf[linebuf_len] = '\0';
- if ((linebuf[0] == 0) && feof(fp)) {
- /*end of file!!*/
- return 0;
- }
- line++;
- if (linebuf[0] == '#' || linebuf[0] == '\0')
- continue;
-
- /* Get user name */
- p = (unsigned char *) strchr_m(linebuf, ':');
- if (p == NULL) {
- fprintf (stderr, "Error: malformed password entry at line %d !!\n", line);
- continue;
- }
- strncpy(user_name, linebuf, PTR_DIFF(p, linebuf));
- user_name[PTR_DIFF(p, linebuf)] = '\0';
-
- /* Get smb uid. */
- p++;
- if(*p == '-') {
- fprintf (stderr, "Error: negative uid at line %d\n", line);
- continue;
- }
- if (!isdigit(*p)) {
- fprintf (stderr, "Error: malformed password entry at line %d (uid not number)\n", line);
- continue;
- }
- uidval = atoi((char *) p);
- while (*p && isdigit(*p)) p++;
- if (*p != ':') {
- fprintf (stderr, "Error: malformed password entry at line %d (no : after uid)\n", line);
- continue;
- }
- if(!(pwd = sys_getpwnam(user_name))) {
- fprintf(stderr, "User %s does not \
-exist in system password file (usually /etc/passwd). Cannot add \
-account without a valid local system user.\n", user_name);
- return False;
- }
-
- if (!NT_STATUS_IS_OK(pdb_init_sam_pw(&sam_pwent, pwd))) {
- fprintf(stderr, "Failed initialise SAM_ACCOUNT for user %s.\n", user_name);
- return False;
- }
-
- /* Get passwords */
- p++;
- if (*p == '*' || *p == 'X') {
- /* Password deliberately invalid */
- fprintf (stderr, "Warning: entry invalidated for user %s\n", user_name);
- pdb_set_lanman_passwd(sam_pwent, NULL);
- pdb_set_nt_passwd(sam_pwent,NULL);
- pdb_set_acct_ctrl(sam_pwent, pdb_get_acct_ctrl(sam_pwent) | ACB_DISABLED);
- } else {
- if (linebuf_len < (PTR_DIFF(p, linebuf) + 33)) {
- fprintf (stderr, "Error: malformed password entry at line %d (password too short)\n",line);
- pdb_free_sam (&sam_pwent);
- continue;
- }
- if (p[32] != ':') {
- fprintf (stderr, "Error: malformed password entry at line %d (no terminating :)\n",line);
- pdb_free_sam (&sam_pwent);
- continue;
- }
- if (!strncasecmp((char *) p, "NO PASSWORD", 11)) {
- pdb_set_lanman_passwd(sam_pwent, NULL);
- pdb_set_acct_ctrl(sam_pwent, pdb_get_acct_ctrl(sam_pwent) | ACB_PWNOTREQ);
- } else {
- if (!pdb_gethexpwd((char *)p, smbpwd)) {
- fprintf (stderr, "Error: malformed Lanman password entry at line %d (non hex chars)\n", line);
- pdb_free_sam (&sam_pwent);
- continue;
- }
- pdb_set_lanman_passwd(sam_pwent, smbpwd);
- }
- /* NT password */
- p += 33;
- if ((linebuf_len >= (PTR_DIFF(p, linebuf) + 33)) && (p[32] == ':')) {
- if (*p != '*' && *p != 'X') {
- if (pdb_gethexpwd((char *)p,smbntpwd)) {
- pdb_set_nt_passwd(sam_pwent, smbntpwd);
- }
- }
- p += 33;
- }
- }
-
- /* Get ACCT_CTRL field if any */
- if (*p == '[') {
- uint16 acct_ctrl;
- unsigned char *end_p = (unsigned char *)strchr_m((char *)p, ']');
-
- acct_ctrl = pdb_decode_acct_ctrl((char*)p);
- if (acct_ctrl)
- acct_ctrl = ACB_NORMAL;
-
- pdb_set_acct_ctrl(sam_pwent, acct_ctrl);
-
- /* Get last change time */
- if(end_p)
- p = end_p + 1;
- if(*p == ':') {
- p++;
- if(*p && (StrnCaseCmp((char *)p, "LCT-", 4)==0)) {
- int i;
-
- p += 4;
- for(i = 0; i < 8; i++) {
- if(p[i] == '\0' || !isxdigit(p[i])) break;
- }
- if(i == 8) {
- pdb_set_pass_last_set_time (sam_pwent, (time_t)strtol((char *)p, NULL, 16));
- }
- }
- }
- }
-
- /* Now ADD the entry */
- if (!(pdb_add_sam_account (sam_pwent))) {
- fprintf (stderr, "Unable to add user entry!\n");
- pdb_free_sam (&sam_pwent);
- continue;
- }
- printf ("%s imported!\n", user_name);
- good++;
- pdb_free_sam (&sam_pwent);
- }
- printf ("%d lines read.\n%d entryes imported\n", line, good);
- return 0;
+ return in->pdb_delete_sam_account (in, samaccount);
}
/*********************************************************
@@ -546,7 +370,7 @@ account without a valid local system user.\n", user_name);
int main (int argc, char **argv)
{
- int ch;
+ struct pdb_context *in;
BOOL list_users = False;
BOOL verbose = False;
BOOL spstyle = False;
@@ -555,93 +379,64 @@ int main (int argc, char **argv)
BOOL add_user = False;
BOOL delete_user = False;
BOOL import = False;
- char *user_name = NULL;
+ int opt;
char *full_name = NULL;
+ char *user_name = NULL;
char *home_dir = NULL;
char *home_drive = NULL;
+ char *backend_in = NULL;
+ char *backend_out = NULL;
char *logon_script = NULL;
char *profile_path = NULL;
- char *smbpasswd = NULL;
-
- setup_logging("pdbedit", True);
-
- if (argc < 2) {
- usage();
- return 0;
- }
+ poptContext pc;
+ struct poptOption long_options[] = {
+ POPT_AUTOHELP
+ {"list", 'l',POPT_ARG_VAL, &list_users, 1, "list all users", NULL},
+ {"verbose", 'v',POPT_ARG_VAL, &verbose, 1, "be verbose", NULL },
+ {"smbpasswd-style", 'w',POPT_ARG_VAL, &spstyle, 1, "give output in smbpasswd style", NULL},
+ {"user", 'u',POPT_ARG_STRING,&user_name, 0, "use username", "USER" },
+ {"fullname", 'f',POPT_ARG_STRING,&full_name, 0, "set full name", NULL},
+ {"homedir", 'h',POPT_ARG_STRING,&home_dir, 0, "set home directory", NULL},
+ {"drive", 'd',POPT_ARG_STRING,&home_drive, 0, "set home drive", NULL},
+ {"script", 's',POPT_ARG_STRING,&logon_script, 0, "set logon script", NULL},
+ {"profile", 'p',POPT_ARG_STRING,&profile_path, 0, "set profile path", NULL},
+ {"create", 'a',POPT_ARG_VAL,&add_user, 1, "create user", NULL},
+ {"machine", 'm',POPT_ARG_VAL,&machine, 1,"account is a machine account",NULL},
+ {"delete", 'x',POPT_ARG_VAL,&delete_user,1,"delete user",NULL},
+ {"import", 'i',POPT_ARG_STRING,&backend_in,0,"use different passdb backend",NULL},
+ {"export", 'e',POPT_ARG_STRING,&backend_out,0,"export user accounts to backend", NULL},
+ {"debuglevel",'D',POPT_ARG_INT,&DEBUGLEVEL,0,"set debuglevel",NULL},
+ {0,0,0,0}
+ };
DEBUGLEVEL = 1;
+ setup_logging("pdbedit", True);
AllowDebugChange = False;
-
+
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
dyn_CONFIGFILE);
exit(1);
}
-
- if(!initialize_password_db(True)) {
- fprintf(stderr, "Can't setup password database vectors.\n");
+
+ backend_in = lp_passdb_backend();
+
+ pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
+ POPT_CONTEXT_KEEP_FIRST);
+
+ while((opt = poptGetNextOpt(pc)) != -1);
+
+ setparms = (full_name || home_dir || home_drive || logon_script || profile_path);
+
+ if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) + (setparms?1:0)) + (backend_out?1:0) > 1) {
+ fprintf (stderr, "Incompatible options on command line!\n");
exit(1);
}
- while ((ch = getopt(argc, argv, "ad:f:h:i:lmp:s:u:vwxD:")) != EOF) {
- switch(ch) {
- case 'a':
- add_user = True;
- break;
- case 'm':
- machine = True;
- break;
- case 'l':
- list_users = True;
- break;
- case 'v':
- verbose = True;
- break;
- case 'w':
- spstyle = True;
- break;
- case 'u':
- user_name = optarg;
- break;
- case 'f':
- setparms = True;
- full_name = optarg;
- break;
- case 'h':
- setparms = True;
- home_dir = optarg;
- break;
- case 'd':
- setparms = True;
- home_drive = optarg;
- break;
- case 's':
- setparms = True;
- logon_script = optarg;
- break;
- case 'p':
- setparms = True;
- profile_path = optarg;
- break;
- case 'x':
- delete_user = True;
- break;
- case 'i':
- import = True;
- smbpasswd = optarg;
- break;
- case 'D':
- DEBUGLEVEL = atoi(optarg);
- break;
- default:
- usage();
- }
- }
- if (((add_user?1:0) + (delete_user?1:0) + (list_users?1:0) + (import?1:0) + (setparms?1:0)) > 1) {
- fprintf (stderr, "Incompatible options on command line!\n");
- usage();
- exit(1);
+
+ if(!NT_STATUS_IS_OK(make_pdb_context_name(&in, backend_in))){
+ fprintf(stderr, "Can't initialize %s.\n", backend_in);
+ return 1;
}
if (add_user) {
@@ -650,9 +445,9 @@ int main (int argc, char **argv)
return -1;
}
if (machine)
- return new_machine (user_name);
+ return new_machine (in, user_name);
else
- return new_user (user_name, full_name, home_dir, home_drive, logon_script, profile_path);
+ return new_user (in, user_name, full_name, home_dir, home_drive, logon_script, profile_path);
}
if (delete_user) {
@@ -661,32 +456,29 @@ int main (int argc, char **argv)
return -1;
}
if (machine)
- return delete_machine_entry (user_name);
+ return delete_machine_entry (in, user_name);
else
- return delete_user_entry (user_name);
+ return delete_user_entry (in, user_name);
}
if (user_name) {
if (setparms)
- set_user_info ( user_name, full_name,
+ return set_user_info (in, user_name, full_name,
home_dir,
home_drive,
logon_script,
profile_path);
else
- return print_user_info (user_name, verbose, spstyle);
-
- return 0;
+ return print_user_info (in, user_name, verbose, spstyle);
}
-
if (list_users)
- return print_users_list (verbose, spstyle);
+ return print_users_list (in, verbose, spstyle);
+
+ if (backend_out)
+ return export_database(in, backend_out);
- if (import)
- return import_users (smbpasswd);
+ poptPrintHelp(pc, stderr, 0);
- usage();
-
- return 0;
+ return 1;
}
--
cgit
From 163a855d26106ac9c6eaf945a31a6495204de990 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 09:35:52 +0000
Subject: Better handling of uid/gid -> RID and RID -> uid/gid code.
All uids and gids must create valid RIDs, becouse other code expects this, and
can't handle the failure case. (ACL code in particular)
Allow admins to adjust the base of the RID algorithm, so avoid clashes with
users brought in from NT (for example).
Put all the algorithm code back in one place, so that this change is global.
Better coping with NULL sid pointers - but it still breaks a lot of stuff.
BONUS: manpage entry for new paramater :-)
counter based rids for normal users in tdbsam is disabled for the timebeing,
idra and I will work out some things here soon I hope.
Andrew Bartlett
(This used to be commit 5275c94cdf0c64f347d4282f47088d084b1a7ea5)
---
docs/docbook/manpages/smb.conf.5.sgml | 21 ++++++++++++++++
source3/lib/util_sid.c | 17 +++++++++----
source3/param/loadparm.c | 5 ++++
source3/passdb/passdb.c | 44 ++++++++++++++++++----------------
source3/passdb/pdb_interface.c | 2 +-
source3/passdb/pdb_ldap.c | 26 ++++----------------
source3/passdb/pdb_smbpasswd.c | 28 ++++------------------
source3/passdb/pdb_tdb.c | 45 ++++++++++++++++++++++++++---------
source3/smbd/uid.c | 5 ++--
9 files changed, 108 insertions(+), 85 deletions(-)
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 1567087d9e..87f8a42895 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -596,6 +596,7 @@
add share command
add user script
add machine script
+ algorithmic rid base
allow trusted domains
announce as
announce version
@@ -1136,8 +1137,28 @@
hosts allow .
+
+ algorithmic rid base (G)
+ This determines if Samba how will use its
+ algorithmic mapping from uids/gid to the RIDs needed to construct
+ NT Security Identifiers.
+
+ Setting this option to a larger value could be useful to sites
+ transitioning from WinNT and Win2k, as existing user and
+ group rids would otherwise clash with sytem users etc.
+
+
+ All UIDs and GIDs must be able to be resolved into SIDs for
+ the correct operation of ACLs on the server. As such the algorithmic
+ mapping can't be 'turned off', but pushing it 'out of the way' should
+ resolve the issues. Users and groups can then be assigned 'low' RIDs
+ in arbitary-rid supporting backends.
+ Default: algorithmic rid base = 1000
+ Example: algorithmic rid base = 100000
+
+
allow trusted domains (G)
This option only takes effect when the = 2^32 */
- uint32 ia = (sid->id_auth[5]) +
- (sid->id_auth[4] << 8 ) +
- (sid->id_auth[3] << 16) +
- (sid->id_auth[2] << 24);
+ ia = (sid->id_auth[5]) +
+ (sid->id_auth[4] << 8 ) +
+ (sid->id_auth[3] << 16) +
+ (sid->id_auth[2] << 24);
slprintf(sidstr_out, sizeof(fstring) - 1, "S-%u-%lu", (unsigned int)sid->sid_rev_num, (unsigned long)ia);
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 462464d68f..39e7ce6e4f 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -151,6 +151,7 @@ typedef struct
char *szWinbindUID;
char *szWinbindGID;
char *szNonUnixAccountRange;
+ BOOL bAlgorithmicRidBase;
char *szTemplateHomedir;
char *szTemplateShell;
char *szWinbindSeparator;
@@ -725,6 +726,7 @@ static struct parm_struct parm_table[] = {
{"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, 0},
{"passdb backend", P_STRING, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, 0},
{"non unix account range", P_STRING, P_GLOBAL, &Globals.szNonUnixAccountRange, handle_non_unix_account_range, NULL, 0},
+ {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.bAlgorithmicRidBase, NULL, NULL, 0},
{"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
{"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
{"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, 0},
@@ -1277,6 +1279,8 @@ static void init_globals(void)
string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
string_set(&Globals.szPasswordServer, "*");
+ Globals.bAlgorithmicRidBase = BASE_RID;
+
Globals.bLoadPrinters = True;
Globals.max_packet = 65535;
Globals.mangled_stack = 50;
@@ -1796,6 +1800,7 @@ FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
FN_LOCAL_CHAR(lp_magicchar, magic_char)
FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
FN_GLOBAL_BOOL(lp_hide_local_users, &Globals.bHideLocalUsers)
+FN_GLOBAL_BOOL(lp_algorithmic_rid_base, &Globals.bAlgorithmicRidBase)
/* local prototypes */
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index 17aefe1159..d34866fa63 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -436,9 +436,10 @@ BOOL pdb_name_to_rid(const char *user_name, uint32 *u_rid, uint32 *g_rid)
Converts NT user RID to a UNIX uid.
********************************************************************/
-static uid_t fallback_pdb_user_rid_to_uid(uint32 user_rid)
+uid_t fallback_pdb_user_rid_to_uid(uint32 user_rid)
{
- return (uid_t)(((user_rid & (~USER_RID_TYPE))- 1000)/RID_MULTIPLIER);
+ int rid_offset = lp_algorithmic_rid_base();
+ return (uid_t)(((user_rid & (~USER_RID_TYPE))- rid_offset)/RID_MULTIPLIER);
}
@@ -446,9 +447,10 @@ static uid_t fallback_pdb_user_rid_to_uid(uint32 user_rid)
converts UNIX uid to an NT User RID.
********************************************************************/
-static uint32 fallback_pdb_uid_to_user_rid(uid_t uid)
+uint32 fallback_pdb_uid_to_user_rid(uid_t uid)
{
- return (((((uint32)uid)*RID_MULTIPLIER) + 1000) | USER_RID_TYPE);
+ int rid_offset = lp_algorithmic_rid_base();
+ return (((((uint32)uid)*RID_MULTIPLIER) + rid_offset) | USER_RID_TYPE);
}
/*******************************************************************
@@ -457,7 +459,8 @@ static uint32 fallback_pdb_uid_to_user_rid(uid_t uid)
gid_t pdb_group_rid_to_gid(uint32 group_rid)
{
- return (gid_t)(((group_rid & (~GROUP_RID_TYPE))- 1000)/RID_MULTIPLIER);
+ int rid_offset = lp_algorithmic_rid_base();
+ return (gid_t)(((group_rid & (~GROUP_RID_TYPE))- rid_offset)/RID_MULTIPLIER);
}
/*******************************************************************
@@ -470,7 +473,8 @@ gid_t pdb_group_rid_to_gid(uint32 group_rid)
uint32 pdb_gid_to_group_rid(gid_t gid)
{
- return (((((uint32)gid)*RID_MULTIPLIER) + 1000) | GROUP_RID_TYPE);
+ int rid_offset = lp_algorithmic_rid_base();
+ return (((((uint32)gid)*RID_MULTIPLIER) + rid_offset) | GROUP_RID_TYPE);
}
/*******************************************************************
@@ -479,7 +483,10 @@ uint32 pdb_gid_to_group_rid(gid_t gid)
static BOOL pdb_rid_is_well_known(uint32 rid)
{
- return (rid < 1000);
+ /* Not using rid_offset here, becouse this is the actual
+ NT fixed value (1000) */
+
+ return (rid < BASE_RID);
}
/*******************************************************************
@@ -817,13 +824,14 @@ BOOL local_sid_to_uid(uid_t *puid, DOM_SID *psid, enum SID_NAME_USE *name_type)
DEBUG(10,("local_sid_to_uid: SID %s -> uid (%u) (%s).\n", sid_to_string( str, psid),
(unsigned int)*puid, pdb_get_username(sam_user)));
} else {
- if (pdb_rid_is_user(rid)) {
+ if ((pdb_rid_is_user(rid))) {
*puid = fallback_pdb_user_rid_to_uid(rid);
DEBUG(10,("local_sid_to_uid: SID %s -> uid (%u) (non-passdb user).\n", sid_to_string( str, psid),
(unsigned int)*puid));
} else {
+ DEBUG(5,("local_sid_to_uid: SID %s not mapped becouse RID isn't a user.\n", sid_to_string( str, psid)));
pdb_free_sam(&sam_user);
- return False;
+ return False;
}
}
pdb_free_sam(&sam_user);
@@ -846,7 +854,7 @@ DOM_SID *local_gid_to_sid(DOM_SID *psid, gid_t gid)
if (get_group_map_from_gid(gid, &map, MAPPING_WITHOUT_PRIV)) {
sid_copy(psid, &map.sid);
- }
+ }
else {
sid_append_rid(psid, pdb_gid_to_group_rid(gid));
}
@@ -864,7 +872,6 @@ BOOL local_sid_to_gid(gid_t *pgid, DOM_SID *psid, enum SID_NAME_USE *name_type)
DOM_SID dom_sid;
uint32 rid;
fstring str;
- struct group *grp;
GROUP_MAP map;
*name_type = SID_NAME_UNKNOWN;
@@ -891,24 +898,19 @@ BOOL local_sid_to_gid(gid_t *pgid, DOM_SID *psid, enum SID_NAME_USE *name_type)
sid_peek_rid(&map.sid, &rid);
*pgid = map.gid;
*name_type = map.sid_name_use;
+ DEBUG(10,("local_sid_to_gid: mapped SID %s (%s) -> gid (%u).\n", sid_to_string( str, psid),
+ map.nt_name, (unsigned int)*pgid));
+
} else {
if (pdb_rid_is_user(rid))
return False;
*pgid = pdb_group_rid_to_gid(rid);
*name_type = SID_NAME_ALIAS;
+ DEBUG(10,("local_sid_to_gid: SID %s -> gid (%u).\n", sid_to_string( str, psid),
+ (unsigned int)*pgid));
}
- /*
- * Ensure this gid really does exist.
- */
-
- if(!(grp = getgrgid(*pgid)))
- return False;
-
- DEBUG(10,("local_sid_to_gid: SID %s -> gid (%u) (%s).\n", sid_to_string( str, psid),
- (unsigned int)*pgid, grp->gr_name ));
-
return True;
}
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index e454bf3c25..a19bf254e7 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -240,7 +240,7 @@ static NTSTATUS make_pdb_methods_name(struct pdb_methods **methods, struct pdb_c
{
DEBUG(5,("Found pdb backend %s (at pos %d)\n", module_name, i));
if (NT_STATUS_IS_OK(nt_status
- = builtin_pdb_init_functions[i].init(context, methods, module_location))) {
+ = builtin_pdb_init_functions[i].init(context, methods, module_location))) {
DEBUG(5,("pdb backend %s has a valid init\n", selected));
} else {
DEBUG(0,("pdb backend %s did not correctly init (error was %s)\n", selected, nt_errstr(nt_status)));
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index dc6b9f97ff..d0280269aa 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -71,24 +71,6 @@ struct ldapsam_privates {
static uint32 ldapsam_get_next_available_nua_rid(struct ldapsam_privates *ldap_state);
-/*******************************************************************
- Converts NT user RID to a UNIX uid.
- ********************************************************************/
-
-static uid_t pdb_user_rid_to_uid(uint32 user_rid)
-{
- return (uid_t)(((user_rid & (~USER_RID_TYPE))- 1000)/RID_MULTIPLIER);
-}
-
-/*******************************************************************
- converts UNIX uid to an NT User RID.
- ********************************************************************/
-
-static uint32 pdb_uid_to_user_rid(uid_t uid)
-{
- return (((((uint32)uid)*RID_MULTIPLIER) + 1000) | USER_RID_TYPE);
-}
-
/*******************************************************************
find the ldap password
******************************************************************/
@@ -347,7 +329,7 @@ static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
if (rc != LDAP_SUCCESS)
rc = ldapsam_search_one_user_by_uid(ldap_state, ldap_struct,
- pdb_user_rid_to_uid(rid),
+ fallback_user_rid_to_uid(rid),
result);
return rc;
@@ -754,7 +736,7 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
if ( pdb_get_user_rid(sampass) ) {
rid = pdb_get_user_rid(sampass);
} else if (IS_SAM_SET(sampass, FLAG_SAM_UID)) {
- rid = pdb_uid_to_user_rid(pdb_get_uid(sampass));
+ rid = fallback_uid_to_user_rid(pdb_get_uid(sampass));
} else if (ldap_state->permit_non_unix_accounts) {
rid = ldapsam_get_next_available_nua_rid(ldap_state);
if (rid == 0) {
@@ -1511,9 +1493,9 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method
return NT_STATUS_UNSUCCESSFUL;
}
- ldap_state->low_nua_rid=pdb_uid_to_user_rid(low_nua_uid);
+ ldap_state->low_nua_rid=fallback_uid_to_user_rid(low_nua_uid);
- ldap_state->high_nua_rid=pdb_uid_to_user_rid(high_nua_uid);
+ ldap_state->high_nua_rid=fallback_uid_to_user_rid(high_nua_uid);
return NT_STATUS_OK;
}
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 18c949c592..9f37cadfe8 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -69,24 +69,6 @@ struct smbpasswd_privates
enum pwf_access_type { PWF_READ, PWF_UPDATE, PWF_CREATE };
-/*******************************************************************
- Converts NT user RID to a UNIX uid.
- ********************************************************************/
-
-static uid_t pdb_user_rid_to_uid(uint32 user_rid)
-{
- return (uid_t)(((user_rid & (~USER_RID_TYPE))- 1000)/RID_MULTIPLIER);
-}
-
-/*******************************************************************
- converts UNIX uid to an NT User RID.
- ********************************************************************/
-
-static uint32 pdb_uid_to_user_rid(uid_t uid)
-{
- return (((((uint32)uid)*RID_MULTIPLIER) + 1000) | USER_RID_TYPE);
-}
-
/***************************************************************
Lock an fd. Abandon after waitsecs seconds.
****************************************************************/
@@ -1195,7 +1177,7 @@ static BOOL build_smb_pass (struct smb_passwd *smb_pw, const SAM_ACCOUNT *sampas
uid = pdb_get_uid(sampass);
/* If the user specified a RID, make sure its able to be both stored and retreived */
- if (rid && uid != pdb_user_rid_to_uid(rid)) {
+ if (rid && uid != fallback_pdb_user_rid_to_uid(rid)) {
DEBUG(0,("build_sam_pass: Failing attempt to store user with non-uid based user RID. \n"));
return False;
}
@@ -1249,7 +1231,7 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, SAM_AC
&& (pw_buf->smb_userid >= smbpasswd_state->low_nua_userid)
&& (pw_buf->smb_userid <= smbpasswd_state->high_nua_userid)) {
- pdb_set_user_rid(sam_pass, pdb_uid_to_user_rid (pw_buf->smb_userid));
+ pdb_set_user_rid(sam_pass, fallback_pdb_uid_to_user_rid (pw_buf->smb_userid));
/* lkclXXXX this is OBSERVED behaviour by NT PDCs, enforced here.
@@ -1269,7 +1251,7 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, SAM_AC
--jerry */
pwfile = getpwnam_alloc(pw_buf->smb_name);
if (pwfile == NULL) {
- DEBUG(0,("build_sam_account: smbpasswd database is corrupt! username %s not in unix passwd database!\n", pw_buf->smb_name));
+ DEBUG(0,("build_sam_account: smbpasswd database is corrupt! username %s with uid %u is not in unix passwd database!\n", pw_buf->smb_name, pw_buf->smb_userid));
return False;
}
@@ -1278,7 +1260,7 @@ static BOOL build_sam_account(struct smbpasswd_privates *smbpasswd_state, SAM_AC
pdb_set_fullname(sam_pass, pwfile->pw_gecos);
- pdb_set_user_rid(sam_pass, pdb_uid_to_user_rid (pwfile->pw_uid));
+ pdb_set_user_rid(sam_pass, fallback_pdb_uid_to_user_rid (pwfile->pw_uid));
if (get_group_map_from_gid(pwfile->pw_gid, &map, MAPPING_WITHOUT_PRIV)) {
sid_peek_rid(&map.sid, &grid);
@@ -1505,7 +1487,7 @@ static BOOL smbpasswd_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT *s
return False;
}
- while ( ((smb_pw=getsmbfilepwent(smbpasswd_state, fp)) != NULL) && (pdb_uid_to_user_rid(smb_pw->smb_userid) != rid) )
+ while ( ((smb_pw=getsmbfilepwent(smbpasswd_state, fp)) != NULL) && (fallback_pdb_uid_to_user_rid(smb_pw->smb_userid) != rid) )
/* do nothing */ ;
endsmbfilepwent(fp, &(smbpasswd_state->pw_file_lock_depth));
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 7092caa15e..3a9bc894bb 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -41,8 +41,10 @@ struct tdbsam_privates {
BOOL permit_non_unix_accounts;
-/* uint32 low_nua_rid;
- uint32 high_nua_rid; */
+ BOOL algorithmic_rids;
+
+ uint32 low_nua_rid;
+ uint32 high_nua_rid;
};
/**********************************************************************
@@ -717,7 +719,7 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, const SAM_ACCOUNT* ne
fstring name;
BOOL ret = True;
uint32 user_rid;
- int32 tdb_ret;
+ BOOL tdb_ret;
/* invalidate the existing TDB iterator if it is open */
if (tdb_state->passwd_tdb) {
@@ -736,13 +738,32 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, const SAM_ACCOUNT* ne
/* if flag == TDB_INSERT then make up a new RID else throw an error. */
if (!(user_rid = pdb_get_user_rid(newpwd))) {
if (flag & TDB_INSERT) {
- user_rid = BASE_RID;
- tdb_ret = tdb_change_int32_atomic(pwd_tdb, "RID_COUNTER", &user_rid, RID_MULTIPLIER);
- if (tdb_ret == -1) {
- ret = False;
- goto done;
+ if (IS_SAM_UNIX_USER(newpwd)) {
+ if (tdb_state->algorithmic_rids) {
+ user_rid = fallback_pdb_uid_to_user_rid(pdb_get_uid(newpwd));
+ } else {
+ user_rid = BASE_RID;
+ tdb_ret = tdb_change_uint32_atomic(pwd_tdb, "RID_COUNTER", &user_rid, RID_MULTIPLIER);
+ if (!tdb_ret) {
+ ret = False;
+ goto done;
+ }
+ }
+ pdb_set_user_rid(newpwd, user_rid);
+ } else {
+ user_rid = tdb_state->low_nua_rid;
+ tdb_ret = tdb_change_uint32_atomic(pwd_tdb, "NUA_RID_COUNTER", &user_rid, RID_MULTIPLIER);
+ if (!tdb_ret) {
+ ret = False;
+ goto done;
+ }
+ if (user_rid > tdb_state->high_nua_rid) {
+ DEBUG(0, ("tdbsam: no NUA rids available, cannot add user %s!\n", pdb_get_username(newpwd)));
+ ret = False;
+ goto done;
+ }
+ pdb_set_user_rid(newpwd, user_rid);
}
- pdb_set_user_rid(newpwd, user_rid);
} else {
DEBUG (0,("tdb_update_sam: Failing to store a SAM_ACCOUNT for [%s] without a RID\n",pdb_get_username(newpwd)));
ret = False;
@@ -884,6 +905,8 @@ NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, con
tdb_state->tdbsam_location = talloc_strdup(pdb_context->mem_ctx, tdbfile);
}
+ tdb_state->algorithmic_rids = True;
+
(*pdb_method)->private_data = tdb_state;
(*pdb_method)->free_private_data = free_private_data;
@@ -912,10 +935,10 @@ NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
return NT_STATUS_UNSUCCESSFUL;
}
-/* tdb_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
+ tdb_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
tdb_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
-*/
+
return NT_STATUS_OK;
}
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index ac0b535c13..8b0ffbd73f 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -521,7 +521,7 @@ BOOL lookup_sid(DOM_SID *sid, fstring dom_name, fstring name, enum SID_NAME_USE
sid_copy(&tmp_sid, sid);
sid_split_rid(&tmp_sid, &rid);
return map_domain_sid_to_name(&tmp_sid, dom_name) &&
- lookup_known_rid(&tmp_sid, rid, name, name_type);
+ lookup_known_rid(&tmp_sid, rid, name, name_type);
}
return True;
}
@@ -578,7 +578,8 @@ DOM_SID *gid_to_sid(DOM_SID *psid, gid_t gid)
}
}
- local_gid_to_sid(psid, gid);
+ /* Make sure we report failure, (when psid == NULL) */
+ psid = local_gid_to_sid(psid, gid);
DEBUG(10,("gid_to_sid: local %u -> %s\n", (unsigned int)gid, sid_to_string(sid, psid)));
--
cgit
From a88ff199bcf9a140cec482cf04578cb1b897877a Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 10:32:09 +0000
Subject: More updates from ctrlsoft. (Jelmer Vernooij )
Andrew Bartlett
(This used to be commit 012b3326c40ca0f8f4c7673310d73f695cc4f79b)
---
docs/docbook/manpages/smb.conf.5.sgml | 12 +++++------
source3/utils/pdbedit.c | 40 ++++++++++++++++++++++++++++-------
2 files changed, 38 insertions(+), 14 deletions(-)
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 87f8a42895..4427129574 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -5085,10 +5085,10 @@
passdb backend (G)
- This option allows the administrator to chose what
- backend in which to store passwords. This allows (for example) both
- smbpasswd and tdbsam to be used without a recompile. Only one can
- be used at a time however, and experimental backends must still be selected
+ This option allows the administrator to chose which backends to retrieve and store passwords with. This allows (for example) both
+ smbpasswd and tdbsam to be used without a recompile.
+ Multiple backends can be specified, seperated by spaces. The backends will be searched in the order they are specified. New users are always added to the first backend specified.
+ Experimental backends must still be selected
(eg --with-tdbsam) at configure time.
@@ -5141,9 +5141,9 @@
Default: passdb backend = smbpasswd
- Example: passdb backend = tdbsam:/etc/samba/private/passdb.tdb
+ Example: passdb backend = tdbsam:/etc/samba/private/passdb.tdb smbpasswd:/etc/samba/smbpasswd
Example: passdb backend = ldapsam_nua:ldaps://ldap.example.com
- Example: passdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args
+ Example: passdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args tdbsam:/etc/samba/private/passdb.tdb
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 421a72923a..c63ed29529 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -70,24 +70,48 @@ static int print_sam_info (SAM_ACCOUNT *sam_pwent, BOOL verbosity, BOOL smbpwdst
{
uid_t uid;
gid_t gid;
+ time_t tmp;
/* TODO: chaeck if entry is a user or a workstation */
if (!sam_pwent) return -1;
if (verbosity) {
- printf ("username: %s\n", pdb_get_username(sam_pwent));
+ printf ("Unix/NT username: %s/%s\n", pdb_get_username(sam_pwent),pdb_get_nt_username(sam_pwent));
if (IS_SAM_UNIX_USER(sam_pwent)) {
uid = pdb_get_uid(sam_pwent);
gid = pdb_get_gid(sam_pwent);
- printf ("user ID/Group: %d/%d\n", uid, gid);
+ printf ("user ID/Group: %d/%d\n", uid, gid);
}
- printf ("user RID/GRID: %u/%u\n", (unsigned int)pdb_get_user_rid(sam_pwent),
+ printf ("user RID/GRID: %u/%u\n", (unsigned int)pdb_get_user_rid(sam_pwent),
(unsigned int)pdb_get_group_rid(sam_pwent));
- printf ("Full Name: %s\n", pdb_get_fullname(sam_pwent));
- printf ("Home Directory: %s\n", pdb_get_homedir(sam_pwent));
- printf ("HomeDir Drive: %s\n", pdb_get_dirdrive(sam_pwent));
- printf ("Logon Script: %s\n", pdb_get_logon_script(sam_pwent));
- printf ("Profile Path: %s\n", pdb_get_profile_path(sam_pwent));
+ printf ("Full Name: %s\n", pdb_get_fullname(sam_pwent));
+ printf ("Home Directory: %s\n", pdb_get_homedir(sam_pwent));
+ printf ("HomeDir Drive: %s\n", pdb_get_dirdrive(sam_pwent));
+ printf ("Logon Script: %s\n", pdb_get_logon_script(sam_pwent));
+ printf ("Profile Path: %s\n", pdb_get_profile_path(sam_pwent));
+ printf ("Domain: %s\n", pdb_get_domain(sam_pwent));
+ printf ("Account desc: %s\n", pdb_get_acct_desc(sam_pwent));
+ printf ("Workstations: %s\n", pdb_get_workstations(sam_pwent));
+ printf ("Munged dial: %s\n", pdb_get_munged_dial(sam_pwent));
+
+ tmp = pdb_get_logon_time(sam_pwent);
+ printf ("Logon time: %s\n", tmp ? http_timestring(tmp) : "0");
+
+ tmp = pdb_get_logoff_time(sam_pwent);
+ printf ("Logoff time: %s\n", tmp ? http_timestring(tmp) : "0");
+
+ tmp = pdb_get_kickoff_time(sam_pwent);
+ printf ("Kickoff time: %s\n", tmp ? http_timestring(tmp) : "0");
+
+ tmp = pdb_get_pass_last_set_time(sam_pwent);
+ printf ("Password last set: %s\n", tmp ? http_timestring(tmp) : "0");
+
+ tmp = pdb_get_pass_can_change_time(sam_pwent);
+ printf ("Password can change: %s\n", tmp ? http_timestring(tmp) : "0");
+
+ tmp = pdb_get_pass_must_change_time(sam_pwent);
+ printf ("Password must change: %s\n", tmp ? http_timestring(tmp) : "0");
+
} else if (smbpwdstyle) {
if (IS_SAM_UNIX_USER(sam_pwent)) {
char lm_passwd[33];
--
cgit
From 076ba6981a9d83f7b45f6d8510e5aa86b3ede5a6 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 10:36:20 +0000
Subject: Doco update from Hasch@t-online.de (Juergen Hasch) (This used to be
commit 1650bc969fbd36a02758fafd9addc66ea715e835)
---
docs/docbook/manpages/smb.conf.5.sgml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 4427129574..9ac0124a12 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -5721,6 +5721,8 @@
linkend="PRINTERSSECT">[printers] section above for reasons
why you might want to do this.
+ To use the CUPS printing interface set printcap name = cups
+ .
On System V systems that use lpstat to
list available printers you can use printcap name = lpstat
to automatically obtain lists of available printers. This
--
cgit
From a0152895897c68e3f9c665320699fb2e0da4a1a3 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 10:48:25 +0000
Subject: Fix the compile-bug in pdb_ldap from my last patch.
Andrew Bartlett
(This used to be commit 81eaa7924b7bd3a13d049bce7fe7a16ab9174364)
---
source3/passdb/pdb_ldap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index d0280269aa..c4f95dcdee 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -329,7 +329,7 @@ static int ldapsam_search_one_user_by_rid (struct ldapsam_privates *ldap_state,
if (rc != LDAP_SUCCESS)
rc = ldapsam_search_one_user_by_uid(ldap_state, ldap_struct,
- fallback_user_rid_to_uid(rid),
+ fallback_pdb_user_rid_to_uid(rid),
result);
return rc;
@@ -736,7 +736,7 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
if ( pdb_get_user_rid(sampass) ) {
rid = pdb_get_user_rid(sampass);
} else if (IS_SAM_SET(sampass, FLAG_SAM_UID)) {
- rid = fallback_uid_to_user_rid(pdb_get_uid(sampass));
+ rid = fallback_pdb_uid_to_user_rid(pdb_get_uid(sampass));
} else if (ldap_state->permit_non_unix_accounts) {
rid = ldapsam_get_next_available_nua_rid(ldap_state);
if (rid == 0) {
@@ -1493,9 +1493,9 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method
return NT_STATUS_UNSUCCESSFUL;
}
- ldap_state->low_nua_rid=fallback_uid_to_user_rid(low_nua_uid);
+ ldap_state->low_nua_rid=fallback_pdb_uid_to_user_rid(low_nua_uid);
- ldap_state->high_nua_rid=fallback_uid_to_user_rid(high_nua_uid);
+ ldap_state->high_nua_rid=fallback_pdb_uid_to_user_rid(high_nua_uid);
return NT_STATUS_OK;
}
--
cgit
From d0821f99a693cf9aef8c50d2639c5ca772becae1 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 10:52:31 +0000
Subject: Patch for arbitary smb.conf paramaters (to make the life of plugin
maintainers sane) from ab.
Attached is his e-mail to the samba-technical list, as it describes it rather
well:
Andrew Bartlett
Subject:
[PATCH] Parametrical options support for Samba 3.0
Date:
Fri, 12 Apr 2002 19:13:13 +0300
From:
Alexander Bokovoy
To:
samba-technical@samba.org
CC:
tridge@samba.org
Greetings!
Attached patch makes possible arbitrary options to be specified in
smb.conf and later queried from VFS modules (and other places)
without problems. Below such options are called 'parametrical options'.
Patch introduces new notation to smb.conf option's language, as discussed
today with Tridgell on @samba-technical:
TYPE: OPTION = VALUE
Colon sign is important here, it is what distinguishes parametrical
options from ones hardcoded in param/loadparm.c.
TYPE is 'option domain', OPTION is option name itself.
In order to access values of parametrical options, lp_parm_string()
function was implemented:
char *lp_parm_string(const char *servicename, const char *type, const char
*option);
This function accepts service name, type and option name, and returns
value of option or NULL if this option is underfined. Service name can be
NULL, resulting in search in 'global' section only.
If option does not exist in specified service, 'global' section is
scanned. This allows propagation of globally specified options to all
services and later overloading of the option in some services.
Caution: 'TYPE: OPTION' combination is case sensitive.
So far, testparm is able to handle parametrical options, while SWAT
can't. Thus, everyone familiar with SWAT internals is welcomed to add
parametrical options support.
(This used to be commit bfd7cd43556bed3131d0d18869abfd1cbc30bcd0)
---
source3/param/loadparm.c | 116 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 112 insertions(+), 4 deletions(-)
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 39e7ce6e4f..17b9f022f0 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -6,6 +6,7 @@
Largely re-written by Andrew Tridgell, September 1994
Copyright (C) Simo Sorce 2001
+ Copyright (C) Alexander Bokovoy 2002
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
@@ -1802,6 +1803,48 @@ FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
FN_GLOBAL_BOOL(lp_hide_local_users, &Globals.bHideLocalUsers)
FN_GLOBAL_BOOL(lp_algorithmic_rid_base, &Globals.bAlgorithmicRidBase)
+typedef struct _param_opt_struct param_opt_struct;
+struct _param_opt_struct {
+ char *key;
+ char *value;
+ param_opt_struct *prev, *next;
+};
+
+static param_opt_struct *param_opt = NULL;
+
+/* Return parametric option from given service. Type is a part of option before ':' */
+/* Parametric option has following syntax: 'Type: option = value' */
+/* Returned value is allocated in 'lp_talloc' context */
+char *lp_parm_string(const char *servicename, const char *type, const char *option)
+{
+ param_opt_struct *data;
+ pstring vfskey;
+
+ if (param_opt != NULL) {
+ ZERO_STRUCT(vfskey);
+ pstr_sprintf(vfskey, "%s:%s:%s", (servicename==NULL) ? "global" : servicename,
+ type, option);
+ data = param_opt;
+ while (data) {
+ if (strcmp(data->key, vfskey) == 0) {
+ return lp_string(data->value);
+ }
+ data = data->next;
+ }
+ /* Try to fetch the same option but from globals */
+ pstr_sprintf(vfskey, "global:%s:%s", type, option);
+ data = param_opt;
+ while (data) {
+ if (strcmp(data->key, vfskey) == 0) {
+ return lp_string(data->value);
+ }
+ data = data->next;
+ }
+
+ }
+ return NULL;
+}
+
/* local prototypes */
static int map_parameter(char *pszParmName);
@@ -2054,7 +2097,12 @@ static int map_parameter(char *pszParmName)
if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
return (iIndex);
- DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
+ /* Warn only if it isn't parametric option */
+ if (strchr(pszParmName, ':') == NULL)
+ DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
+ /* We do return 'fail' for parametric options as well because they are
+ stored in different storage
+ */
return (-1);
}
@@ -2780,14 +2828,32 @@ then assume we are in the globals
***************************************************************************/
BOOL lp_do_parameter(int snum, char *pszParmName, char *pszParmValue)
{
- int parmnum, i;
+ int parmnum, i, slen;
void *parm_ptr = NULL; /* where we are going to store the result */
void *def_ptr = NULL;
+ pstring vfskey;
+ char *sep;
+ param_opt_struct *paramo;
parmnum = map_parameter(pszParmName);
if (parmnum < 0)
{
+ if ((sep=strchr(pszParmName, ':')) != NULL) {
+ *sep = 0;
+ ZERO_STRUCT(vfskey);
+ pstr_sprintf(vfskey, "%s:%s:",
+ (snum >= 0) ? lp_servicename(snum) : "global", pszParmName);
+ slen = strlen(vfskey);
+ safe_strcat(vfskey, sep+1, sizeof(pstring));
+ trim_string(vfskey+slen, " ", " ");
+ paramo = smb_xmalloc(sizeof(param_opt_struct));
+ paramo->key = strdup(vfskey);
+ paramo->value = strdup(pszParmValue);
+ DLIST_ADD(param_opt, paramo);
+ *sep = ':';
+ return (True);
+ }
DEBUG(0,
("Ignoring unknown parameter \"%s\"\n", pszParmName));
return (True);
@@ -3147,6 +3213,9 @@ Display the contents of the global structure.
static void dump_globals(FILE *f)
{
int i;
+ param_opt_struct *data;
+ char *s;
+
fprintf(f, "# Global parameters\n[global]\n");
for (i = 0; parm_table[i].label; i++)
@@ -3160,6 +3229,17 @@ static void dump_globals(FILE *f)
print_parameter(&parm_table[i], parm_table[i].ptr, f);
fprintf(f, "\n");
}
+ if (param_opt != NULL) {
+ data = param_opt;
+ while(data) {
+ if (((s=strstr(data->key, "global")) == data->key) &&
+ (*(s+strlen("global")) == ':')) {
+ fprintf(f, "\t%s = %s\n", s+strlen("global")+1, data->value);
+ }
+ data = data->next;
+ }
+ }
+
}
/***************************************************************************
@@ -3174,13 +3254,15 @@ BOOL lp_is_default(int snum, struct parm_struct *parm)
((char *)&sDefault) + pdiff);
}
-
/***************************************************************************
Display the contents of a single services record.
***************************************************************************/
static void dump_a_service(service * pService, FILE * f)
{
int i;
+ param_opt_struct *data;
+ char *s, *sn;
+
if (pService != &sDefault)
fprintf(f, "\n[%s]\n", pService->szService);
@@ -3212,6 +3294,17 @@ static void dump_a_service(service * pService, FILE * f)
((char *)pService) + pdiff, f);
fprintf(f, "\n");
}
+ if (param_opt != NULL) {
+ data = param_opt;
+ sn = (pService == &sDefault) ? "global" : pService->szService;
+ while(data) {
+ if (((s=strstr(data->key, sn)) == data->key) &&
+ (*(s+strlen(sn)) == ':')) {
+ fprintf(f, "\t%s = %s\n", s+strlen(sn)+1, data->value);
+ }
+ data = data->next;
+ }
+ }
}
@@ -3492,6 +3585,7 @@ static void set_server_role(void)
}
+
/***************************************************************************
Load the services array from the services file. Return True on success,
False on failure.
@@ -3501,6 +3595,7 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
{
pstring n2;
BOOL bRetval;
+ param_opt_struct *data, *pdata;
pstrcpy(n2, pszFname);
standard_sub_basic(current_user_info.smb_name, n2);
@@ -3509,6 +3604,8 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
bRetval = False;
+ DEBUG(3, ("lp_load: refreshing parmaters\n"));
+
bInGlobalSection = True;
bGlobalOnly = global_only;
@@ -3520,6 +3617,18 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
lp_save_defaults();
}
+ if (param_opt != NULL) {
+ data = param_opt;
+ while (data) {
+ SAFE_FREE(data->key);
+ SAFE_FREE(data->value);
+ pdata = data->next;
+ SAFE_FREE(data);
+ data = pdata;
+ }
+ param_opt = NULL;
+ }
+
/* We get sections first, so have to start 'behind' to make up */
iServiceIndex = -1;
bRetval = pm_process(n2, do_section, do_parameter);
@@ -3553,7 +3662,6 @@ BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
return (bRetval);
}
-
/***************************************************************************
reset the max number of services
***************************************************************************/
--
cgit
From 81408df9cf23c50756deb3b61c9e00fb762edd60 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 11:45:33 +0000
Subject: Fix the build on platforms that use our internal popt. (This used to
be commit 3261a210dd0f89e3a8b8524747fa182bcc84bf9f)
---
source3/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 476997512f..ae89778288 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -640,7 +640,7 @@ bin/smbpasswd: $(SMBPASSWD_OBJ) bin/.dummy
bin/pdbedit: $(PDBEDIT_OBJ) bin/.dummy
@echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS)
+ @$(CC) $(FLAGS) -o $@ $(PDBEDIT_OBJ) $(LDFLAGS) $(DYNEXP) $(LIBS) @BUILD_POPT@
bin/smbgroupedit: $(SMBGROUPEDIT_OBJ) bin/.dummy
@echo Linking $@
--
cgit
From 7897bf73679a8fb85790ed093d75119c3a9c75fa Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sat, 13 Apr 2002 13:30:06 +0000
Subject: two time handling bugfixes
- the pending mtime overrides the current file time in setfileinfo
- a later wtime can override a mtime on setfileinfo
this fixes the date of file copies in win2000
(This used to be commit 79630bb2c0a99c961a0a1c67223899e39685ee2c)
---
source3/smbd/trans2.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index adae7e0b3c..b46d1e930c 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -2049,6 +2049,11 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
SSVAL(params,0,0);
+ if (fsp) {
+ /* the pending modtime overrides the current modtime */
+ sbuf.st_mtime = fsp->pending_modtime;
+ }
+
size = sbuf.st_size;
tvs.modtime = sbuf.st_mtime;
tvs.actime = sbuf.st_atime;
@@ -2110,6 +2115,9 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
tvs.modtime = MIN(write_time, changed_time);
+ if (write_time > tvs.modtime && write_time != 0xffffffff) {
+ tvs.modtime = write_time;
+ }
/* Prefer a defined time to an undefined one. */
if (tvs.modtime == (time_t)0 || tvs.modtime == (time_t)-1)
tvs.modtime = (write_time == (time_t)0 || write_time == (time_t)-1
@@ -2264,7 +2272,7 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
* NT does this a lot. It's actually pointless
* setting the time here, as it will be overwritten
* on the next write, so we save the request
- * away and will set it on file code. JRA.
+ * away and will set it on file close. JRA.
*/
if (tvs.modtime != (time_t)0 && tvs.modtime != (time_t)-1) {
--
cgit
From 35e8d461e9c35b972b9d6b264853be1608acc62a Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sat, 13 Apr 2002 22:52:28 +0000
Subject: As always, vance looks after the grammer... :-) (This used to be
commit 206f1158bd059de9bf4290935d131f42e4639f99)
---
docs/docbook/manpages/smb.conf.5.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 9ac0124a12..2adab907dc 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -1139,7 +1139,7 @@
algorithmic rid base (G)
- This determines if Samba how will use its
+ This determines how Samba will use its
algorithmic mapping from uids/gid to the RIDs needed to construct
NT Security Identifiers.
--
cgit
From 8d994f432d34a7e81335c3be05aa40f1e227636c Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 00:58:16 +0000
Subject: Moved open_pipe_creds() function to common file. (This used to be
commit 14e4d889a236dd9c2ba6db68b3133e44195b8a47)
---
source3/python/py_common.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++
source3/python/py_common.h | 13 +++++++-
2 files changed, 90 insertions(+), 1 deletion(-)
diff --git a/source3/python/py_common.c b/source3/python/py_common.c
index bc3153c26c..019bcca07c 100644
--- a/source3/python/py_common.c
+++ b/source3/python/py_common.c
@@ -21,6 +21,8 @@
#include "includes.h"
#include "Python.h"
+#include "python/py_common.h"
+
/* Return a tuple of (error code, error string) from a WERROR */
PyObject *py_werror_tuple(WERROR werror)
@@ -115,3 +117,79 @@ PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw)
Py_INCREF(Py_None);
return Py_None;
}
+
+struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
+ cli_pipe_fn *connect_fn,
+ struct cli_state *cli)
+{
+ struct ntuser_creds nt_creds;
+
+ if (!cli) {
+ cli = (struct cli_state *)malloc(sizeof(struct cli_state));
+ if (!cli)
+ return NULL;
+ }
+
+ ZERO_STRUCTP(cli);
+
+ /* Extract credentials from the python dictionary and initialise
+ the ntuser_creds struct from them. */
+
+ ZERO_STRUCT(nt_creds);
+ nt_creds.pwd.null_pwd = True;
+
+ if (creds && PyDict_Size(creds) > 0) {
+ char *username, *password, *domain;
+ PyObject *username_obj, *password_obj, *domain_obj;
+
+ /* Check credentials passed are valid. This means the
+ username, domain and password keys must exist and be
+ string objects. */
+
+ username_obj = PyDict_GetItemString(creds, "username");
+ domain_obj = PyDict_GetItemString(creds, "domain");
+ password_obj = PyDict_GetItemString(creds, "password");
+
+ if (!username_obj || !domain_obj || !password_obj) {
+ error:
+
+ /* TODO: Either pass in the exception for the
+ module calling open_pipe_creds() or have a
+ global samba python module exception. */
+
+ PyErr_SetString(PyExc_RuntimeError,
+ "invalid credentials");
+ return NULL;
+ }
+
+ if (!PyString_Check(username_obj) ||
+ !PyString_Check(domain_obj) ||
+ !PyString_Check(password_obj))
+ goto error;
+
+ username = PyString_AsString(username_obj);
+ domain = PyString_AsString(domain_obj);
+ password = PyString_AsString(password_obj);
+
+ if (!username || !domain || !password)
+ goto error;
+
+ /* Initialise nt_creds structure with passed creds */
+
+ fstrcpy(nt_creds.user_name, username);
+ fstrcpy(nt_creds.domain, domain);
+
+ if (lp_encrypted_passwords())
+ pwd_make_lm_nt_16(&nt_creds.pwd, password);
+ else
+ pwd_set_cleartext(&nt_creds.pwd, password);
+
+ nt_creds.pwd.null_pwd = False;
+ }
+
+ /* Now try to connect */
+
+ connect_fn(cli, system_name, &nt_creds);
+
+ return cli;
+}
diff --git a/source3/python/py_common.h b/source3/python/py_common.h
index 4a5c92ca8c..45ad5c422d 100644
--- a/source3/python/py_common.h
+++ b/source3/python/py_common.h
@@ -27,8 +27,19 @@ void py_samba_init(void);
PyObject *py_werror_tuple(WERROR werror);
PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
-PyObject *py_setup_logging(PyObject *self, PyObject *args);
+PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
PyObject *get_debuglevel(PyObject *self, PyObject *args);
PyObject *set_debuglevel(PyObject *self, PyObject *args);
+/* Return a cli_state struct opened on the SPOOLSS pipe. If credentials
+ are passed use them. */
+
+typedef struct cli_state *(cli_pipe_fn)(
+ struct cli_state *cli, char *system_name,
+ struct ntuser_creds *creds);
+
+struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
+ cli_pipe_fn *connect_fn,
+ struct cli_state *cli);
+
#endif /* _PY_COMMON_H */
--
cgit
From 54bda76922cb14579bb363135da8862982d22925 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 00:59:50 +0000
Subject: More open_pipe_creds() refactoring. (This used to be commit
7f2c814237f1df7008c9a91b7cf3b1de01e6ed87)
---
source3/python/py_lsa.c | 82 ++++++++++++++++++++++++++++++++-------
source3/python/py_spoolss.c | 70 ---------------------------------
source3/python/py_spoolss.h | 7 ----
source3/python/py_spoolss_proto.h | 3 --
4 files changed, 68 insertions(+), 94 deletions(-)
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index dfb9b642ed..5e805a91ad 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -1,19 +1,12 @@
#include "includes.h"
#include "Python.h"
-#include "python/py_common.h"
+#include "python/py_lsa.h"
static void py_policy_hnd_dealloc(PyObject* self)
{
PyObject_Del(self);
}
-typedef struct {
- PyObject_HEAD
- struct cli_state *cli;
- TALLOC_CTX *mem_ctx;
- POLICY_HND pol;
-} lsa_policy_hnd_object;
-
PyTypeObject lsa_policy_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
@@ -32,6 +25,20 @@ PyTypeObject lsa_policy_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ lsa_policy_hnd_object *o;
+
+ o = PyObject_New(lsa_policy_hnd_object, &lsa_policy_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
/*
* Exceptions raised by this module
*/
@@ -52,23 +59,70 @@ static PyObject *lsa_openpolicy(PyObject *self, PyObject *args,
{
static char *kwlist[] = { "servername", "creds", "access", NULL };
char *server_name;
- PyObject *creds = NULL;
+ PyObject *creds = NULL, *result;
uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
+ struct cli_state *cli;
+ NTSTATUS ntstatus;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND hnd;
if (!PyArg_ParseTupleAndKeywords(
args, kw, "s|O!i", kwlist, &server_name, &PyDict_Type,
- &creds, &desired_access)) {
+ &creds, &desired_access))
+ return NULL;
- goto done;
+ if (!(cli = open_pipe_creds(server_name, creds, cli_lsa_initialise,
+ NULL))) {
+ fprintf(stderr, "could not initialise cli state\n");
+ return NULL;
}
- done:
- return NULL;
+ if (!(mem_ctx = talloc_init())) {
+ fprintf(stderr, "unable to initialise talloc context\n");
+ return NULL;
+ }
+
+ ntstatus = cli_lsa_open_policy(cli, mem_ctx, True,
+ SEC_RIGHTS_MAXIMUM_ALLOWED, &hnd);
+
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ cli_shutdown(cli);
+ SAFE_FREE(cli);
+ PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus));
+ return NULL;
+ }
+
+ result = new_lsa_policy_hnd_object(cli, mem_ctx, &hnd);
+
+ return result;
}
static PyObject *lsa_close(PyObject *self, PyObject *args, PyObject *kw)
{
- return NULL;
+ PyObject *po;
+ lsa_policy_hnd_object *hnd;
+ NTSTATUS result;
+
+ /* Parse parameters */
+
+ if (!PyArg_ParseTuple(args, "O!", &lsa_policy_hnd_type, &po))
+ return NULL;
+
+ hnd = (lsa_policy_hnd_object *)po;
+
+ /* Call rpc function */
+
+ result = cli_lsa_close(hnd->cli, hnd->mem_ctx, &hnd->pol);
+
+ /* Cleanup samba stuf */
+
+ cli_shutdown(hnd->cli);
+ talloc_destroy(hnd->mem_ctx);
+
+ /* Return value */
+
+ Py_INCREF(Py_None);
+ return Py_None;
}
static PyObject *lsa_lookupnames(PyObject *self, PyObject *args,
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index ead54febda..450abbd6dc 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -28,76 +28,6 @@ PyObject *spoolss_error, *spoolss_werror;
* Routines to convert from python hashes to Samba structures
*/
-struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
- cli_pipe_fn *connect_fn,
- struct cli_state *cli)
-{
- struct ntuser_creds nt_creds;
-
- if (!cli) {
- cli = (struct cli_state *)malloc(sizeof(struct cli_state));
- if (!cli)
- return NULL;
- }
-
- ZERO_STRUCTP(cli);
-
- /* Extract credentials from the python dictionary and initialise
- the ntuser_creds struct from them. */
-
- ZERO_STRUCT(nt_creds);
- nt_creds.pwd.null_pwd = True;
-
- if (creds && PyDict_Size(creds) > 0) {
- char *username, *password, *domain;
- PyObject *username_obj, *password_obj, *domain_obj;
-
- /* Check credentials passed are valid. This means the
- username, domain and password keys must exist and be
- string objects. */
-
- username_obj = PyDict_GetItemString(creds, "username");
- domain_obj = PyDict_GetItemString(creds, "domain");
- password_obj = PyDict_GetItemString(creds, "password");
-
- if (!username_obj || !domain_obj || !password_obj) {
- error:
- PyErr_SetString(spoolss_error, "invalid credentials");
- return NULL;
- }
-
- if (!PyString_Check(username_obj) ||
- !PyString_Check(domain_obj) ||
- !PyString_Check(password_obj))
- goto error;
-
- username = PyString_AsString(username_obj);
- domain = PyString_AsString(domain_obj);
- password = PyString_AsString(password_obj);
-
- if (!username || !domain || !password)
- goto error;
-
- /* Initialise nt_creds structure with passed creds */
-
- fstrcpy(nt_creds.user_name, username);
- fstrcpy(nt_creds.domain, domain);
-
- if (lp_encrypted_passwords())
- pwd_make_lm_nt_16(&nt_creds.pwd, password);
- else
- pwd_set_cleartext(&nt_creds.pwd, password);
-
- nt_creds.pwd.null_pwd = False;
- }
-
- /* Now try to connect */
-
- connect_fn(cli, system_name, &nt_creds);
-
- return cli;
-}
-
PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol)
{
diff --git a/source3/python/py_spoolss.h b/source3/python/py_spoolss.h
index 7c7669c752..777a2b5991 100644
--- a/source3/python/py_spoolss.h
+++ b/source3/python/py_spoolss.h
@@ -41,13 +41,6 @@ extern PyTypeObject spoolss_policy_hnd_type;
extern PyObject *spoolss_error, *spoolss_werror;
-/* Return a cli_state struct opened on the SPOOLSS pipe. If credentials
- are passed use them. */
-
-typedef struct cli_state *(cli_pipe_fn)(
- struct cli_state *cli, char *system_name,
- struct ntuser_creds *creds);
-
#include "python/py_spoolss_proto.h"
#endif /* _PY_SPOOLSS_H */
diff --git a/source3/python/py_spoolss_proto.h b/source3/python/py_spoolss_proto.h
index 6788dcccd1..3e3e5ef6ee 100644
--- a/source3/python/py_spoolss_proto.h
+++ b/source3/python/py_spoolss_proto.h
@@ -6,9 +6,6 @@
/* The following definitions come from python/py_spoolss.c */
-struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
- cli_pipe_fn *connect_fn,
- struct cli_state *cli);
PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol);
void initspoolss(void);
--
cgit
From a160d7bbb1cde89923d8e50117a164d9ed0184ec Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 01:00:49 +0000
Subject: Starting work on lsa module. (This used to be commit
5c44397803622400390b13f1998b49f5da83d2a1)
---
source3/python/py_lsa.h | 46 +++++++++++++++++++++++++++++++++++++++++++
source3/python/py_lsa_proto.h | 13 ++++++++++++
2 files changed, 59 insertions(+)
create mode 100644 source3/python/py_lsa.h
create mode 100644 source3/python/py_lsa_proto.h
diff --git a/source3/python/py_lsa.h b/source3/python/py_lsa.h
new file mode 100644
index 0000000000..a963fcac98
--- /dev/null
+++ b/source3/python/py_lsa.h
@@ -0,0 +1,46 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _PY_LSA_H
+#define _PY_LSA_H
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common.h"
+
+/* LSA policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} lsa_policy_hnd_object;
+
+/* Exceptions raised by this module */
+
+extern PyTypeObject lsa_policy_hnd_type;
+
+extern PyObject *lsa_error;
+
+#include "python/py_lsa_proto.h"
+
+#endif /* _PY_LSA_H */
diff --git a/source3/python/py_lsa_proto.h b/source3/python/py_lsa_proto.h
new file mode 100644
index 0000000000..066a0aad53
--- /dev/null
+++ b/source3/python/py_lsa_proto.h
@@ -0,0 +1,13 @@
+#ifndef _PY_LSA_PROTO_H
+#define _PY_LSA_PROTO_H
+
+/* This file is automatically generated with "make proto". DO NOT EDIT */
+
+
+/* The following definitions come from python/py_lsa.c */
+
+PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol);
+void initlsa(void);
+
+#endif /* _PY_LSA_PROTO_H */
--
cgit
From d837a511e8057b23e493a078d18a1b96fa69d69c Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 01:01:39 +0000
Subject: Generate proto for lsa.
Updated patch.
(This used to be commit 5dbd716b99c522eac89d9216eb4293084958b966)
---
source3/python/samba-head.patch | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/source3/python/samba-head.patch b/source3/python/samba-head.patch
index 2e0863e31e..223e0179fb 100644
--- a/source3/python/samba-head.patch
+++ b/source3/python/samba-head.patch
@@ -1,11 +1,11 @@
Index: Makefile.in
===================================================================
RCS file: /data/cvs/samba/source/Makefile.in,v
-retrieving revision 1.465
-diff -u -r1.465 Makefile.in
---- Makefile.in 2002/04/04 22:58:56 1.465
-+++ Makefile.in 2002/04/05 05:48:51
-@@ -785,6 +785,29 @@
+retrieving revision 1.470
+diff -u -r1.470 Makefile.in
+--- Makefile.in 2002/04/13 11:45:33 1.470
++++ Makefile.in 2002/04/14 01:01:05
+@@ -787,6 +787,36 @@
-$(INSTALLCMD) -d ${prefix}/include
-$(INSTALLCMD) include/libsmbclient.h ${prefix}/include
@@ -20,13 +20,20 @@ diff -u -r1.465 Makefile.in
+ python/py_spoolss_ports.o python/py_spoolss_ports_conv.o \
+ python/py_spoolss_drivers.o python/py_spoolss_drivers_conv.o \
+
-+python_proto: python_spoolss_proto
++PY_LSA_PROTO_OBJ = python/py_lsa.o
++
++python_proto: python_spoolss_proto python_lsa_proto
+
+python_spoolss_proto:
+ @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
+ -h _PY_SPOOLSS_PROTO_H python/py_spoolss_proto.h \
+ $(PY_SPOOLSS_PROTO_OBJ)
+
++python_lsa_proto:
++ @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
++ -h _PY_LSA_PROTO_H python/py_lsa_proto.h \
++ $(PY_LSA_PROTO_OBJ)
++
+python_ext: $(PYTHON_OBJS)
+ @echo python python/setup.py build
+ @PYTHON_OBJS="$(PYTHON_OBJS)" PYTHON_CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
@@ -38,11 +45,11 @@ diff -u -r1.465 Makefile.in
Index: configure.in
===================================================================
RCS file: /data/cvs/samba/source/configure.in,v
-retrieving revision 1.298
-diff -u -r1.298 configure.in
---- configure.in 2002/04/04 05:47:41 1.298
-+++ configure.in 2002/04/05 05:48:52
-@@ -2695,7 +2695,7 @@
+retrieving revision 1.300
+diff -u -r1.300 configure.in
+--- configure.in 2002/04/11 15:26:58 1.300
++++ configure.in 2002/04/14 01:01:08
+@@ -2716,7 +2716,7 @@
builddir=`pwd`
AC_SUBST(builddir)
--
cgit
From db32b9ceb726ad24fe022eae71b315683f840508 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 04:55:18 +0000
Subject: Made a comment clearer. (This used to be commit
703e0a6ce2d283349f64cba72b36c1bef6a0d806)
---
source3/python/py_spoolss_printers_conv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/python/py_spoolss_printers_conv.c b/source3/python/py_spoolss_printers_conv.c
index 84a068181f..c583792c0a 100644
--- a/source3/python/py_spoolss_printers_conv.c
+++ b/source3/python/py_spoolss_printers_conv.c
@@ -144,7 +144,7 @@ struct pyconv py_DEVICEMODE[] = {
{ NULL }
};
-/* Convert a security descriptor to a Python dict */
+/* Convert a SID to a Python dict */
BOOL py_from_SID(PyObject **obj, DOM_SID *sid)
{
--
cgit
From f8b1f9608f5d5cb15cf063e04a036ccf3aa0a4d9 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 04:57:02 +0000
Subject: Fixed comment. (This used to be commit
06df6c79ae91cb4b1427a2a230fee288cff50e10)
---
source3/rpcclient/rpcclient.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 193c27e8a0..688dd74004 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -199,7 +199,7 @@ void fetch_machine_sid(struct cli_state *cli)
if (!(mem_ctx=talloc_init()))
{
- DEBUG(0,("fetch_domain_sid: talloc_init returned NULL!\n"));
+ DEBUG(0,("fetch_machine_sid: talloc_init returned NULL!\n"));
goto error;
}
--
cgit
From c4e49dee7a4fdfbf1939b9d870fdfa6339113a74 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 04:58:49 +0000
Subject: Fixed debugs. (This used to be commit
6d9336f3b9b205e5916424ee844658b445439fdb)
---
source3/utils/net_rpc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 19e2c63ecc..2aca3f0485 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -59,13 +59,13 @@ static DOM_SID *net_get_remote_domain_sid(struct cli_state *cli)
TALLOC_CTX *mem_ctx;
if (!(domain_sid = malloc(sizeof(DOM_SID)))){
- DEBUG(0,("fetch_domain_sid: malloc returned NULL!\n"));
+ DEBUG(0,("net_get_remote_domain_sid: malloc returned NULL!\n"));
goto error;
}
if (!(mem_ctx=talloc_init()))
{
- DEBUG(0,("fetch_domain_sid: talloc_init returned NULL!\n"));
+ DEBUG(0,("net_get_remote_domain_sid: talloc_init returned NULL!\n"));
goto error;
}
--
cgit
From 35bc06d35cfff9d5f4ebf3c0d47a57165df09fd6 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sun, 14 Apr 2002 05:14:50 +0000
Subject: modified the ADS backend to accept either the long or short versions
of long usernames (win2000 usernames can be longer than 20 characters) (This
used to be commit 0719e756f60950b9ec04450fda5cc3776752e9a9)
---
source3/nsswitch/winbindd_ads.c | 55 ++++++++++++++++++++++++++++++++---------
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index 22bad667c3..e74bd1e04c 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -186,6 +186,24 @@ static enum SID_NAME_USE ads_atype_map(uint32 atype)
return SID_NAME_UNKNOWN;
}
+/*
+ in order to support usernames longer than 21 characters we need to
+ use both the sAMAccountName and the userPrincipalName attributes
+ It seems that not all users have the userPrincipalName attribute set
+*/
+char *pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, void *msg)
+{
+ char *ret, *p;
+
+ ret = ads_pull_string(ads, mem_ctx, msg, "userPrincipalName");
+ if (ret && (p = strchr(ret, '@'))) {
+ *p = 0;
+ return ret;
+ }
+ return ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+}
+
+
/* Query display info for a realm. This is the basic user list fn */
static NTSTATUS query_user_list(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
@@ -193,7 +211,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
WINBIND_USERINFO **info)
{
ADS_STRUCT *ads = NULL;
- const char *attrs[] = {"sAMAccountName", "name", "objectSid", "primaryGroupID",
+ const char *attrs[] = {"userPrincipalName",
+ "sAMAccountName",
+ "name", "objectSid", "primaryGroupID",
"sAMAccountType", NULL};
int i, count;
ADS_STATUS rc;
@@ -240,7 +260,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
continue;
}
- name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+ name = pull_username(ads, mem_ctx, msg);
gecos = ads_pull_string(ads, mem_ctx, msg, "name");
if (!ads_pull_sid(ads, msg, "objectSid", &sid)) {
DEBUG(1,("No sid for %s !?\n", name));
@@ -281,7 +301,8 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
struct acct_info **info)
{
ADS_STRUCT *ads = NULL;
- const char *attrs[] = {"sAMAccountName", "name", "objectSid",
+ const char *attrs[] = {"userPrincipalName", "sAMAccountName",
+ "name", "objectSid",
"sAMAccountType", NULL};
int i, count;
ADS_STATUS rc;
@@ -326,7 +347,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
&account_type) ||
!(account_type & ATYPE_GROUP)) continue;
- name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+ name = pull_username(ads, mem_ctx, msg);
gecos = ads_pull_string(ads, mem_ctx, msg, "name");
if (!ads_pull_sid(ads, msg, "objectSid", &sid)) {
DEBUG(1,("No sid for %s !?\n", name));
@@ -377,7 +398,14 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
ads = ads_cached_connection(domain);
if (!ads) goto done;
- asprintf(&exp, "(sAMAccountName=%s)", name);
+ /* when a name is longer than 20 characters, the sAMAccountName can
+ be long or short! */
+ if (strlen(name) > 20) {
+ asprintf(&exp, "(|(sAMAccountName=%s)(sAMAccountName=%.20s))",
+ name, name);
+ } else {
+ asprintf(&exp, "(sAMAccountName=%s)", name);
+ }
rc = ads_search_retry(ads, &res, exp, attrs);
free(exp);
if (!ADS_ERR_OK(rc)) {
@@ -421,7 +449,9 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
enum SID_NAME_USE *type)
{
ADS_STRUCT *ads = NULL;
- const char *attrs[] = {"sAMAccountName", "sAMAccountType", NULL};
+ const char *attrs[] = {"userPrincipalName",
+ "sAMAccountName",
+ "sAMAccountType", NULL};
ADS_STATUS rc;
void *msg = NULL;
char *exp;
@@ -448,7 +478,7 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
goto done;
}
- *name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+ *name = pull_username(ads, mem_ctx, msg);
*type = ads_atype_map(atype);
status = NT_STATUS_OK;
@@ -511,7 +541,9 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
WINBIND_USERINFO *info)
{
ADS_STRUCT *ads = NULL;
- const char *attrs[] = {"sAMAccountName", "name", "objectSid",
+ const char *attrs[] = {"userPrincipalName",
+ "sAMAccountName",
+ "name", "objectSid",
"primaryGroupID", NULL};
ADS_STATUS rc;
int count;
@@ -544,7 +576,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
goto done;
}
- info->acct_name = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+ info->acct_name = pull_username(ads, mem_ctx, msg);
info->full_name = ads_pull_string(ads, mem_ctx, msg, "name");
if (!ads_pull_sid(ads, msg, "objectSid", &sid)) {
DEBUG(1,("No sid for %d !?\n", user_rid));
@@ -654,7 +686,8 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
uint32 **name_types)
{
DOM_SID group_sid;
- const char *attrs[] = {"sAMAccountName", "objectSid", "sAMAccountType", NULL};
+ const char *attrs[] = {"userPrincipalName", "sAMAccountName",
+ "objectSid", "sAMAccountType", NULL};
ADS_STATUS rc;
int count;
void *res=NULL, *msg=NULL;
@@ -698,7 +731,7 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
uint32 atype, rid;
DOM_SID sid;
- (*names)[*num_names] = ads_pull_string(ads, mem_ctx, msg, "sAMAccountName");
+ (*names)[*num_names] = pull_username(ads, mem_ctx, msg);
if (!ads_pull_uint32(ads, msg, "sAMAccountType", &atype)) {
continue;
}
--
cgit
From 58c7f38368df7bb3d5757540ef3210c2505c6e73 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sun, 14 Apr 2002 05:46:23 +0000
Subject: hanle the case where the win2000 username is completely different
from the pre-win2000 username (This used to be commit
aa139ba507e4b898377fdfc9b27f7febf029d5a4)
---
source3/nsswitch/winbindd_ads.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index e74bd1e04c..e7db6efab6 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -398,14 +398,9 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
ads = ads_cached_connection(domain);
if (!ads) goto done;
- /* when a name is longer than 20 characters, the sAMAccountName can
- be long or short! */
- if (strlen(name) > 20) {
- asprintf(&exp, "(|(sAMAccountName=%s)(sAMAccountName=%.20s))",
- name, name);
- } else {
- asprintf(&exp, "(sAMAccountName=%s)", name);
- }
+ /* accept either the win2000 or the pre-win2000 username */
+ asprintf(&exp, "(|(sAMAccountName=%s)(userPrincipalName=%s@%s))",
+ name, name, ads->realm);
rc = ads_search_retry(ads, &res, exp, attrs);
free(exp);
if (!ADS_ERR_OK(rc)) {
--
cgit
From a83a0ac9c560f92ad6f7a67cd9d769708ec8a554 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sun, 14 Apr 2002 05:51:13 +0000
Subject: pull_username() is a local function (This used to be commit
fbf154bcfb68b90eb43ada9de317c93f43711608)
---
source3/nsswitch/winbindd_ads.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index e7db6efab6..af0933716b 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -191,7 +191,7 @@ static enum SID_NAME_USE ads_atype_map(uint32 atype)
use both the sAMAccountName and the userPrincipalName attributes
It seems that not all users have the userPrincipalName attribute set
*/
-char *pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, void *msg)
+static char *pull_username(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, void *msg)
{
char *ret, *p;
--
cgit
From 24065c0bf5fd803f8792eb9459969536d4ee9c4a Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sun, 14 Apr 2002 06:24:17 +0000
Subject: win2000 does not check the permissions on the share directory on
tconx, so win2000 clients don't expect a permissions error in tconx. We now
match this behaviour, by only checking that the directory exists during tconx
and relying on the permissions on other calls to protect directories (This
used to be commit 4fc476686476da31cc2b45badb05cb0765259f98)
---
source3/smbd/service.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 0ae49b7adf..9ca44b65c3 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -328,7 +328,7 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
BOOL force = False;
connection_struct *conn;
uid_t euid;
-
+ struct stat st;
fstring user;
ZERO_STRUCT(user);
@@ -626,6 +626,11 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
}
}
+#if CHECK_PATH_ON_TCONX
+ /* win2000 does not check the permissions on the directory
+ during the tree connect, instead relying on permission
+ check during individual operations. To match this behaviour
+ I have disabled this chdir check (tridge) */
if (vfs_ChDir(conn,conn->connectpath) != 0) {
DEBUG(0,("%s (%s) Can't change directory to %s (%s)\n",
remote_machine, conn->client_address,
@@ -636,12 +641,23 @@ connection_struct *make_connection(char *service, DATA_BLOB password,
*status = NT_STATUS_BAD_NETWORK_NAME;
return NULL;
}
+#else
+ /* the alternative is just to check the directory exists */
+ if (stat(conn->connectpath, &st) != 0 || !S_ISDIR(st.st_mode)) {
+ DEBUG(0,("%s is not a directory\n", conn->connectpath));
+ change_to_root_user();
+ yield_connection(conn, lp_servicename(SNUM(conn)));
+ conn_free(conn);
+ *status = NT_STATUS_BAD_NETWORK_NAME;
+ return NULL;
+ }
+#endif
string_set(&conn->origpath,conn->connectpath);
#if SOFTLINK_OPTIMISATION
- /* resolve any soft links early */
- {
+ /* resolve any soft links early if possible */
+ if (vfs_ChDir(conn,conn->connectpath) == 0) {
pstring s;
pstrcpy(s,conn->connectpath);
vfs_GetWd(conn,s);
--
cgit
From a99e810bda20b2a95ae5d5204a6d36d6d22309d6 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sun, 14 Apr 2002 09:00:05 +0000
Subject: it looks like it is possible for a w2k client to send a spnego auth
without sending the negotiate - try to cope (This used to be commit
95278aa41f654108d9d20cd0096a34caf175d32b)
---
source3/smbd/sesssetup.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 899c9174b2..270a69d96a 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -346,10 +346,15 @@ static int reply_spnego_auth(connection_struct *conn, char *inbuf, char *outbuf,
int sess_vuid;
BOOL as_guest;
uint32 auth_flags = AUTH_FLAG_NONE;
-
auth_usersupplied_info *user_info = NULL;
auth_serversupplied_info *server_info = NULL;
+ /* we must have setup the auth context by now */
+ if (!ntlmssp_auth_context) {
+ DEBUG(2,("ntlmssp_auth_context is NULL in reply_spnego_auth\n"));
+ return ERROR_NT(NT_STATUS_LOGON_FAILURE);
+ }
+
if (!spnego_parse_auth(blob1, &auth)) {
#if 0
file_save("auth.dat", blob1.data, blob1.length);
--
cgit
From f143cb6144a564f0248770cd552e440dbcddb056 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 09:00:13 +0000
Subject: Added copyright.
Added lookup_names() and lookup_sids() functions.
(This used to be commit 2d2c925014374605b29e052729e959c0fd690586)
---
source3/python/py_lsa.c | 202 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 160 insertions(+), 42 deletions(-)
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index 5e805a91ad..1c84af5ea0 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -1,29 +1,27 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
#include "includes.h"
#include "Python.h"
#include "python/py_lsa.h"
-static void py_policy_hnd_dealloc(PyObject* self)
-{
- PyObject_Del(self);
-}
-
-PyTypeObject lsa_policy_hnd_type = {
- PyObject_HEAD_INIT(NULL)
- 0,
- "LSA Policy Handle",
- sizeof(lsa_policy_hnd_object),
- 0,
- py_policy_hnd_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash */
-};
PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol)
@@ -54,7 +52,7 @@ PyObject *lsa_ntstatus; /* This exception is raised when a RPC call
* Open/close lsa handles
*/
-static PyObject *lsa_openpolicy(PyObject *self, PyObject *args,
+static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
PyObject *kw)
{
static char *kwlist[] = { "servername", "creds", "access", NULL };
@@ -114,7 +112,7 @@ static PyObject *lsa_close(PyObject *self, PyObject *args, PyObject *kw)
result = cli_lsa_close(hnd->cli, hnd->mem_ctx, &hnd->pol);
- /* Cleanup samba stuf */
+ /* Cleanup samba stuff */
cli_shutdown(hnd->cli);
talloc_destroy(hnd->mem_ctx);
@@ -125,39 +123,156 @@ static PyObject *lsa_close(PyObject *self, PyObject *args, PyObject *kw)
return Py_None;
}
-static PyObject *lsa_lookupnames(PyObject *self, PyObject *args,
- PyObject *kw)
+static PyObject *lsa_lookup_names(PyObject *self, PyObject *args)
{
- return NULL;
+ PyObject *py_names, *result;
+ NTSTATUS ntstatus;
+ lsa_policy_hnd_object *hnd = (lsa_policy_hnd_object *)self;
+ int num_names, i;
+ const char **names;
+ DOM_SID *sids;
+ uint32 *name_types;
+
+ if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &py_names))
+ return NULL;
+
+ /* Convert dictionary to char ** array */
+
+ num_names = PyList_Size(py_names);
+ names = (const char **)talloc(
+ hnd->mem_ctx, num_names * sizeof(char *));
+
+ for (i = 0; i < num_names; i++) {
+ PyObject *obj = PyList_GetItem(py_names, i);
+
+ names[i] = talloc_strdup(hnd->mem_ctx, PyString_AsString(obj));
+ }
+
+ ntstatus = cli_lsa_lookup_names(hnd->cli, hnd->mem_ctx, &hnd->pol,
+ num_names, names, &sids, &name_types);
+
+ if (!NT_STATUS_IS_OK(ntstatus) && NT_STATUS_V(ntstatus) != 0x107) {
+ PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus));
+ return NULL;
+ }
+
+ result = PyList_New(num_names);
+
+ for (i = 0; i < num_names; i++) {
+ PyObject *sid_obj, *obj;
+
+ py_from_SID(&sid_obj, &sids[i]);
+
+ obj = Py_BuildValue("(Oi)", sid_obj, name_types[i]);
+
+ PyList_SetItem(result, i, obj);
+ }
+
+ return result;
}
-static PyObject *lsa_lookupsids(PyObject *self, PyObject *args,
- PyObject *kw)
+static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
+ PyObject *kw)
{
- return NULL;
+ PyObject *py_sids, *result;
+ NTSTATUS ntstatus;
+ int num_sids, i;
+ char **domains, **names;
+ uint32 *types;
+ lsa_policy_hnd_object *hnd = (lsa_policy_hnd_object *)self;
+ DOM_SID *sids;
+
+ if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &py_sids))
+ return NULL;
+
+ /* Convert dictionary to char ** array */
+
+ num_sids = PyList_Size(py_sids);
+ sids = (DOM_SID *)talloc(hnd->mem_ctx, num_sids * sizeof(DOM_SID));
+
+ memset(sids, 0, num_sids * sizeof(DOM_SID));
+
+ for (i = 0; i < num_sids; i++) {
+ PyObject *obj = PyList_GetItem(py_sids, i);
+
+ string_to_sid(&sids[i], PyString_AsString(obj));
+ }
+
+ ntstatus = cli_lsa_lookup_sids(hnd->cli, hnd->mem_ctx, &hnd->pol,
+ num_sids, sids, &domains, &names,
+ &types);
+
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus));
+ return NULL;
+ }
+
+ result = PyList_New(num_sids);
+
+ for (i = 0; i < num_sids; i++) {
+ PyObject *name_obj, *obj;
+
+ obj = Py_BuildValue("{sssssi}", "username", names[i],
+ "domain", domains[i], "name_type",
+ types[i]);
+
+ PyList_SetItem(result, i, obj);
+ }
+
+ return result;
}
/*
- * Method dispatch table
+ * Method dispatch tables
*/
+static PyMethodDef lsa_hnd_methods[] = {
+
+ { "lookup_sids", lsa_lookup_sids, METH_VARARGS | METH_KEYWORDS,
+ "Convert sids to names." },
+
+ { "lookup_names", lsa_lookup_names, METH_VARARGS | METH_KEYWORDS,
+ "Convert names to sids." },
+
+ { NULL }
+};
+
+static void py_lsa_policy_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+static PyObject *py_lsa_policy_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(lsa_hnd_methods, self, attrname);
+}
+
+PyTypeObject lsa_policy_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "LSA Policy Handle",
+ sizeof(lsa_policy_hnd_object),
+ 0,
+ py_lsa_policy_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ py_lsa_policy_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
static PyMethodDef lsa_methods[] = {
/* Open/close lsa handles */
- { "openpolicy", lsa_openpolicy, METH_VARARGS | METH_KEYWORDS,
+ { "open_policy", lsa_open_policy, METH_VARARGS | METH_KEYWORDS,
"Open a policy handle" },
- { "close", lsa_close, METH_VARARGS,
- "Close a policy handle" },
-
- /* Name <-> SID resolution */
-
- { "lookupnames", lsa_lookupnames, METH_VARARGS | METH_KEYWORDS,
- "Look up SIDS from a list of names" },
-
- { "lookupsids", lsa_lookupsids, METH_VARARGS | METH_KEYWORDS,
- "Look up names from a list of SIDS" },
+ { "close", lsa_close, METH_VARARGS, "Close a policy handle" },
{ NULL }
};
@@ -192,4 +307,7 @@ void initlsa(void)
/* Do samba initialisation */
py_samba_init();
+
+ setup_logging("lsa", True);
+ DEBUGLEVEL = 10;
}
--
cgit
From cc8dce0debe4dc81bdb94fc4593eda22e5b8200a Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 09:03:05 +0000
Subject: Moved function prototypes to py_common_proto.h (This used to be
commit f006bcf8e50e44b955678356039a6d6a7e16ab20)
---
source3/python/py_common.h | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/source3/python/py_common.h b/source3/python/py_common.h
index 45ad5c422d..6661d87fe0 100644
--- a/source3/python/py_common.h
+++ b/source3/python/py_common.h
@@ -21,16 +21,6 @@
#ifndef _PY_COMMON_H
#define _PY_COMMON_H
-/* Function prototypes */
-
-void py_samba_init(void);
-PyObject *py_werror_tuple(WERROR werror);
-PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
-
-PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
-PyObject *get_debuglevel(PyObject *self, PyObject *args);
-PyObject *set_debuglevel(PyObject *self, PyObject *args);
-
/* Return a cli_state struct opened on the SPOOLSS pipe. If credentials
are passed use them. */
@@ -38,8 +28,6 @@ typedef struct cli_state *(cli_pipe_fn)(
struct cli_state *cli, char *system_name,
struct ntuser_creds *creds);
-struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
- cli_pipe_fn *connect_fn,
- struct cli_state *cli);
+#include "python/py_common_proto.h"
#endif /* _PY_COMMON_H */
--
cgit
From 562393fc85b977fa55134e0767d9ddf0569c0100 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 09:04:12 +0000
Subject: Moved security descriptor routines into their own file. (This used to
be commit 8e0457f8aa7b5ecababcdec4dfbc328d11513192)
---
source3/python/py_ntsec.c | 139 ++++++++++++++++++++++++++++++
source3/python/py_spoolss_printers_conv.c | 115 ------------------------
source3/python/setup.py.in | 4 +-
3 files changed, 142 insertions(+), 116 deletions(-)
create mode 100644 source3/python/py_ntsec.c
diff --git a/source3/python/py_ntsec.c b/source3/python/py_ntsec.c
new file mode 100644
index 0000000000..d97bbb6f8c
--- /dev/null
+++ b/source3/python/py_ntsec.c
@@ -0,0 +1,139 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common.h"
+
+/* Convert a SID to a Python dict */
+
+BOOL py_from_SID(PyObject **obj, DOM_SID *sid)
+{
+ fstring sidstr;
+
+ if (!sid) {
+ Py_INCREF(Py_None);
+ *obj = Py_None;
+ return True;
+ }
+
+ if (!sid_to_string(sidstr, sid))
+ return False;
+
+ *obj = PyString_FromString(sidstr);
+
+ return True;
+}
+
+BOOL py_to_SID(DOM_SID *sid, PyObject *dict)
+{
+ return False;
+}
+
+BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace)
+{
+ PyObject *obj;
+
+ if (!ace) {
+ Py_INCREF(Py_None);
+ *dict = Py_None;
+ return True;
+ }
+
+ *dict = PyDict_New();
+
+ PyDict_SetItemString(*dict, "type", PyInt_FromLong(ace->type));
+ PyDict_SetItemString(*dict, "flags", PyInt_FromLong(ace->flags));
+ PyDict_SetItemString(*dict, "mask", PyInt_FromLong(ace->info.mask));
+
+ if (py_from_SID(&obj, &ace->trustee))
+ PyDict_SetItemString(*dict, "trustee", obj);
+
+ return True;
+}
+
+BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict)
+{
+ return False;
+}
+
+BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl)
+{
+ PyObject *ace_list;
+ int i;
+
+ if (!acl) {
+ Py_INCREF(Py_None);
+ *dict = Py_None;
+ return True;
+ }
+
+ *dict = PyDict_New();
+
+ PyDict_SetItemString(*dict, "revision", PyInt_FromLong(acl->revision));
+
+ ace_list = PyList_New(acl->num_aces);
+
+ for (i = 0; i < acl->num_aces; i++) {
+ PyObject *obj;
+
+ if (py_from_ACE(&obj, &acl->ace[i]))
+ PyList_SetItem(ace_list, i, obj);
+ }
+
+ PyDict_SetItemString(*dict, "ace_list", ace_list);
+
+ return True;
+}
+
+BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict)
+{
+ return False;
+}
+
+BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd)
+{
+ PyObject *obj;
+
+ *dict = PyDict_New();
+
+ PyDict_SetItemString(*dict, "revision", PyInt_FromLong(sd->revision));
+ PyDict_SetItemString(*dict, "type", PyInt_FromLong(sd->type));
+
+ if (py_from_SID(&obj, sd->owner_sid))
+ PyDict_SetItemString(*dict, "owner_sid", obj);
+
+ if (py_from_SID(&obj, sd->grp_sid))
+ PyDict_SetItemString(*dict, "group_sid", obj);
+
+ if (py_from_ACL(&obj, sd->dacl))
+ PyDict_SetItemString(*dict, "dacl", obj);
+
+ if (py_from_ACL(&obj, sd->sacl))
+ PyDict_SetItemString(*dict, "sacl", obj);
+
+ return True;
+}
+
+BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict)
+{
+ return False;
+}
diff --git a/source3/python/py_spoolss_printers_conv.c b/source3/python/py_spoolss_printers_conv.c
index c583792c0a..84b36ddbb2 100644
--- a/source3/python/py_spoolss_printers_conv.c
+++ b/source3/python/py_spoolss_printers_conv.c
@@ -144,121 +144,6 @@ struct pyconv py_DEVICEMODE[] = {
{ NULL }
};
-/* Convert a SID to a Python dict */
-
-BOOL py_from_SID(PyObject **obj, DOM_SID *sid)
-{
- fstring sidstr;
-
- if (!sid) {
- Py_INCREF(Py_None);
- *obj = Py_None;
- return True;
- }
-
- if (!sid_to_string(sidstr, sid))
- return False;
-
- *obj = PyString_FromString(sidstr);
-
- return True;
-}
-
-BOOL py_to_SID(DOM_SID *sid, PyObject *dict)
-{
- return False;
-}
-
-BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace)
-{
- PyObject *obj;
-
- if (!ace) {
- Py_INCREF(Py_None);
- *dict = Py_None;
- return True;
- }
-
- *dict = PyDict_New();
-
- PyDict_SetItemString(*dict, "type", PyInt_FromLong(ace->type));
- PyDict_SetItemString(*dict, "flags", PyInt_FromLong(ace->flags));
- PyDict_SetItemString(*dict, "mask", PyInt_FromLong(ace->info.mask));
-
- if (py_from_SID(&obj, &ace->trustee))
- PyDict_SetItemString(*dict, "trustee", obj);
-
- return True;
-}
-
-BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict)
-{
- return False;
-}
-
-BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl)
-{
- PyObject *ace_list;
- int i;
-
- if (!acl) {
- Py_INCREF(Py_None);
- *dict = Py_None;
- return True;
- }
-
- *dict = PyDict_New();
-
- PyDict_SetItemString(*dict, "revision", PyInt_FromLong(acl->revision));
-
- ace_list = PyList_New(acl->num_aces);
-
- for (i = 0; i < acl->num_aces; i++) {
- PyObject *obj;
-
- if (py_from_ACE(&obj, &acl->ace[i]))
- PyList_SetItem(ace_list, i, obj);
- }
-
- PyDict_SetItemString(*dict, "ace_list", ace_list);
-
- return True;
-}
-
-BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict)
-{
- return False;
-}
-
-BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd)
-{
- PyObject *obj;
-
- *dict = PyDict_New();
-
- PyDict_SetItemString(*dict, "revision", PyInt_FromLong(sd->revision));
- PyDict_SetItemString(*dict, "type", PyInt_FromLong(sd->type));
-
- if (py_from_SID(&obj, sd->owner_sid))
- PyDict_SetItemString(*dict, "owner_sid", obj);
-
- if (py_from_SID(&obj, sd->grp_sid))
- PyDict_SetItemString(*dict, "group_sid", obj);
-
- if (py_from_ACL(&obj, sd->dacl))
- PyDict_SetItemString(*dict, "dacl", obj);
-
- if (py_from_ACL(&obj, sd->sacl))
- PyDict_SetItemString(*dict, "sacl", obj);
-
- return True;
-}
-
-BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict)
-{
- return False;
-}
-
/*
* Convert between DEVICEMODE and Python
*/
diff --git a/source3/python/setup.py.in b/source3/python/setup.py.in
index 37bcd84772..59182f5def 100755
--- a/source3/python/setup.py.in
+++ b/source3/python/setup.py.in
@@ -87,6 +87,7 @@ setup(
sources = [samba_srcdir + "python/py_spoolss.c",
samba_srcdir + "python/py_common.c",
samba_srcdir + "python/py_conv.c",
+ samba_srcdir + "python/py_ntsec.c",
samba_srcdir + "python/py_spoolss_forms.c",
samba_srcdir + "python/py_spoolss_forms_conv.c",
samba_srcdir + "python/py_spoolss_drivers.c",
@@ -104,7 +105,8 @@ setup(
Extension(name = "lsa",
sources = [samba_srcdir + "python/py_lsa.c",
- samba_srcdir + "python/py_common.c"],
+ samba_srcdir + "python/py_common.c",
+ samba_srcdir + "python/py_ntsec.c"],
libraries = lib_list,
library_dirs = ["/usr/kerberos/lib"],
extra_objects = obj_list),
--
cgit
From 06f15779303dc540ee7801fe843023970454166b Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 09:04:45 +0000
Subject: New file to hold common prototypes. (This used to be commit
d5862891979678c4defb3e33791edca1f1f8c3e4)
---
source3/python/py_common_proto.h | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 source3/python/py_common_proto.h
diff --git a/source3/python/py_common_proto.h b/source3/python/py_common_proto.h
new file mode 100644
index 0000000000..0c227ffef8
--- /dev/null
+++ b/source3/python/py_common_proto.h
@@ -0,0 +1,30 @@
+#ifndef _PY_COMMON_PROTO_H
+#define _PY_COMMON_PROTO_H
+
+/* This file is automatically generated with "make proto". DO NOT EDIT */
+
+
+/* The following definitions come from python/py_common.c */
+
+PyObject *py_werror_tuple(WERROR werror);
+PyObject *py_ntstatus_tuple(NTSTATUS ntstatus);
+void py_samba_init(void);
+PyObject *get_debuglevel(PyObject *self, PyObject *args);
+PyObject *set_debuglevel(PyObject *self, PyObject *args);
+PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
+struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
+ cli_pipe_fn *connect_fn,
+ struct cli_state *cli);
+
+/* The following definitions come from python/py_ntsec.c */
+
+BOOL py_from_SID(PyObject **obj, DOM_SID *sid);
+BOOL py_to_SID(DOM_SID *sid, PyObject *dict);
+BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace);
+BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict);
+BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl);
+BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict);
+BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd);
+BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict);
+
+#endif /* _PY_COMMON_PROTO_H */
--
cgit
From 07e6ff5fcfe337bb65a7c3a4493a92a7761cf2ed Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sun, 14 Apr 2002 09:44:16 +0000
Subject: Partly based on the work by mimir (Rafal Szczesniak
) this patch allows samba to correctly
enumerate its trusted domains - by exaimining the keys in the secrets.tdb
file.
This patch has been tested with both NT4 and rpcclient/wbinfo, and adds
some extra functionality to talloc and rpc_parse to allow it to deal with
already unicode strings.
Finally, this cleans up some const warnings that were in net_rpc.c by pushing
another dash of const into the rpc client code.
Andrew Bartlett
(This used to be commit 0bdd94cb992b40942aaf2e5e0efd2868b4686296)
---
source3/auth/auth_domain.c | 2 +-
source3/include/includes.h | 1 +
source3/include/rpc_lsa.h | 4 +-
source3/include/secrets.h | 22 +++++--
source3/lib/talloc.c | 9 +++
source3/lib/util_unistr.c | 41 ++++++++++++
source3/libsmb/cli_samr.c | 2 +-
source3/passdb/secrets.c | 136 +++++++++++++++++++++++++++++++++++++---
source3/rpc_parse/parse_lsa.c | 76 ++++++++++++++--------
source3/rpc_parse/parse_misc.c | 45 +++++++++++++
source3/rpc_parse/parse_samr.c | 2 +-
source3/rpc_server/srv_lsa.c | 2 +
source3/rpc_server/srv_lsa_nt.c | 20 ++++--
source3/tdb/tdbutil.c | 72 +++++++++++++++++++++
source3/utils/net_rpc.c | 40 ++++++------
15 files changed, 406 insertions(+), 68 deletions(-)
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index af353ef812..a77bbeade3 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -527,7 +527,7 @@ static NTSTATUS check_trustdomain_security(const struct auth_context *auth_conte
}
/*
- * Get the machine account password for the trusted domain
+ * Get the trusted account password for the trusted domain
* No need to become_root() as secrets_init() is done at startup.
*/
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 5da1c1d997..1dfebcea78 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -696,6 +696,7 @@ extern int errno;
#include "dlinklist.h"
#include "../tdb/tdb.h"
#include "../tdb/spinlock.h"
+#include "../tdb/tdbutil.h"
#include "talloc.h"
#include "ads.h"
#include "interfaces.h"
diff --git a/source3/include/rpc_lsa.h b/source3/include/rpc_lsa.h
index ccdce6f263..ceb0e17d5c 100644
--- a/source3/include/rpc_lsa.h
+++ b/source3/include/rpc_lsa.h
@@ -278,8 +278,8 @@ typedef struct lsa_r_query_info
typedef struct lsa_enum_trust_dom_info
{
POLICY_HND pol; /* policy handle */
- uint32 enum_context; /* enumeration context handle */
- uint32 preferred_len; /* preferred maximum length */
+ uint32 enum_context; /* enumeration context handle */
+ uint32 preferred_len; /* preferred maximum length */
} LSA_Q_ENUM_TRUST_DOM;
diff --git a/source3/include/secrets.h b/source3/include/secrets.h
index 69ab4f6c8d..3d7e2aa97e 100644
--- a/source3/include/secrets.h
+++ b/source3/include/secrets.h
@@ -48,12 +48,26 @@ struct machine_acct_pass {
time_t mod_time;
};
-/* structure for storing trusted domain password */
+/*
+ * storage structure for trusted domain
+ */
struct trusted_dom_pass {
- int pass_len;
- fstring pass;
+ size_t uni_name_len;
+ smb_ucs2_t uni_name[32]; /* unicode domain name */
+ size_t pass_len;
+ fstring pass; /* trust relationship's password */
time_t mod_time;
- DOM_SID domain_sid; /* remote domain's sid */
+ DOM_SID domain_sid; /* remote domain's sid */
};
+/*
+ * trusted domain entry/entries returned by secrets_get_trusted_domains
+ * (used in _lsa_enum_trust_dom call)
+ */
+typedef struct trustdom {
+ smb_ucs2_t *name;
+ DOM_SID sid;
+} TRUSTDOM;
+
+
#endif /* _SECRETS_H */
diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c
index 6ac784a929..b50e451b95 100644
--- a/source3/lib/talloc.c
+++ b/source3/lib/talloc.c
@@ -287,6 +287,15 @@ char *talloc_strdup(TALLOC_CTX *t, const char *p)
return NULL;
}
+/** strdup_w with a talloc */
+smb_ucs2_t *talloc_strdup_w(TALLOC_CTX *t, const smb_ucs2_t *p)
+{
+ if (p)
+ return talloc_memdup(t, p, (strlen_w(p) + 1) * sizeof(smb_ucs2_t));
+ else
+ return NULL;
+}
+
/**
* Perform string formatting, and return a pointer to newly allocated
* memory holding the result, inside a memory pool.
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index a1cff26169..ba02819bdc 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -775,3 +775,44 @@ int unistrcpy(uint16 *dst, uint16 *src)
return num_wchars;
}
+
+/**
+ * Samba ucs2 type to UNISTR2 conversion
+ *
+ * @param ctx Talloc context to create the dst strcture (if null) and the
+ * contents of the unicode string.
+ * @param dst UNISTR2 destination. If equals null, then it's allocated.
+ * @param src smb_ucs2_t source.
+ * @param max_len maximum number of unicode characters to copy. If equals
+ * null, then null-termination of src is taken
+ *
+ * @return copied UNISTR2 destination
+ **/
+UNISTR2* ucs2_to_unistr2(TALLOC_CTX *ctx, UNISTR2* dst, smb_ucs2_t* src)
+{
+ size_t len;
+
+ if (!src) return NULL;
+ len = strlen_w(src);
+
+ /* allocate UNISTR2 destination if not given */
+ if (!dst) {
+ dst = (UNISTR2*) talloc(ctx, sizeof(UNISTR2));
+ if (!dst) return NULL;
+ }
+ if (!dst->buffer) {
+ dst->buffer = (uint16*) talloc(ctx, sizeof(uint16) * (len + 1));
+ if (!dst->buffer) return NULL;
+ }
+
+ /* set UNISTR2 parameters */
+ dst->uni_max_len = len + 1;
+ dst->undoc = 0;
+ dst->uni_str_len = len;
+
+ /* copy the actual unicode string */
+ strncpy_w(dst->buffer, src, dst->uni_max_len);
+
+ return dst;
+};
+
diff --git a/source3/libsmb/cli_samr.c b/source3/libsmb/cli_samr.c
index 85a7375f99..f3560ede5d 100644
--- a/source3/libsmb/cli_samr.c
+++ b/source3/libsmb/cli_samr.c
@@ -971,7 +971,7 @@ NTSTATUS cli_samr_lookup_rids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
NTSTATUS cli_samr_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *domain_pol, uint32 flags,
- uint32 num_names, char **names,
+ uint32 num_names, const char **names,
uint32 *num_rids, uint32 **rids,
uint32 **rid_types)
{
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index b3507a1392..073317824b 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -1,6 +1,7 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) Andrew Tridgell 1992-2001
+ Copyright (C) Andrew Bartlett 2002
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
@@ -124,9 +125,13 @@ BOOL secrets_fetch_domain_sid(char *domain, DOM_SID *sid)
}
-/************************************************************************
-form a key for fetching the machine trust account password
-************************************************************************/
+/**
+ * Form a key for fetching the machine trust account password
+ *
+ * @param domain domain name
+ *
+ * @return stored password's key
+ **/
char *trust_keystr(char *domain)
{
static fstring keystr;
@@ -141,7 +146,7 @@ char *trust_keystr(char *domain)
/**
* Form a key for fetching a trusted domain password
*
- * @param domain domain name
+ * @param domain trusted domain name
*
* @return stored password's key
**/
@@ -194,21 +199,23 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16],
Routine to get account password to trusted domain
************************************************************************/
BOOL secrets_fetch_trusted_domain_password(char *domain, char** pwd,
- DOM_SID *sid, time_t *pass_last_set_time)
+ DOM_SID *sid, time_t *pass_last_set_time)
{
struct trusted_dom_pass *pass;
size_t size;
+ /* fetching trusted domain password structure */
if (!(pass = secrets_fetch(trustdom_keystr(domain), &size))) {
DEBUG(5, ("secrets_fetch failed!\n"));
return False;
}
-
+
if (size != sizeof(*pass)) {
DEBUG(0, ("secrets were of incorrect size!\n"));
return False;
}
-
+
+ /* the trust's password */
if (pwd) {
*pwd = strdup(pass->pass);
if (!*pwd) {
@@ -216,9 +223,12 @@ BOOL secrets_fetch_trusted_domain_password(char *domain, char** pwd,
}
}
+ /* last change time */
if (pass_last_set_time) *pass_last_set_time = pass->mod_time;
+ /* domain sid */
memcpy(&sid, &(pass->domain_sid), sizeof(sid));
+
SAFE_FREE(pass);
return True;
@@ -247,19 +257,30 @@ BOOL secrets_store_trust_account_password(char *domain, uint8 new_pwd[16])
* @return true if succeeded
**/
-BOOL secrets_store_trusted_domain_password(char* domain, char* pwd,
+BOOL secrets_store_trusted_domain_password(char* domain, smb_ucs2_t *uni_dom_name,
+ size_t uni_name_len, char* pwd,
DOM_SID sid)
{
struct trusted_dom_pass pass;
ZERO_STRUCT(pass);
+ /* unicode domain name and its length */
+ if (!uni_dom_name)
+ return False;
+
+ strncpy_w(pass.uni_name, uni_dom_name, sizeof(pass.uni_name) - 1);
+ pass.uni_name_len = uni_name_len;
+
+ /* last change time */
pass.mod_time = time(NULL);
+ /* password of the trust */
pass.pass_len = strlen(pwd);
fstrcpy(pass.pass, pwd);
+ /* domain sid */
memcpy(&(pass.domain_sid), &sid, sizeof(sid));
-
+
return secrets_store(trustdom_keystr(domain), (void *)&pass, sizeof(pass));
}
@@ -357,3 +378,100 @@ BOOL secrets_store_ldap_pw(char* dn, char* pw)
return secrets_store(key, pw, strlen(pw));
}
+
+/**
+ * The linked list is allocated on the supplied talloc context, caller gets to destory
+ * when done.
+ *
+ * @param start_idx starting index, eg. we can start fetching
+ * at third or sixth trusted domain entry
+ * @param num_domains number of domain entries to fetch at one call
+ *
+ * @return list of trusted domains structs (unicode name, sid and password)
+ **/
+
+NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int start_idx, int max_num_domains, int *num_domains, TRUSTDOM ***domains)
+{
+ TDB_LIST_NODE *keys, *k;
+ TRUSTDOM *dom = NULL;
+ char *pattern;
+ uint32 idx = 0;
+ size_t size;
+ struct trusted_dom_pass *pass;
+
+ secrets_init();
+
+ *num_domains = 0;
+
+ /* generate searching pattern */
+ if (!(pattern = talloc_asprintf(ctx, "%s/*", SECRETS_DOMTRUST_ACCT_PASS))) {
+ DEBUG(0, ("secrets_get_trusted_domains: talloc_asprintf() failed!\n"));
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ DEBUG(5, ("secrets_get_trusted_domains: looking for %d domains, starting at index %d\n",
+ max_num_domains, start_idx));
+
+ *domains = talloc_zero(ctx, sizeof(**domains)*max_num_domains);
+
+ /* fetching trusted domains' data and collecting them in a list */
+ keys = tdb_search_keys(tdb, pattern);
+
+ /* searching for keys in sectrets db -- way to go ... */
+ for (k = keys; k; k = k->next) {
+ char *secrets_key;
+
+ /* important: ensure null-termination of the key string */
+ secrets_key = strndup(k->node_key.dptr, k->node_key.dsize);
+ if (!secrets_key) {
+ DEBUG(0, ("strndup failed!\n"));
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ pass = secrets_fetch(secrets_key, &size);
+
+ if (size != sizeof(*pass)) {
+ DEBUG(2, ("Secrets record %s is invalid!\n", secrets_key));
+ SAFE_FREE(pass);
+ continue;
+ }
+
+ SAFE_FREE(secrets_key);
+
+ if (idx >= start_idx && idx < start_idx + max_num_domains) {
+ dom = talloc_zero(ctx, sizeof(*dom));
+ if (!dom) {
+ /* free returned tdb record */
+ SAFE_FREE(pass);
+
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ /* copy domain sid */
+ SMB_ASSERT(sizeof(dom->sid) == sizeof(pass->domain_sid));
+ memcpy(&(dom->sid), &(pass->domain_sid), sizeof(dom->sid));
+
+ /* copy unicode domain name */
+ dom->name = talloc_strdup_w(ctx, pass->uni_name);
+
+ (*domains)[*num_domains] = dom;
+
+ (*num_domains)++;
+
+ }
+
+ idx++;
+
+ /* free returned tdb record */
+ SAFE_FREE(pass);
+ }
+
+ DEBUG(5, ("secrets_get_trusted_domains: got %d of %d domains\n",
+ *num_domains, max_num_domains));
+
+ /* free the results of searching the keys */
+ tdb_search_list_free(keys);
+
+ return NT_STATUS_OK;
+}
+
diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c
index 91b54b9c83..415737ebfb 100644
--- a/source3/rpc_parse/parse_lsa.c
+++ b/source3/rpc_parse/parse_lsa.c
@@ -4,6 +4,7 @@
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
+ * Copyright (C) Andrew Bartlett 2002.
*
* 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
@@ -523,40 +524,63 @@ BOOL lsa_io_q_enum_trust_dom(char *desc, LSA_Q_ENUM_TRUST_DOM *q_e,
Inits an LSA_R_ENUM_TRUST_DOM structure.
********************************************************************/
-void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context,
- char *domain_name, DOM_SID *domain_sid,
- NTSTATUS status)
+void init_r_enum_trust_dom(TALLOC_CTX *ctx, LSA_R_ENUM_TRUST_DOM *r_e, uint32 enum_context,
+ uint32 requested_num_domains, uint32 num_domains, TRUSTDOM **td)
{
+ int i;
+
DEBUG(5, ("init_r_enum_trust_dom\n"));
r_e->enum_context = enum_context;
-
- if (NT_STATUS_IS_OK(status)) {
- int len_domain_name = strlen(domain_name) + 1;
-
- r_e->num_domains = 1;
- r_e->ptr_enum_domains = 1;
- r_e->num_domains2 = 1;
-
- if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2))))
- return;
+ r_e->num_domains = 0;
+ r_e->ptr_enum_domains = 0;
+ r_e->num_domains2 = 0;
+
+ if (num_domains == 0) {
+ r_e->status = NT_STATUS_NO_MORE_ENTRIES;
- if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2))))
+ } else {
+ /*
+ * allocating empty arrays of unicode headers, strings
+ * and sids of enumerated trusted domains
+ */
+ if (!(r_e->hdr_domain_name = (UNIHDR2 *)talloc(ctx,sizeof(UNIHDR2) * num_domains))) {
+ r_e->status = NT_STATUS_NO_MEMORY;
return;
+ }
+
+ if (!(r_e->uni_domain_name = (UNISTR2 *)talloc(ctx,sizeof(UNISTR2) * num_domains))) {
+ r_e->status = NT_STATUS_NO_MEMORY;
+ return;
+ }
- if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2))))
+ if (!(r_e->domain_sid = (DOM_SID2 *)talloc(ctx,sizeof(DOM_SID2) * num_domains))) {
+ r_e->status = NT_STATUS_NO_MEMORY;
return;
+ }
+
+ r_e->num_domains = num_domains;
+ r_e->num_domains2 = num_domains;
+
+ for (i = 0; i < num_domains; i++) {
+
+ /* don't know what actually is this for */
+ r_e->ptr_enum_domains = 1;
+
+ init_uni_hdr2(&r_e->hdr_domain_name[i], strlen_w((td[i])->name));
+ init_dom_sid2(&r_e->domain_sid[i], &(td[i])->sid);
+
+ init_unistr2_w(ctx, &r_e->uni_domain_name[i], (td[i])->name);
+
+ };
+
+ if (num_domains < requested_num_domains) {
+ r_e->status = NT_STATUS_NO_MORE_ENTRIES;
+ } else {
+ r_e->status = NT_STATUS_OK;
+ }
+ }
- init_uni_hdr2(&r_e->hdr_domain_name[0], len_domain_name);
- init_unistr2 (&r_e->uni_domain_name[0], domain_name,
- len_domain_name);
- init_dom_sid2(&r_e->domain_sid[0], domain_sid);
- } else {
- r_e->num_domains = 0;
- r_e->ptr_enum_domains = 0;
- }
-
- r_e->status = status;
}
/*******************************************************************
@@ -603,7 +627,7 @@ BOOL lsa_io_r_enum_trust_dom(char *desc, LSA_R_ENUM_TRUST_DOM *r_e,
for (i = 0; i < num_domains; i++) {
if(!smb_io_unistr2 ("", &r_e->uni_domain_name[i],
- r_e->hdr_domain_name[i].buffer,
+ r_e->hdr_domain_name[i].buffer,
ps, depth))
return False;
if(!smb_io_dom_sid2("", &r_e->domain_sid[i], ps,
diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c
index 73f285e320..f326681c64 100644
--- a/source3/rpc_parse/parse_misc.c
+++ b/source3/rpc_parse/parse_misc.c
@@ -916,6 +916,51 @@ void init_unistr2(UNISTR2 *str, const char *buf, size_t len)
rpcstr_push((char *)str->buffer, buf, len, STR_TERMINATE);
}
+/**
+ * Inits a UNISTR2 structure.
+ * @param ctx talloc context to allocate string on
+ * @param str pointer to string to create
+ * @param buf UCS2 null-terminated buffer to init from
+*/
+
+void init_unistr2_w(TALLOC_CTX *ctx, UNISTR2 *str, const smb_ucs2_t *buf)
+{
+ uint32 len = strlen_w(buf);
+ uint32 max_len = len;
+ uint32 alloc_len;
+
+ ZERO_STRUCTP(str);
+
+ /* set up string lengths. */
+ str->uni_max_len = len;
+ str->undoc = 0;
+ str->uni_str_len = len;
+
+ if (max_len < MAX_UNISTRLEN)
+ max_len = MAX_UNISTRLEN;
+
+ alloc_len = (max_len + 1) * sizeof(uint16);
+
+ str->buffer = (uint16 *)talloc_zero(ctx, alloc_len);
+ if ((str->buffer == NULL) && (alloc_len > 0))
+ {
+ smb_panic("init_unistr2_w: malloc fail\n");
+ return;
+ }
+
+ /*
+ * don't move this test above ! The UNISTR2 must be initialized !!!
+ * jfm, 7/7/2001.
+ */
+ if (buf==NULL)
+ return;
+
+ /* Yes, this is a strncpy( foo, bar, strlen(bar)) - but as
+ long as the buffer above is talloc()ed correctly then this
+ is the correct thing to do */
+ strncpy_w(str->buffer, buf, len + 1);
+}
+
/*******************************************************************
Inits a UNISTR2 structure from a UNISTR
********************************************************************/
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c
index 4edc0678af..b8a558665f 100644
--- a/source3/rpc_parse/parse_samr.c
+++ b/source3/rpc_parse/parse_samr.c
@@ -4535,7 +4535,7 @@ inits a SAMR_Q_LOOKUP_NAMES structure.
NTSTATUS init_samr_q_lookup_names(TALLOC_CTX *ctx, SAMR_Q_LOOKUP_NAMES * q_u,
POLICY_HND *pol, uint32 flags,
- uint32 num_names, char **name)
+ uint32 num_names, const char **name)
{
uint32 i;
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index fcd4be0212..3914556e88 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -105,8 +105,10 @@ static BOOL api_lsa_enum_trust_dom(pipes_struct *p)
if(!lsa_io_q_enum_trust_dom("", &q_u, data, 0))
return False;
+ /* get required trusted domains information */
r_u.status = _lsa_enum_trust_dom(p, &q_u, &r_u);
+ /* prepare the response */
if(!lsa_io_r_enum_trust_dom("", &r_u, rdata, 0))
return False;
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 84ab44bc30..c564323803 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -416,14 +416,18 @@ NTSTATUS _lsa_open_policy(pipes_struct *p, LSA_Q_OPEN_POL *q_u, LSA_R_OPEN_POL *
/***************************************************************************
_lsa_enum_trust_dom - this needs fixing to do more than return NULL ! JRA.
+ ufff, done :) mimir
***************************************************************************/
NTSTATUS _lsa_enum_trust_dom(pipes_struct *p, LSA_Q_ENUM_TRUST_DOM *q_u, LSA_R_ENUM_TRUST_DOM *r_u)
{
struct lsa_info *info;
- uint32 enum_context = 0;
- char *dom_name = NULL;
- DOM_SID *dom_sid = NULL;
+ uint32 enum_context = q_u->enum_context;
+ /* it's set to 10 as a "our" preferred length */
+ uint32 max_num_domains = q_u->preferred_len < 10 ? q_u->preferred_len : 10;
+ TRUSTDOM **trust_doms;
+ uint32 num_domains;
+ NTSTATUS nt_status;
if (!find_policy_by_hnd(p, &q_u->pol, (void **)&info))
return NT_STATUS_INVALID_HANDLE;
@@ -432,9 +436,13 @@ NTSTATUS _lsa_enum_trust_dom(pipes_struct *p, LSA_Q_ENUM_TRUST_DOM *q_u, LSA_R_E
if (!(info->access & POLICY_VIEW_LOCAL_INFORMATION))
return NT_STATUS_ACCESS_DENIED;
- /* set up the LSA QUERY INFO response */
- init_r_enum_trust_dom(p->mem_ctx, r_u, enum_context, dom_name, dom_sid,
- dom_name != NULL ? NT_STATUS_OK : NT_STATUS_NO_MORE_ENTRIES);
+ nt_status = secrets_get_trusted_domains(p->mem_ctx, enum_context, max_num_domains, &num_domains, &trust_doms);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return nt_status;
+ }
+
+ /* set up the lsa_enum_trust_dom response */
+ init_r_enum_trust_dom(p->mem_ctx, r_u, enum_context, max_num_domains, num_domains, trust_doms);
return r_u->status;
}
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c
index bc39082f63..92a5a9d37f 100644
--- a/source3/tdb/tdbutil.c
+++ b/source3/tdb/tdbutil.c
@@ -19,6 +19,7 @@
*/
#include "includes.h"
+#include
/* these are little tdb utility functions that are meant to make
dealing with a tdb database a little less cumbersome in Samba */
@@ -524,3 +525,74 @@ int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
{
return tdb_delete(the_tdb, key);
}
+
+
+
+/**
+ * Search across the whole tdb for keys that match the given pattern
+ * return the result as a list of keys
+ *
+ * @param tdb pointer to opened tdb file context
+ * @param pattern searching pattern used by fnmatch(3) functions
+ *
+ * @return list of keys found by looking up with given pattern
+ **/
+TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern)
+{
+ TDB_DATA key, next;
+ TDB_LIST_NODE *list = NULL;
+ TDB_LIST_NODE *rec = NULL;
+ TDB_LIST_NODE *tmp = NULL;
+
+ for (key = tdb_firstkey(tdb); key.dptr; key = next) {
+ /* duplicate key string to ensure null-termination */
+ char *key_str = (char*) strndup(key.dptr, key.dsize);
+ if (!key_str) {
+ DEBUG(0, ("tdb_search_keys: strndup() failed!\n"));
+ smb_panic("strndup failed!\n");
+ }
+
+ DEBUG(18, ("checking %s for match to pattern %s\n", key_str, pattern));
+
+ next = tdb_nextkey(tdb, key);
+
+ /* do the pattern checking */
+ if (fnmatch(pattern, key_str, 0) == 0) {
+ rec = (TDB_LIST_NODE*) malloc(sizeof(*rec));
+ ZERO_STRUCTP(rec);
+
+ rec->node_key = key;
+
+ DLIST_ADD_END(list, rec, tmp);
+
+ DEBUG(18, ("checking %s matched pattern %s\n", key_str, pattern));
+ } else {
+ free(key.dptr);
+ }
+
+ /* free duplicated key string */
+ free(key_str);
+ }
+
+ return list;
+
+};
+
+
+/**
+ * Free the list returned by tdb_search_keys
+ *
+ * @param node list of results found by tdb_search_keys
+ **/
+void tdb_search_list_free(TDB_LIST_NODE* node)
+{
+ TDB_LIST_NODE *next_node;
+
+ while (node) {
+ next_node = node->next;
+ SAFE_FREE(node);
+ node = next_node;
+ };
+};
+
+
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 2aca3f0485..315c2de030 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -451,7 +451,7 @@ static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid,
uint32 flags = 0x000003e8; /* Unknown */
result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
- flags, 1, (char **) &argv[0],
+ flags, 1, &argv[0],
&num_rids, &user_rids,
&name_types);
@@ -548,7 +548,7 @@ rpc_user_info_internals(const DOM_SID *domain_sid, struct cli_state *cli,
/* Get handle on user */
result = cli_samr_lookup_names(cli, mem_ctx, &domain_pol,
- flags, 1, (char **) &argv[0],
+ flags, 1, &argv[0],
&num_rids, &rids, &name_types);
if (!NT_STATUS_IS_OK(result)) goto done;
@@ -874,7 +874,7 @@ static NTSTATUS rpc_trustdom_add_internals(const DOM_SID *domain_sid, struct cli
if (argc != 1) {
d_printf("Usage: net rpc trustdom add \n");
- return NT_STATUS_OK;
+ return NT_STATUS_INVALID_PARAMETER;
}
/*
@@ -985,6 +985,12 @@ static int rpc_trustdom_establish(int argc, const char **argv) {
* Connect to \\server\ipc$ as 'our domain' account with password
*/
+ if (argc != 1) {
+ d_printf("Usage: net rpc trustdom add \n");
+ return -1;
+ }
+
+
domain_name = smb_xstrdup(argv[0]);
strupper(domain_name);
@@ -1061,10 +1067,8 @@ static int rpc_trustdom_establish(int argc, const char **argv) {
return -1;
}
- if (cli->nt_pipe_fnum) {
+ if (cli->nt_pipe_fnum)
cli_nt_session_close(cli);
- talloc_destroy(mem_ctx);
- }
/*
@@ -1103,6 +1107,17 @@ static int rpc_trustdom_establish(int argc, const char **argv) {
/* There should be actually query info level 3 (following nt serv behaviour),
but I still don't know if it's _really_ necessary */
+ /*
+ * Store the password in secrets db
+ */
+
+ if (!secrets_store_trusted_domain_password(domain_name, wks_info.uni_lan_grp.buffer,
+ wks_info.uni_lan_grp.uni_str_len, opt_password,
+ domain_sid)) {
+ DEBUG(0, ("Storing password for trusted domain failed.\n"));
+ return -1;
+ }
+
/*
* Close the pipes and clean up
*/
@@ -1116,20 +1131,9 @@ static int rpc_trustdom_establish(int argc, const char **argv) {
if (cli->nt_pipe_fnum)
cli_nt_session_close(cli);
-
- talloc_destroy(mem_ctx);
+ talloc_destroy(mem_ctx);
- /*
- * Store the password in secrets db
- */
-
- if (!secrets_store_trusted_domain_password(domain_name, opt_password,
- domain_sid)) {
- DEBUG(0, ("Storing password for trusted domain failed.\n"));
- return -1;
- }
-
DEBUG(0, ("Success!\n"));
return 0;
}
--
cgit
From cd58107e6ee337fdacb56ec51711c3164de4aecd Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Sun, 14 Apr 2002 09:45:09 +0000
Subject: Extra file for the tdb search code (linked list definition).
Andrew Bartlett
(This used to be commit c3312006009f5b312b285e3e679d01719012f29d)
---
source3/tdb/tdbutil.h | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 source3/tdb/tdbutil.h
diff --git a/source3/tdb/tdbutil.h b/source3/tdb/tdbutil.h
new file mode 100644
index 0000000000..01473446a1
--- /dev/null
+++ b/source3/tdb/tdbutil.h
@@ -0,0 +1,37 @@
+/*
+ Unix SMB/CIFS implementation.
+ tdb utility functions
+ Copyright (C) Andrew Tridgell 1999
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __TDBUTIL_H__
+#define __TDBUTIL_H__
+
+
+/* single node of a list returned by tdb_search_keys */
+typedef struct keys_node
+{
+ struct keys_node *prev, *next;
+ TDB_DATA node_key;
+} TDB_LIST_NODE;
+
+
+TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT*, const char*);
+void tdb_search_list_free(TDB_LIST_NODE*);
+
+
+#endif /* __TDBUTIL_H__ */
--
cgit
From 57630be652547356f8c570807ebf9cc7915e0fd8 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 10:50:32 +0000
Subject: Added a status code for lsa_lookup_{sids,names} returning the fact
that only some of the entries could be resolved. (This used to be commit
0722e71d1ef59a72567f383e3572546ab78e9e6a)
---
source3/include/nterr.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/source3/include/nterr.h b/source3/include/nterr.h
index ef8e6bd27f..a869e19738 100644
--- a/source3/include/nterr.h
+++ b/source3/include/nterr.h
@@ -30,6 +30,7 @@
#define NT_STATUS_NO_MORE_ENTRIES NT_STATUS(0x8000001a)
#define STATUS_MORE_ENTRIES NT_STATUS(0x0105)
+#define STATUS_SOME_UNMAPPED NT_STATUS(0x0107)
#define ERROR_INVALID_PARAMETER NT_STATUS(0x0057)
#define ERROR_INSUFFICIENT_BUFFER NT_STATUS(0x007a)
#define STATUS_NOTIFY_ENUM_DIR NT_STATUS(0x010c)
--
cgit
From 3a139656a336ac0b86632b9a32ed32ed85c969c0 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 11:13:49 +0000
Subject: Added error string for STATUS_SOME_UNMAPPED (This used to be commit
f736e115c00e02e3f131ccceb7769559dd4d908a)
---
source3/libsmb/nterr.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c
index b74dde9b14..faf5147fe2 100644
--- a/source3/libsmb/nterr.c
+++ b/source3/libsmb/nterr.c
@@ -534,6 +534,7 @@ nt_err_code_struct nt_errs[] =
{ "NT_STATUS_QUOTA_LIST_INCONSISTENT", NT_STATUS_QUOTA_LIST_INCONSISTENT },
{ "NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE },
{ "NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES },
+ { "STATUS_SOME_UNMAPPED", STATUS_SOME_UNMAPPED },
{ NULL, NT_STATUS(0) }
};
--
cgit
From d0386372b2f491cd9281fc6466b1b5d2f5cf59a9 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 11:21:25 +0000
Subject: The cli_lsa_lookup_{names,sids} functions were returning useless
information when one or more of the names/sids being queried were not
resolvable. We now return a list the same length as the parameters passed
instead of an array of just the resolvable names/sids. (This used to be
commit 245468dbabb7c849ce423cc3cb586fa913d0adfe)
---
source3/libsmb/cli_lsarpc.c | 41 +++++++++++++++++++++--------------------
source3/nsswitch/winbindd_rpc.c | 10 ++++------
source3/rpcclient/cmd_lsarpc.c | 26 ++++++++++++++++----------
source3/utils/smbcacls.c | 12 +++++-------
4 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/source3/libsmb/cli_lsarpc.c b/source3/libsmb/cli_lsarpc.c
index 3216854608..1989169fd7 100644
--- a/source3/libsmb/cli_lsarpc.c
+++ b/source3/libsmb/cli_lsarpc.c
@@ -230,7 +230,7 @@ NTSTATUS cli_lsa_close(struct cli_state *cli, TALLOC_CTX *mem_ctx,
NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *pol, int num_sids, DOM_SID *sids,
- char ***domains, char ***names, uint32 **types, int *num_names)
+ char ***domains, char ***names, uint32 **types)
{
prs_struct qbuf, rbuf;
LSA_Q_LOOKUP_SIDS q;
@@ -274,13 +274,13 @@ NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
result = r.status;
if (!NT_STATUS_IS_OK(result) &&
- NT_STATUS_V(result) != NT_STATUS_V(NT_STATUS_FILES_OPEN)) {
+ NT_STATUS_V(result) != NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
+
/* An actual error occured */
goto done;
}
-
/* Return output parameters */
if (r.mapped_count == 0) {
@@ -288,28 +288,28 @@ NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done;
}
- (*num_names) = r.mapped_count;
- result = NT_STATUS_OK;
-
- if (!((*domains) = (char **)talloc(mem_ctx, sizeof(char *) * r.mapped_count))) {
+ if (!((*domains) = (char **)talloc(mem_ctx, sizeof(char *) *
+ num_sids))) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!((*names) = (char **)talloc(mem_ctx, sizeof(char *) * r.mapped_count))) {
+ if (!((*names) = (char **)talloc(mem_ctx, sizeof(char *) *
+ num_sids))) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!((*types) = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.mapped_count))) {
+ if (!((*types) = (uint32 *)talloc(mem_ctx, sizeof(uint32) *
+ num_sids))) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- for (i = 0; i < r.mapped_count; i++) {
+ for (i = 0; i < num_sids; i++) {
fstring name, dom_name;
uint32 dom_idx = t_names.name[i].domain_idx;
@@ -348,8 +348,9 @@ NTSTATUS cli_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/** Lookup a list of names */
NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, int num_names, const char **names,
- DOM_SID **sids, uint32 **types, int *num_sids)
+ POLICY_HND *pol, int num_names,
+ const char **names, DOM_SID **sids,
+ uint32 **types)
{
prs_struct qbuf, rbuf;
LSA_Q_LOOKUP_NAMES q;
@@ -388,13 +389,14 @@ NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
result = r.status;
- if (!NT_STATUS_IS_OK(result)) {
+ if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
+ NT_STATUS_V(STATUS_SOME_UNMAPPED)) {
+
/* An actual error occured */
goto done;
}
-
/* Return output parameters */
if (r.mapped_count == 0) {
@@ -402,22 +404,21 @@ NTSTATUS cli_lsa_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done;
}
- (*num_sids) = r.mapped_count;
- result = NT_STATUS_OK;
-
- if (!((*sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) * r.mapped_count)))) {
+ if (!((*sids = (DOM_SID *)talloc(mem_ctx, sizeof(DOM_SID) *
+ num_names)))) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- if (!((*types = (uint32 *)talloc(mem_ctx, sizeof(uint32) * r.mapped_count)))) {
+ if (!((*types = (uint32 *)talloc(mem_ctx, sizeof(uint32) *
+ num_names)))) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
- for (i = 0; i < r.mapped_count; i++) {
+ for (i = 0; i < num_names; i++) {
DOM_RID2 *t_rids = r.dom_rid;
uint32 dom_idx = t_rids[i].rid_idx;
uint32 dom_rid = t_rids[i].rid;
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c
index 5af42ee041..39433419b0 100644
--- a/source3/nsswitch/winbindd_rpc.c
+++ b/source3/nsswitch/winbindd_rpc.c
@@ -187,7 +187,6 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
NTSTATUS status;
DOM_SID *sids = NULL;
uint32 *types = NULL;
- int num_sids;
const char *full_name;
if (!(mem_ctx = talloc_init_named("name_to_sid[rpc] for [%s]\\[%s]", domain->name, name))) {
@@ -209,9 +208,10 @@ static NTSTATUS name_to_sid(struct winbindd_domain *domain,
}
status = cli_lsa_lookup_names(hnd->cli, mem_ctx, &hnd->pol, 1,
- &full_name, &sids, &types, &num_sids);
+ &full_name, &sids, &types);
- /* Return rid and type if lookup successful */
+ /* Return rid and type if lookup successful */
+
if (NT_STATUS_IS_OK(status)) {
sid_copy(sid, &sids[0]);
*type = types[0];
@@ -234,15 +234,13 @@ static NTSTATUS sid_to_name(struct winbindd_domain *domain,
char **domains;
char **names;
uint32 *types;
- int num_names;
NTSTATUS status;
if (!(hnd = cm_get_lsa_handle(domain->name)))
return NT_STATUS_UNSUCCESSFUL;
status = cli_lsa_lookup_sids(hnd->cli, mem_ctx, &hnd->pol,
- 1, sid, &domains, &names, &types,
- &num_names);
+ 1, sid, &domains, &names, &types);
if (NT_STATUS_IS_OK(status)) {
*type = types[0];
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index 99f1fbc3ce..1f8b14ae04 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -78,7 +78,7 @@ static NTSTATUS cmd_lsa_lookup_names(struct cli_state *cli,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
DOM_SID *sids;
uint32 *types;
- int num_names, i;
+ int i;
if (argc == 1) {
printf("Usage: %s [name1 [name2 [...]]]\n", argv[0]);
@@ -93,15 +93,17 @@ static NTSTATUS cmd_lsa_lookup_names(struct cli_state *cli,
goto done;
result = cli_lsa_lookup_names(cli, mem_ctx, &pol, argc - 1,
- (const char**)(argv + 1), &sids,
- &types, &num_names);
+ (const char**)(argv + 1), &sids, &types);
- if (!NT_STATUS_IS_OK(result))
+ if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
+ NT_STATUS_V(STATUS_SOME_UNMAPPED))
goto done;
+ result = NT_STATUS_OK;
+
/* Print results */
- for (i = 0; i < num_names; i++) {
+ for (i = 0; i < (argc - 1); i++) {
fstring sid_str;
sid_to_string(sid_str, &sids[i]);
@@ -124,7 +126,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
char **domains;
char **names;
uint32 *types;
- int num_names, i;
+ int i;
if (argc == 1) {
printf("Usage: %s [sid1 [sid2 [...]]]\n", argv[0]);
@@ -153,18 +155,21 @@ static NTSTATUS cmd_lsa_lookup_sids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Lookup the SIDs */
result = cli_lsa_lookup_sids(cli, mem_ctx, &pol, argc - 1, sids,
- &domains, &names, &types, &num_names);
+ &domains, &names, &types);
- if (!NT_STATUS_IS_OK(result))
+ if (!NT_STATUS_IS_OK(result) && NT_STATUS_V(result) !=
+ NT_STATUS_V(STATUS_SOME_UNMAPPED))
goto done;
+ result = NT_STATUS_OK;
+
/* Print results */
- for (i = 0; i < num_names; i++) {
+ for (i = 0; i < (argc - 1); i++) {
fstring sid_str;
sid_to_string(sid_str, &sids[i]);
- printf("%s [%s]\\[%s] (%d)\n", sid_str,
+ printf("%s %s\\%s (%d)\n", sid_str,
domains[i] ? domains[i] : "*unknown*",
names[i] ? names[i] : "*unknown*", types[i]);
}
@@ -446,6 +451,7 @@ static NTSTATUS cmd_lsa_lookupprivvalue(struct cli_state *cli,
goto done;
/* Print results */
+
printf("%u:%u (0x%x:0x%x)\n", luid.high, luid.low, luid.high, luid.low);
done:
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 8c0b2a4a72..017f4035b0 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -108,7 +108,6 @@ static void SidToString(fstring str, DOM_SID *sid)
char **domains = NULL;
char **names = NULL;
uint32 *types = NULL;
- int num_names;
sid_to_string(str, sid);
@@ -118,8 +117,8 @@ static void SidToString(fstring str, DOM_SID *sid)
if (!cacls_open_policy_hnd() ||
!NT_STATUS_IS_OK(cli_lsa_lookup_sids(&lsa_cli, lsa_cli.mem_ctx,
- &pol, 1, sid, &domains, &names,
- &types, &num_names)) ||
+ &pol, 1, sid, &domains,
+ &names, &types)) ||
!domains || !domains[0] || !names || !names[0]) {
return;
}
@@ -137,7 +136,6 @@ static BOOL StringToSid(DOM_SID *sid, const char *str)
{
uint32 *types = NULL;
DOM_SID *sids = NULL;
- int num_sids;
BOOL result = True;
if (strncmp(str, "S-", 2) == 0) {
@@ -145,9 +143,9 @@ static BOOL StringToSid(DOM_SID *sid, const char *str)
}
if (!cacls_open_policy_hnd() ||
- !NT_STATUS_IS_OK(cli_lsa_lookup_names(&lsa_cli, lsa_cli.mem_ctx, &pol, 1,
- &str,
- &sids, &types, &num_sids))) {
+ !NT_STATUS_IS_OK(cli_lsa_lookup_names(&lsa_cli, lsa_cli.mem_ctx,
+ &pol, 1, &str, &sids,
+ &types))) {
result = False;
goto done;
}
--
cgit
From 26152050bb9f327d67360fa2997344787d9073c7 Mon Sep 17 00:00:00 2001
From: Volker Lendecke
Date: Sun, 14 Apr 2002 12:14:52 +0000
Subject: Merge from 2_2.
Volker
(This used to be commit 8973a01f5efa547ed356e27fe1660da732b24cdd)
---
docs/docbook/manpages/smb.conf.5.sgml | 8 ++++++--
source3/utils/testparm.c | 9 +++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/docs/docbook/manpages/smb.conf.5.sgml b/docs/docbook/manpages/smb.conf.5.sgml
index 2adab907dc..384aacb998 100644
--- a/docs/docbook/manpages/smb.conf.5.sgml
+++ b/docs/docbook/manpages/smb.conf.5.sgml
@@ -8101,8 +8101,12 @@ veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/
and nss_winbind.so modules for UNIX services.
- Example: winbind separator = \
- Example: winbind separator = +
+ Please note that setting this parameter to + causes problems
+ with group membership at least on glibc systems, as the character +
+ is used as a special character for NIS in /etc/group.
+
+ Example: winbind separator = \\
+ Example: winbind separator = /
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index defde6cb2c..c6e417a2bc 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -152,6 +152,15 @@ via the %%o substitution. With encrypted passwords this is not possible.\n", lp_
}
}
+ if (strlen(lp_winbind_separator()) != 1) {
+ printf("ERROR: the 'winbind separator' parameter must be a single character.\n");
+ ret = 1;
+ }
+
+ if (*lp_winbind_separator() == '+') {
+ printf("'winbind separator = +' might cause problems with group membership.\n");
+ }
+
return ret;
}
--
cgit
From 8d680f879605b8e40fe2b4a16db5d860226e17a5 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 12:26:09 +0000
Subject: Added enumerate trusted domains. (This used to be commit
3a11ce31ca3eed23f3bf82c46b2ebd2423be737d)
---
source3/python/py_lsa.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/source3/python/py_lsa.c b/source3/python/py_lsa.c
index 1c84af5ea0..fecbf535aa 100644
--- a/source3/python/py_lsa.c
+++ b/source3/python/py_lsa.c
@@ -210,7 +210,7 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
result = PyList_New(num_sids);
for (i = 0; i < num_sids; i++) {
- PyObject *name_obj, *obj;
+ PyObject *obj;
obj = Py_BuildValue("{sssssi}", "username", names[i],
"domain", domains[i], "name_type",
@@ -222,18 +222,61 @@ static PyObject *lsa_lookup_sids(PyObject *self, PyObject *args,
return result;
}
+static PyObject *lsa_enum_trust_dom(PyObject *self, PyObject *args)
+{
+ lsa_policy_hnd_object *hnd = (lsa_policy_hnd_object *)self;
+ NTSTATUS ntstatus;
+ uint32 enum_ctx = 0, num_domains, i;
+ char **domain_names;
+ DOM_SID *domain_sids;
+ PyObject *result;
+
+ if (!PyArg_ParseTuple(args, ""))
+ return NULL;
+
+ ntstatus = cli_lsa_enum_trust_dom(hnd->cli, hnd->mem_ctx,
+ &hnd->pol, &enum_ctx,
+ &num_domains, &domain_names,
+ &domain_sids);
+
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ PyErr_SetObject(lsa_ntstatus, py_ntstatus_tuple(ntstatus));
+ return NULL;
+ }
+
+ result = PyList_New(num_domains);
+
+ for (i = 0; i < num_domains; i++) {
+ fstring sid_str;
+
+ sid_to_string(sid_str, &domain_sids[i]);
+ PyList_SetItem(
+ result, i,
+ Py_BuildValue("(ss)", domain_names[i], sid_str));
+ }
+
+ return result;
+}
+
/*
* Method dispatch tables
*/
static PyMethodDef lsa_hnd_methods[] = {
+ /* SIDs<->names */
+
{ "lookup_sids", lsa_lookup_sids, METH_VARARGS | METH_KEYWORDS,
"Convert sids to names." },
{ "lookup_names", lsa_lookup_names, METH_VARARGS | METH_KEYWORDS,
"Convert names to sids." },
+ /* Trusted domains */
+
+ { "enum_trusted_domains", lsa_enum_trust_dom, METH_VARARGS,
+ "Enumerate trusted domains." },
+
{ NULL }
};
--
cgit
From 3540c42bf4ac403b4a82e970b0e3566ffdc48407 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 23:33:31 +0000
Subject: Shutdown cli_state in the dealloc function. This happens
automatically when a handle object falls out of scope. (This used to be
commit 39546dd241b36d5e7b8e239525a13b91e4e9db80)
---
source3/python/py_spoolss.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index 450abbd6dc..b92e3c1758 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -192,6 +192,15 @@ Set the form given by the dictionary argument.
static void py_policy_hnd_dealloc(PyObject* self)
{
+ spoolss_policy_hnd_object *hnd;
+
+ /* Close down policy handle and free talloc context */
+
+ hnd = (spoolss_policy_hnd_object*)self;
+
+ cli_shutdown(hnd->cli);
+ talloc_destroy(hnd->mem_ctx);
+
PyObject_Del(self);
}
@@ -337,8 +346,7 @@ void initspoolss(void)
module = Py_InitModule("spoolss", spoolss_methods);
dict = PyModule_GetDict(module);
- /* Make spools_error global an exception we can raise when an error
- occurs. */
+ /* Exceptions we can raise */
spoolss_error = PyErr_NewException("spoolss.error", NULL, NULL);
PyDict_SetItemString(dict, "error", spoolss_error);
--
cgit
From f6da697708576f4ff3be0b3da5b7271754cbc1ef Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 23:36:01 +0000
Subject: Call PyErr_SetString instead of fprintf to stderr.
Don't clean up talloc and cli_state on close printer. They will be
destroyed in the handle dealloc function.
(This used to be commit 4114fe5996f84dfd14855ffdf666e065446607b4)
---
source3/python/py_spoolss_printers.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index b0033405ad..decc52e080 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -52,12 +52,15 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
if (!(cli = open_pipe_creds(computer_name, creds,
cli_spoolss_initialise, NULL))) {
- fprintf(stderr, "could not initialise cli state\n");
+
+ /* Error state set in open_pipe_creds() */
+
goto done;
}
if (!(mem_ctx = talloc_init())) {
- fprintf(stderr, "unable to initialise talloc context\n");
+ PyErr_SetString(spoolss_error,
+ "unable to initialise talloc context\n");
goto done;
}
@@ -99,11 +102,6 @@ PyObject *spoolss_closeprinter(PyObject *self, PyObject *args)
result = cli_spoolss_close_printer(hnd->cli, hnd->mem_ctx, &hnd->pol);
- /* Cleanup samba stuf */
-
- cli_shutdown(hnd->cli);
- talloc_destroy(hnd->mem_ctx);
-
/* Return value */
Py_INCREF(Py_None);
--
cgit
From 0c01601d31c401bc17747f91e72db82cd7454266 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 23:39:02 +0000
Subject: Explicitly return a list in py_ntstatus_tuple() and
py_werror_typle(). Not sure whether these should really be tuples or lists.
In open_pipe_creds() raise PyExc_RuntimeError exceptions if the pipe
connect function returns an error.
(This used to be commit 45cb1fed490d1fdafc5b63f2f5a33dfe5b334972)
---
source3/python/py_common.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/source3/python/py_common.c b/source3/python/py_common.c
index 019bcca07c..5b80f09498 100644
--- a/source3/python/py_common.c
+++ b/source3/python/py_common.c
@@ -27,7 +27,7 @@
PyObject *py_werror_tuple(WERROR werror)
{
- return Py_BuildValue("is", W_ERROR_V(werror),
+ return Py_BuildValue("[is]", W_ERROR_V(werror),
dos_errstr(werror));
}
@@ -35,7 +35,7 @@ PyObject *py_werror_tuple(WERROR werror)
PyObject *py_ntstatus_tuple(NTSTATUS ntstatus)
{
- return Py_BuildValue("is", NT_STATUS_V(ntstatus),
+ return Py_BuildValue("[is]", NT_STATUS_V(ntstatus),
nt_errstr(ntstatus));
}
@@ -189,7 +189,24 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
/* Now try to connect */
- connect_fn(cli, system_name, &nt_creds);
+ if (!connect_fn(cli, system_name, &nt_creds)) {
+ if (cli) {
+ NTSTATUS error = cli_nt_error(cli);
+
+ /* Raise an exception if something went wrong.
+ FIXME: This should be a more appropriate
+ exception than PyExc_RuntimeError */
+
+ if (!NT_STATUS_IS_OK(error))
+ PyErr_SetObject(PyExc_RuntimeError,
+ py_ntstatus_tuple(error));
+ else
+ PyErr_SetString(PyExc_RuntimeError,
+ "error connecting to pipe");
+ }
+
+ return NULL;
+ }
return cli;
}
--
cgit
From 9aabbc564f3d8b9080b9047665a7212c29e9c1f0 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sun, 14 Apr 2002 23:42:54 +0000
Subject: Rename new_policy_hnd_object() to new_spoolss_policy_hnd_object()
(This used to be commit 4bf6a9830acde47994975dffd578454ebb75e45a)
---
source3/python/py_spoolss.c | 4 ++--
source3/python/py_spoolss_printers.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/source3/python/py_spoolss.c b/source3/python/py_spoolss.c
index b92e3c1758..c87b6626fe 100644
--- a/source3/python/py_spoolss.c
+++ b/source3/python/py_spoolss.c
@@ -28,8 +28,8 @@ PyObject *spoolss_error, *spoolss_werror;
* Routines to convert from python hashes to Samba structures
*/
-PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol)
+PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, POLICY_HND *pol)
{
spoolss_policy_hnd_object *o;
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index decc52e080..69b2733cfb 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -75,7 +75,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
goto done;
}
- result = new_policy_hnd_object(cli, mem_ctx, &hnd);
+ result = new_spoolss_policy_hnd_object(cli, mem_ctx, &hnd);
done:
SAFE_FREE(computer_name);
--
cgit
From 4a5225bf6472347dda6eb7520e76a9a18f0e9f19 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Mon, 15 Apr 2002 01:11:40 +0000
Subject: Added hex values as comments for the standard access rights. (This
used to be commit 00511ae2b4bc0ef3bfda89cc0ae3e1fba092b6d6)
---
source3/include/smb.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 52b475ff27..6d3ce04400 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -1058,11 +1058,11 @@ struct bitmap {
#define SYNCHRONIZE_ACCESS (1L<<20) /* 0x00100000 */
/* Combinations of standard masks. */
-#define STANDARD_RIGHTS_ALL_ACCESS (DELETE_ACCESS|READ_CONTROL_ACCESS|WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS|SYNCHRONIZE_ACCESS)
-#define STANDARD_RIGHTS_EXECUTE_ACCESS (READ_CONTROL_ACCESS)
-#define STANDARD_RIGHTS_READ_ACCESS (READ_CONTROL_ACCESS)
-#define STANDARD_RIGHTS_REQUIRED_ACCESS (DELETE_ACCESS|READ_CONTROL_ACCESS|WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS)
-#define STANDARD_RIGHTS_WRITE_ACCESS (READ_CONTROL_ACCESS)
+#define STANDARD_RIGHTS_ALL_ACCESS (DELETE_ACCESS|READ_CONTROL_ACCESS|WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS|SYNCHRONIZE_ACCESS) /* 0x001f0000 */
+#define STANDARD_RIGHTS_EXECUTE_ACCESS (READ_CONTROL_ACCESS) /* 0x00020000 */
+#define STANDARD_RIGHTS_READ_ACCESS (READ_CONTROL_ACCESS) /* 0x00200000 */
+#define STANDARD_RIGHTS_REQUIRED_ACCESS (DELETE_ACCESS|READ_CONTROL_ACCESS|WRITE_DAC_ACCESS|WRITE_OWNER_ACCESS) /* 0x000f0000 */
+#define STANDARD_RIGHTS_WRITE_ACCESS (READ_CONTROL_ACCESS) /* 0x00020000 */
#define SYSTEM_SECURITY_ACCESS (1L<<24) /* 0x01000000 */
#define MAXIMUM_ALLOWED_ACCESS (1L<<25) /* 0x02000000 */
--
cgit
From 36514b65eed055282f2f391d18128536026d9485 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Mon, 15 Apr 2002 01:55:57 +0000
Subject: Fixed incorrect debug. (This used to be commit
3b6df44ddc80d728c01511529ccb05c1ba3d414b)
---
source3/lib/username.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 1504fd6a06..da603949bc 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -493,7 +493,7 @@ BOOL user_in_list(const char *user,char **list)
while (*list) {
- DEBUG(10,("user_in_list: checking user |%s| in group |%s|\n", user, *list));
+ DEBUG(10,("user_in_list: checking user |%s| against |%s|\n", user, *list));
/*
* Check raw username.
--
cgit
From 1667a821060b8bbc1cef3db473f6967cd02f5886 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Mon, 15 Apr 2002 04:07:13 +0000
Subject: Merge of print server permission handling fixes from HEAD.
Unit tests rock!
(This used to be commit bc673c42045ceb46d9569bc4d88f9c64897fc85a)
---
source3/printing/nt_printing.c | 16 ++++++++++++
source3/rpc_server/srv_spoolss_nt.c | 49 ++++++++++++++++++++++++++++---------
2 files changed, 53 insertions(+), 12 deletions(-)
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 907c3fd8e6..29bc185a6d 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -56,6 +56,22 @@ STANDARD_MAPPING printer_std_mapping = {
PRINTER_ALL_ACCESS
};
+/* Map generic permissions to print server object specific permissions */
+
+GENERIC_MAPPING printserver_generic_mapping = {
+ SERVER_READ,
+ SERVER_WRITE,
+ SERVER_EXECUTE,
+ SERVER_ALL_ACCESS
+};
+
+STANDARD_MAPPING printserver_std_mapping = {
+ SERVER_READ,
+ SERVER_WRITE,
+ SERVER_EXECUTE,
+ SERVER_ALL_ACCESS
+};
+
/* We need one default form to support our default printer. Msoft adds the
forms it wants and in the ORDER it wants them (note: DEVMODE papersize is an
array index). Letter is always first, so (for the current code) additions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 3bc91c2472..a8552cd14d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -92,7 +92,8 @@ static uint32 smb_connections=0;
/* in printing/nt_printing.c */
-extern STANDARD_MAPPING printer_std_mapping;
+
+extern STANDARD_MAPPING printer_std_mapping, printserver_std_mapping;
#define OUR_HANDLE(hnd) (((hnd)==NULL)?"NULL":(IVAL((hnd)->data5,4)==(uint32)sys_getpid()?"OURS":"OTHER")), \
((unsigned int)IVAL((hnd)->data5,4)),((unsigned int)sys_getpid())
@@ -959,26 +960,50 @@ Can't find printer handle we created for printer %s\n", name ));
get_current_user(&user, p);
if (Printer->printer_type == PRINTER_HANDLE_IS_PRINTSERVER) {
- if (printer_default->access_required == 0) {
- return WERR_OK;
+
+ /* Printserver handles use global struct... */
+
+ snum = -1;
+
+ /* Map standard access rights to object specific access
+ rights */
+
+ se_map_standard(&printer_default->access_required,
+ &printserver_std_mapping);
+
+ /* Deny any object specific bits that don't apply to print
+ servers (i.e printer and job specific bits) */
+
+ printer_default->access_required &= SPECIFIC_RIGHTS_MASK;
+
+ if (printer_default->access_required &
+ ~(SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE)) {
+ DEBUG(3, ("access DENIED for non-printserver bits"));
+ close_printer_handle(p, handle);
+ return WERR_ACCESS_DENIED;
}
- else if ((printer_default->access_required & SERVER_ACCESS_ADMINISTER ) == SERVER_ACCESS_ADMINISTER) {
- /* Printserver handles use global struct... */
- snum = -1;
+ /* Allow admin access */
+
+ if (printer_default->access_required &
+ SERVER_ACCESS_ADMINISTER) {
if (!lp_ms_add_printer_wizard()) {
close_printer_handle(p, handle);
return WERR_ACCESS_DENIED;
}
- else if (user.uid == 0 || user_in_list(uidtoname(user.uid), lp_printer_admin(snum))) {
+
+ if (user.uid == 0 ||
+ user_in_list(uidtoname(user.uid),
+ lp_printer_admin(snum)))
return WERR_OK;
- }
- else {
- close_printer_handle(p, handle);
- return WERR_ACCESS_DENIED;
- }
+
+ close_printer_handle(p, handle);
+ return WERR_ACCESS_DENIED;
}
+
+ /* We fall through to return WERR_OK */
+
}
else
{
--
cgit
From f6929068a19ef65fad5928982fd4ac4434e1763e Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Mon, 15 Apr 2002 04:55:37 +0000
Subject: by using a prompter function we can avoid the bug in the MIT kerberos
libraries with handling blank passwords. (This used to be commit
59d755ffb57c322a104ff8f52819956cafff1bac)
---
source3/libads/kerberos.c | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c
index 194a71275e..85518a6769 100644
--- a/source3/libads/kerberos.c
+++ b/source3/libads/kerberos.c
@@ -24,6 +24,28 @@
#ifdef HAVE_KRB5
+/*
+ we use a prompter to avoid a crash bug in the kerberos libs when
+ dealing with empty passwords
+ this prompter is just a string copy ...
+*/
+static krb5_error_code
+kerb_prompter(krb5_context ctx, void *data,
+ const char *name,
+ const char *banner,
+ int num_prompts,
+ krb5_prompt prompts[])
+{
+ if (num_prompts == 0) return 0;
+
+ memset(prompts[0].reply->data, 0, prompts[0].reply->length);
+ if (prompts[0].reply->length > 0) {
+ strncpy(prompts[0].reply->data, data, prompts[0].reply->length-1);
+ prompts[0].reply->length = strlen(prompts[0].reply->data);
+ }
+ return 0;
+}
+
/*
simulate a kinit, putting the tgt in the default cache location
remus@snapserver.com
@@ -36,11 +58,6 @@ int kerberos_kinit_password(const char *principal, const char *password)
krb5_principal me;
krb5_creds my_creds;
- if (! *password) {
- /* kerberos dies on an empty password! */
- return KRB5_PARSE_MALFORMED;
- }
-
if ((code = krb5_init_context(&ctx)))
return code;
@@ -54,8 +71,9 @@ int kerberos_kinit_password(const char *principal, const char *password)
return code;
}
- if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, (char*)password, NULL,
- NULL, 0, NULL, NULL))) {
+ if ((code = krb5_get_init_creds_password(ctx, &my_creds, me, NULL,
+ kerb_prompter,
+ password, 0, NULL, NULL))) {
krb5_free_principal(ctx, me);
krb5_free_context(ctx);
return code;
--
cgit
From b5c61023ff666dcdfda59ebb0bd80fe42837d482 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Mon, 15 Apr 2002 06:56:01 +0000
Subject: better handling of DOS LANMAN2.1 protocol (This used to be commit
7f923d738b94eef042b21e4d0143861755620d91)
---
source3/libsmb/cliconnect.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 8ddd116679..4ed2aae1f3 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -34,6 +34,7 @@ prots[] =
{PROTOCOL_LANMAN1,"MICROSOFT NETWORKS 3.0"},
{PROTOCOL_LANMAN1,"LANMAN1.0"},
{PROTOCOL_LANMAN2,"LM1.2X002"},
+ {PROTOCOL_LANMAN2,"DOS LANMAN2.1"},
{PROTOCOL_LANMAN2,"Samba"},
{PROTOCOL_NT1,"NT LANMAN 1.0"},
{PROTOCOL_NT1,"NT LM 0.12"},
@@ -45,7 +46,7 @@ prots[] =
do an old lanman2 style session setup
****************************************************************************/
static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user,
- char *pass, int passlen)
+ char *pass, int passlen, const char *workgroup)
{
fstring pword;
char *p;
@@ -88,7 +89,10 @@ static BOOL cli_session_setup_lanman2(struct cli_state *cli, char *user,
p = smb_buf(cli->outbuf);
memcpy(p,pword,passlen);
p += passlen;
- p += clistr_push(cli, p, user, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, user, -1, STR_TERMINATE|STR_UPPER);
+ p += clistr_push(cli, p, workgroup, -1, STR_TERMINATE|STR_UPPER);
+ p += clistr_push(cli, p, "Unix", -1, STR_TERMINATE);
+ p += clistr_push(cli, p, "Samba", -1, STR_TERMINATE);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
@@ -591,7 +595,7 @@ BOOL cli_session_setup(struct cli_state *cli,
/* if its an older server then we have to use the older request format */
if (cli->protocol < PROTOCOL_NT1) {
- return cli_session_setup_lanman2(cli, user, pass, passlen);
+ return cli_session_setup_lanman2(cli, user, pass, passlen, workgroup);
}
/* if no user is supplied then we have to do an anonymous connection.
@@ -756,6 +760,10 @@ void cli_negprot_send(struct cli_state *cli)
char *p;
int numprots;
+ if (cli->protocol < PROTOCOL_NT1) {
+ cli->use_spnego = False;
+ }
+
memset(cli->outbuf,'\0',smb_size);
/* setup the protocol strings */
@@ -788,6 +796,10 @@ BOOL cli_negprot(struct cli_state *cli)
int numprots;
int plength;
+ if (cli->protocol < PROTOCOL_NT1) {
+ cli->use_spnego = False;
+ }
+
memset(cli->outbuf,'\0',smb_size);
/* setup the protocol strings */
@@ -822,7 +834,7 @@ BOOL cli_negprot(struct cli_state *cli)
return(False);
}
- cli->protocol = prots[SVAL(cli->inbuf,smb_vwv0)].prot;
+ cli->protocol = prots[SVAL(cli->inbuf,smb_vwv0)].prot;
if (cli->protocol >= PROTOCOL_NT1) {
/* NT protocol */
@@ -848,6 +860,7 @@ BOOL cli_negprot(struct cli_state *cli)
smb_buflen(cli->inbuf)-8, STR_UNICODE|STR_NOALIGN);
}
} else if (cli->protocol >= PROTOCOL_LANMAN1) {
+ cli->use_spnego = False;
cli->sec_mode = SVAL(cli->inbuf,smb_vwv1);
cli->max_xmit = SVAL(cli->inbuf,smb_vwv2);
cli->sesskey = IVAL(cli->inbuf,smb_vwv6);
@@ -860,6 +873,7 @@ BOOL cli_negprot(struct cli_state *cli)
cli->secblob = data_blob(smb_buf(cli->inbuf),smb_buflen(cli->inbuf));
} else {
/* the old core protocol */
+ cli->use_spnego = False;
cli->sec_mode = 0;
cli->serverzone = TimeDiff(time(NULL));
}
--
cgit
From 3fca495f8c7a1579beda3305b207af6a988bac4c Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Mon, 15 Apr 2002 06:57:17 +0000
Subject: this fixes the displaying of free disk space for DOS6 clients.
Win2000 changes its behaviour based on the negotiated protocol for the
SMBdskattr SMB (This used to be commit
b693917530d649e22a677bd3bb1adedbfdd89bba)
---
source3/smbd/reply.c | 51 +++++++++++++++++++++++++++++++++++++--------------
1 file changed, 37 insertions(+), 14 deletions(-)
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index fbb981781f..60b1d13417 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -542,23 +542,46 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
****************************************************************************/
int reply_dskattr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
- int outsize = 0;
- SMB_BIG_UINT dfree,dsize,bsize;
- START_PROFILE(SMBdskattr);
-
- conn->vfs_ops.disk_free(conn,".",True,&bsize,&dfree,&dsize);
-
- outsize = set_message(outbuf,5,0,True);
+ int outsize = 0;
+ SMB_BIG_UINT dfree,dsize,bsize;
+ START_PROFILE(SMBdskattr);
+
+ conn->vfs_ops.disk_free(conn,".",True,&bsize,&dfree,&dsize);
- SSVAL(outbuf,smb_vwv0,dsize);
- SSVAL(outbuf,smb_vwv1,bsize/512);
- SSVAL(outbuf,smb_vwv2,512);
- SSVAL(outbuf,smb_vwv3,dfree);
+ outsize = set_message(outbuf,5,0,True);
+
+ if (Protocol <= PROTOCOL_LANMAN2) {
+ double total_space, free_space;
+ /* we need to scale this to a number that DOS6 can handle. We
+ use floating point so we can handle large drives on systems
+ that don't have 64 bit integers
- DEBUG(3,("dskattr dfree=%d\n", (unsigned int)dfree));
+ we end up displaying a maximum of 2G to DOS systems
+ */
+ total_space = dsize * (double)bsize;
+ free_space = dfree * (double)bsize;
- END_PROFILE(SMBdskattr);
- return(outsize);
+ dsize = (total_space+63*512) / (64*512);
+ dfree = (free_space+63*512) / (64*512);
+
+ if (dsize > 0xFFFF) dsize = 0xFFFF;
+ if (dfree > 0xFFFF) dfree = 0xFFFF;
+
+ SSVAL(outbuf,smb_vwv0,dsize);
+ SSVAL(outbuf,smb_vwv1,64); /* this must be 64 for dos systems */
+ SSVAL(outbuf,smb_vwv2,512); /* and this must be 512 */
+ SSVAL(outbuf,smb_vwv3,dfree);
+ } else {
+ SSVAL(outbuf,smb_vwv0,dsize);
+ SSVAL(outbuf,smb_vwv1,bsize/512);
+ SSVAL(outbuf,smb_vwv2,512);
+ SSVAL(outbuf,smb_vwv3,dfree);
+ }
+
+ DEBUG(3,("dskattr dfree=%d\n", (unsigned int)dfree));
+
+ END_PROFILE(SMBdskattr);
+ return(outsize);
}
--
cgit
From b84cce809baceeb7a24b3a98e9bef47279aad3ca Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Mon, 15 Apr 2002 07:29:47 +0000
Subject: Skeleton for SAMR module. (This used to be commit
70bd1a0f94412236bf6603f16947336cb75c6415)
---
source3/python/py_samr.c | 206 +++++++++++++++++++++++++++++++++++++++++++++
source3/python/py_samr.h | 83 ++++++++++++++++++
source3/python/setup.py.in | 9 ++
3 files changed, 298 insertions(+)
create mode 100644 source3/python/py_samr.c
create mode 100644 source3/python/py_samr.h
diff --git a/source3/python/py_samr.c b/source3/python/py_samr.c
new file mode 100644
index 0000000000..2271cb4464
--- /dev/null
+++ b/source3/python/py_samr.c
@@ -0,0 +1,206 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_samr.h"
+
+PyObject *new_samr_connect_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_connect_hnd_object *o;
+
+ o = PyObject_New(samr_connect_hnd_object, &samr_connect_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/*
+ * Exceptions raised by this module
+ */
+
+PyObject *samr_error; /* This indicates a non-RPC related error
+ such as name lookup failure */
+
+PyObject *samr_ntstatus; /* This exception is raised when a RPC call
+ returns a status code other than
+ NT_STATUS_OK */
+
+static void py_samr_connect_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+#if 0
+
+static PyObject *py_samr_connect_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_connect_methods, self, attrname);
+}
+
+#endif
+
+PyTypeObject samr_connect_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Connect Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_domain_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Domain Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_user_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR User Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_group_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Group Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+PyTypeObject samr_alias_hnd_type = {
+ PyObject_HEAD_INIT(NULL)
+ 0,
+ "SAMR Alias Handle",
+ sizeof(samr_connect_hnd_object),
+ 0,
+ py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash */
+};
+
+static PyMethodDef samr_methods[] = {
+
+ /* Open/close samr connect handles */
+
+#if 0
+ { "connect", lsa_open_policy, METH_VARARGS | METH_KEYWORDS,
+ "Open a connect handle" },
+
+ { "close", lsa_close, METH_VARARGS, "Close a policy handle" },
+#endif
+
+ { NULL }
+};
+
+/*
+ * Module initialisation
+*/
+
+void initsamr(void)
+{
+ PyObject *module, *dict;
+
+ /* Initialise module */
+
+ module = Py_InitModule("samr", samr_methods);
+ dict = PyModule_GetDict(module);
+
+ samr_error = PyErr_NewException("samr.error", NULL, NULL);
+ PyDict_SetItemString(dict, "error", samr_error);
+
+ samr_ntstatus = PyErr_NewException("samr.ntstatus", NULL, NULL);
+ PyDict_SetItemString(dict, "ntstatus", samr_ntstatus);
+
+ /* Initialise policy handle object */
+
+ samr_connect_hnd_type.ob_type = &PyType_Type;
+ samr_domain_hnd_type.ob_type = &PyType_Type;
+ samr_user_hnd_type.ob_type = &PyType_Type;
+ samr_group_hnd_type.ob_type = &PyType_Type;
+ samr_alias_hnd_type.ob_type = &PyType_Type;
+
+ /* Initialise constants */
+
+// const_init(dict);
+
+ /* Do samba initialisation */
+
+ py_samba_init();
+
+ setup_logging("samr", True);
+ DEBUGLEVEL = 10;
+}
diff --git a/source3/python/py_samr.h b/source3/python/py_samr.h
new file mode 100644
index 0000000000..52352cc64d
--- /dev/null
+++ b/source3/python/py_samr.h
@@ -0,0 +1,83 @@
+/*
+ Python wrappers for DCERPC/SMB client routines.
+
+ Copyright (C) Tim Potter, 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _PY_SAMR_H
+#define _PY_SAMR_H
+
+#include "includes.h"
+#include "Python.h"
+
+#include "python/py_common.h"
+
+/* SAMR connect policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_connect_hnd_object;
+
+/* SAMR domain policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_domain_hnd_object;
+
+/* SAMR user policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_user_hnd_object;
+
+/* SAMR group policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_group_hnd_object;
+
+/* SAMR alias policy handle object */
+
+typedef struct {
+ PyObject_HEAD
+ struct cli_state *cli;
+ TALLOC_CTX *mem_ctx;
+ POLICY_HND pol;
+} samr_alias_hnd_object;
+
+extern PyTypeObject samr_connect_hnd_type, samr_domain_hnd_type,
+ samr_user_hnd_type, samr_group_hnd_type, samr_alias_hnd_type;
+
+/* Exceptions raised by this module */
+
+extern PyObject *samr_error;
+
+// #include "python/py_samr_proto.h"
+
+#endif /* _PY_SAMR_H */
diff --git a/source3/python/setup.py.in b/source3/python/setup.py.in
index 59182f5def..6bc568fa1d 100755
--- a/source3/python/setup.py.in
+++ b/source3/python/setup.py.in
@@ -111,6 +111,15 @@ setup(
library_dirs = ["/usr/kerberos/lib"],
extra_objects = obj_list),
+ # SAMR pipe module
+
+ Extension(name = "samr",
+ sources = [samba_srcdir + "python/py_samr.c",
+ samba_srcdir + "python/py_common.c"],
+ libraries = lib_list,
+ library_dirs = ["/usr/kerberos/lib"],
+ extra_objects = obj_list),
+
# winbind client module
Extension(name = "winbind",
--
cgit
From 6d239fc97fb95033d590ee214d1e58f89ea6d269 Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Mon, 15 Apr 2002 08:50:36 +0000
Subject: Another patch from jelmer:
Doco for pdbedit and (ugly, but the best we could come up with) fix
for compiling pdbedit on some non-gcc compilers.
Andrew Bartlett
(This used to be commit 80adf1dbb56cf8bdbfbcc2c8c7b670c0a23c97f8)
---
docs/docbook/manpages/pdbedit.8.sgml | 26 +++++++++-----
source3/utils/pdbedit.c | 68 ++++++++++++++++++++----------------
2 files changed, 55 insertions(+), 39 deletions(-)
diff --git a/docs/docbook/manpages/pdbedit.8.sgml b/docs/docbook/manpages/pdbedit.8.sgml
index eeb1fb0d2c..3f6023d16f 100644
--- a/docs/docbook/manpages/pdbedit.8.sgml
+++ b/docs/docbook/manpages/pdbedit.8.sgml
@@ -27,7 +27,9 @@
-a
-m
-x
- -i file
+ -i passdb-backend
+ -e passdb-backend
+ -D debuglevel
@@ -233,18 +235,26 @@
- -i file
- This command is used to import a smbpasswd
- file into the database.
+ -i passdb-backend
+ Use a different passdb backend to retrieve users than the one specified in smb.conf.
- This option will ease migration from the plain smbpasswd
- file database to more powerful backend databases like tdb and
- ldap.
+ This option will ease migration from one passdb backend to another.
+
- Example: pdbedit -i /etc/smbpasswd.old
+ Example: pdbedit -i smbpasswd:/etc/smbpasswd.old -e tdbsam:/etc/samba/passwd.tdb
+
+
+ -e passdb-backend
+ Export all currently available users to the specified password database backend.
+
+ This option will ease migration from one passdb backend to another and will ease backupping
+
+ Example: pdbedit -e smbpasswd:/root/samba-users.backup
+
+
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index c63ed29529..2cbc9eb71d 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -394,24 +394,25 @@ static int delete_machine_entry (struct pdb_context *in, char *machinename)
int main (int argc, char **argv)
{
- struct pdb_context *in;
- BOOL list_users = False;
- BOOL verbose = False;
- BOOL spstyle = False;
- BOOL setparms = False;
- BOOL machine = False;
- BOOL add_user = False;
- BOOL delete_user = False;
- BOOL import = False;
+ static BOOL list_users = False;
+ static BOOL verbose = False;
+ static BOOL spstyle = False;
+ static BOOL setparms = False;
+ static BOOL machine = False;
+ static BOOL add_user = False;
+ static BOOL delete_user = False;
+ static BOOL import = False;
int opt;
- char *full_name = NULL;
- char *user_name = NULL;
- char *home_dir = NULL;
- char *home_drive = NULL;
- char *backend_in = NULL;
- char *backend_out = NULL;
- char *logon_script = NULL;
- char *profile_path = NULL;
+ static char *full_name = NULL;
+ static char *user_name = NULL;
+ static char *home_dir = NULL;
+ static char *home_drive = NULL;
+ static char *backend_in = NULL;
+ static char *backend_out = NULL;
+ static char *logon_script = NULL;
+ static char *profile_path = NULL;
+
+ struct pdb_context *in;
poptContext pc;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -432,14 +433,14 @@ int main (int argc, char **argv)
{"debuglevel",'D',POPT_ARG_INT,&DEBUGLEVEL,0,"set debuglevel",NULL},
{0,0,0,0}
};
-
+
DEBUGLEVEL = 1;
setup_logging("pdbedit", True);
AllowDebugChange = False;
-
+
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
- dyn_CONFIGFILE);
+ dyn_CONFIGFILE);
exit(1);
}
@@ -456,7 +457,7 @@ int main (int argc, char **argv)
fprintf (stderr, "Incompatible options on command line!\n");
exit(1);
}
-
+
if(!NT_STATUS_IS_OK(make_pdb_context_name(&in, backend_in))){
fprintf(stderr, "Can't initialize %s.\n", backend_in);
@@ -471,7 +472,9 @@ int main (int argc, char **argv)
if (machine)
return new_machine (in, user_name);
else
- return new_user (in, user_name, full_name, home_dir, home_drive, logon_script, profile_path);
+ return new_user (in, user_name, full_name, home_dir,
+ home_drive, logon_script,
+ profile_path);
}
if (delete_user) {
@@ -484,16 +487,17 @@ int main (int argc, char **argv)
else
return delete_user_entry (in, user_name);
}
-
+
if (user_name) {
if (setparms)
- return set_user_info (in, user_name, full_name,
- home_dir,
- home_drive,
- logon_script,
- profile_path);
+ return set_user_info (in, user_name, full_name,
+ home_dir,
+ home_drive,
+ logon_script,
+ profile_path);
else
- return print_user_info (in, user_name, verbose, spstyle);
+ return print_user_info (in, user_name, verbose,
+ spstyle);
}
if (list_users)
@@ -501,8 +505,10 @@ int main (int argc, char **argv)
if (backend_out)
return export_database(in, backend_out);
-
+
poptPrintHelp(pc, stderr, 0);
-
+
return 1;
}
+
+
--
cgit
From 4d917cd8f5dad460a9c63fba823b9bf45eba28d5 Mon Sep 17 00:00:00 2001
From: Gerald Carter
Date: Mon, 15 Apr 2002 13:35:18 +0000
Subject: merge from SAMBA_2_2 (This used to be commit
fedc11cab16dbecfdae858fc48d629b9172c0fb8)
---
source3/smbd/nttrans.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index ed2979b3a4..edee14513c 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -467,7 +467,7 @@ static int nt_open_pipe(char *fname, connection_struct *conn,
/* See if it is one we want to handle. */
if (lp_disable_spoolss() && strequal(fname, "\\spoolss"))
- return(ERROR_DOS(ERRSRV,ERRaccess));
+ return(ERROR_BOTH(NT_STATUS_OBJECT_NAME_NOT_FOUND,ERRDOS,ERRbadpipe));
for( i = 0; known_nt_pipes[i]; i++ )
if( strequal(fname,known_nt_pipes[i]))
--
cgit
From 37e4471dea4e3140270d90f3f685ad4fb15fb036 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Mon, 15 Apr 2002 23:33:09 +0000
Subject: Stubs for connect, domain, user, group and alias policy objects.
Wrote samr connect fn.
(This used to be commit f2155aa3f4608b14777092002c39358b816dbea5)
---
source3/python/py_samr.c | 241 +++++++++++++++++++++++++++++++++++++++--------
1 file changed, 202 insertions(+), 39 deletions(-)
diff --git a/source3/python/py_samr.c b/source3/python/py_samr.c
index 2271cb4464..9a19f9abd5 100644
--- a/source3/python/py_samr.c
+++ b/source3/python/py_samr.c
@@ -23,20 +23,6 @@
#include "python/py_samr.h"
-PyObject *new_samr_connect_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol)
-{
- samr_connect_hnd_object *o;
-
- o = PyObject_New(samr_connect_hnd_object, &samr_connect_hnd_type);
-
- o->cli = cli;
- o->mem_ctx = mem_ctx;
- memcpy(&o->pol, pol, sizeof(POLICY_HND));
-
- return (PyObject*)o;
-}
-
/*
* Exceptions raised by this module
*/
@@ -48,20 +34,22 @@ PyObject *samr_ntstatus; /* This exception is raised when a RPC call
returns a status code other than
NT_STATUS_OK */
+/* SAMR connect handle object */
+
static void py_samr_connect_hnd_dealloc(PyObject* self)
{
PyObject_Del(self);
}
-#if 0
+static PyMethodDef samr_connect_methods[] = {
+ { NULL }
+};
static PyObject *py_samr_connect_hnd_getattr(PyObject *self, char *attrname)
{
return Py_FindMethod(samr_connect_methods, self, attrname);
}
-#endif
-
PyTypeObject samr_connect_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
@@ -70,7 +58,7 @@ PyTypeObject samr_connect_hnd_type = {
0,
py_samr_connect_hnd_dealloc, /*tp_dealloc*/
0, /*tp_print*/
-// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ py_samr_connect_hnd_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -80,15 +68,45 @@ PyTypeObject samr_connect_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_samr_connect_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_connect_hnd_object *o;
+
+ o = PyObject_New(samr_connect_hnd_object, &samr_connect_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/* SAMR domain handle object */
+
+static void py_samr_domain_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+static PyMethodDef samr_domain_methods[] = {
+ { NULL }
+};
+
+static PyObject *py_samr_domain_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_domain_methods, self, attrname);
+}
+
PyTypeObject samr_domain_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
"SAMR Domain Handle",
- sizeof(samr_connect_hnd_object),
+ sizeof(samr_domain_hnd_object),
0,
- py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ py_samr_domain_hnd_dealloc, /*tp_dealloc*/
0, /*tp_print*/
-// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ py_samr_domain_hnd_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -98,15 +116,45 @@ PyTypeObject samr_domain_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_samr_domain_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_domain_hnd_object *o;
+
+ o = PyObject_New(samr_domain_hnd_object, &samr_domain_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/* SAMR user handle object */
+
+static void py_samr_user_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+static PyMethodDef samr_user_methods[] = {
+ { NULL }
+};
+
+static PyObject *py_samr_user_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_user_methods, self, attrname);
+}
+
PyTypeObject samr_user_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
"SAMR User Handle",
- sizeof(samr_connect_hnd_object),
+ sizeof(samr_user_hnd_object),
0,
- py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ py_samr_user_hnd_dealloc, /*tp_dealloc*/
0, /*tp_print*/
-// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ py_samr_user_hnd_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -116,15 +164,45 @@ PyTypeObject samr_user_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_samr_user_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_user_hnd_object *o;
+
+ o = PyObject_New(samr_user_hnd_object, &samr_user_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/* SAMR group handle object */
+
+static void py_samr_group_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+static PyMethodDef samr_group_methods[] = {
+ { NULL }
+};
+
+static PyObject *py_samr_group_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_group_methods, self, attrname);
+}
+
PyTypeObject samr_group_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
"SAMR Group Handle",
- sizeof(samr_connect_hnd_object),
+ sizeof(samr_group_hnd_object),
0,
- py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ py_samr_group_hnd_dealloc, /*tp_dealloc*/
0, /*tp_print*/
-// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ py_samr_group_hnd_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -134,15 +212,45 @@ PyTypeObject samr_group_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_samr_group_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_group_hnd_object *o;
+
+ o = PyObject_New(samr_group_hnd_object, &samr_group_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+/* Alias handle object */
+
+static void py_samr_alias_hnd_dealloc(PyObject* self)
+{
+ PyObject_Del(self);
+}
+
+static PyMethodDef samr_alias_methods[] = {
+ { NULL }
+};
+
+static PyObject *py_samr_alias_hnd_getattr(PyObject *self, char *attrname)
+{
+ return Py_FindMethod(samr_alias_methods, self, attrname);
+}
+
PyTypeObject samr_alias_hnd_type = {
PyObject_HEAD_INIT(NULL)
0,
"SAMR Alias Handle",
- sizeof(samr_connect_hnd_object),
+ sizeof(samr_alias_hnd_object),
0,
- py_samr_connect_hnd_dealloc, /*tp_dealloc*/
+ py_samr_alias_hnd_dealloc, /*tp_dealloc*/
0, /*tp_print*/
-// py_samr_connect_hnd_getattr, /*tp_getattr*/
+ py_samr_alias_hnd_getattr, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
@@ -152,24 +260,79 @@ PyTypeObject samr_alias_hnd_type = {
0, /*tp_hash */
};
+PyObject *new_samr_alias_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol)
+{
+ samr_alias_hnd_object *o;
+
+ o = PyObject_New(samr_alias_hnd_object, &samr_alias_hnd_type);
+
+ o->cli = cli;
+ o->mem_ctx = mem_ctx;
+ memcpy(&o->pol, pol, sizeof(POLICY_HND));
+
+ return (PyObject*)o;
+}
+
+static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
+{
+ static char *kwlist[] = { "server", "creds", "access", NULL };
+ uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
+ char *server_name;
+ struct cli_state *cli;
+ POLICY_HND hnd;
+ TALLOC_CTX *mem_ctx;
+ PyObject *result = NULL, *creds = NULL;
+ NTSTATUS ntstatus;
+
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kw, "s|O!i", kwlist, &server_name, &PyDict_Type,
+ &creds, &desired_access))
+ return NULL;
+
+ if (!(cli = open_pipe_creds(server_name, creds, cli_samr_initialise,
+ NULL))) {
+
+ /* Error state set in open_pipe_creds() */
+
+ goto done;
+ }
+
+ if (!(mem_ctx = talloc_init())) {
+ PyErr_SetString(samr_ntstatus,
+ "unable to initialise talloc context\n");
+ goto done;
+ }
+
+ ntstatus = cli_samr_connect(cli, mem_ctx, desired_access, &hnd);
+
+ if (!NT_STATUS_IS_OK(ntstatus)) {
+ cli_shutdown(cli);
+ SAFE_FREE(cli);
+ PyErr_SetObject(samr_ntstatus, py_ntstatus_tuple(ntstatus));
+ goto done;
+ }
+
+ result = new_samr_connect_hnd_object(cli, mem_ctx, &hnd);
+
+done:
+ return result;
+}
+
+/*
+ * Module initialisation
+ */
+
static PyMethodDef samr_methods[] = {
/* Open/close samr connect handles */
-#if 0
- { "connect", lsa_open_policy, METH_VARARGS | METH_KEYWORDS,
+ { "connect", samr_connect, METH_VARARGS | METH_KEYWORDS,
"Open a connect handle" },
- { "close", lsa_close, METH_VARARGS, "Close a policy handle" },
-#endif
-
{ NULL }
};
-/*
- * Module initialisation
-*/
-
void initsamr(void)
{
PyObject *module, *dict;
--
cgit
From a95d731fa496db9bf4f8173b0661fe080c1bcaed Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Mon, 15 Apr 2002 23:48:39 +0000
Subject: make sure that we leave the tree unused after disconnecting (This
used to be commit e75e4ad7d3af5beee48b3001fd904eede8df033f)
---
source3/smbd/service.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 9ca44b65c3..467bab4a0a 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -750,5 +750,9 @@ void close_cnum(connection_struct *conn, uint16 vuid)
standard_sub_conn(conn,cmd);
smbrun(cmd,NULL);
}
+
+ /* make sure we leave the directory available for unmount */
+ vfs_ChDir(conn, "/");
+
conn_free(conn);
}
--
cgit
From e7b729e0d9d6264e85be042b16aa6aee0648fcfd Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 06:15:28 +0000
Subject: make sure we don't walk past the end of the current SMB buffer when
pulling a string this might explain a serious filename corruption bug that
Quantum QA spotted (This used to be commit
a877eae24becad9e0cd5b33ffe0916a20d5ba227)
---
source3/smbd/ipc.c | 2 +-
source3/smbd/message.c | 8 ++++----
source3/smbd/nttrans.c | 17 ++++++++---------
source3/smbd/pipes.c | 2 +-
source3/smbd/reply.c | 42 +++++++++++++++++++++---------------------
source3/smbd/sesssetup.c | 14 +++++---------
source3/smbd/srvstr.c | 9 +++++++++
7 files changed, 49 insertions(+), 45 deletions(-)
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index c2f3b7b2f0..91b221968f 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -375,7 +375,7 @@ int reply_trans(connection_struct *conn, char *inbuf,char *outbuf, int size, int
START_PROFILE(SMBtrans);
memset(name, '\0',sizeof(name));
- srvstr_pull(inbuf, name, smb_buf(inbuf), sizeof(name), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, name, smb_buf(inbuf), sizeof(name), STR_TERMINATE);
if (dscnt > tdscnt || pscnt > tpscnt) {
exit_server("invalid trans parameters");
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 971834c012..c2eb16c99e 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -118,8 +118,8 @@ int reply_sends(connection_struct *conn,
outsize = set_message(outbuf,0,0,True);
p = smb_buf(inbuf)+1;
- p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE) + 1;
- p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_TERMINATE) + 1;
msg = p;
@@ -160,8 +160,8 @@ int reply_sendstrt(connection_struct *conn,
msgpos = 0;
p = smb_buf(inbuf)+1;
- p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE) + 1;
- p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, msgfrom, p, sizeof(msgfrom), STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, msgto, p, sizeof(msgto), STR_TERMINATE) + 1;
DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index edee14513c..4dec0069f8 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -502,7 +502,7 @@ static int do_ntcreate_pipe_open(connection_struct *conn,
int pnum = -1;
char *p = NULL;
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0)
return ret;
@@ -609,7 +609,7 @@ int reply_ntcreate_and_X(connection_struct *conn,
* Check to see if this is a mac fork of some kind.
*/
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
if( strchr_m(fname, ':')) {
END_PROFILE(SMBntcreateX);
@@ -635,10 +635,9 @@ int reply_ntcreate_and_X(connection_struct *conn,
dir_name_len++;
}
- srvstr_pull(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len,
- -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len, STR_TERMINATE);
} else {
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
}
/*
@@ -880,7 +879,7 @@ static int do_nt_transact_create_pipe( connection_struct *conn,
return ERROR_DOS(ERRDOS,ERRbadaccess);
}
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
if ((ret = nt_open_pipe(fname, conn, inbuf, outbuf, &pnum)) != 0)
return ret;
@@ -1096,7 +1095,7 @@ static int call_nt_transact_create(connection_struct *conn,
* Check to see if this is a mac fork of some kind.
*/
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
if( strchr_m(fname, ':')) {
return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
@@ -1122,9 +1121,9 @@ static int call_nt_transact_create(connection_struct *conn,
}
srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len,
- -1, STR_TERMINATE);
+ total_parameter_count-53, STR_TERMINATE);
} else {
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
}
/*
diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c
index 6c1e6efa73..f7e9c595c1 100644
--- a/source3/smbd/pipes.c
+++ b/source3/smbd/pipes.c
@@ -50,7 +50,7 @@ int reply_open_pipe_and_X(connection_struct *conn,
int i;
/* XXXX we need to handle passed times, sattr and flags */
- srvstr_pull(inbuf, pipe_name, smb_buf(inbuf), sizeof(pipe_name), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, pipe_name, smb_buf(inbuf), sizeof(pipe_name), STR_TERMINATE);
/* If the name doesn't start \PIPE\ then this is directed */
/* at a mailslot or something we really, really don't understand, */
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 60b1d13417..0ccdf7c241 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -163,10 +163,10 @@ int reply_tcon(connection_struct *conn,
*service = *password = *dev = 0;
p = smb_buf(inbuf)+1;
- p += srvstr_pull(inbuf, service, p, sizeof(service), -1, STR_TERMINATE) + 1;
- pwlen = srvstr_pull(inbuf, password, p, sizeof(password), -1, STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, service, p, sizeof(service), STR_TERMINATE) + 1;
+ pwlen = srvstr_pull_buf(inbuf, password, p, sizeof(password), STR_TERMINATE) + 1;
p += pwlen;
- p += srvstr_pull(inbuf, dev, p, sizeof(dev), -1, STR_TERMINATE) + 1;
+ p += srvstr_pull_buf(inbuf, dev, p, sizeof(dev), STR_TERMINATE) + 1;
p = strrchr_m(service,'\\');
if (p) {
@@ -233,7 +233,7 @@ int reply_tcon_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
}
p = smb_buf(inbuf) + passlen;
- p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, path, p, sizeof(path), STR_TERMINATE);
/*
* the service name can be either: \\server\share
@@ -377,7 +377,7 @@ int reply_chkpth(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
SMB_STRUCT_STAT sbuf;
START_PROFILE(SMBchkpth);
- srvstr_pull(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), STR_TERMINATE);
RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
@@ -429,7 +429,7 @@ int reply_getatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
START_PROFILE(SMBgetatr);
p = smb_buf(inbuf) + 1;
- p += srvstr_pull(inbuf, fname, p, sizeof(fname), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, fname, p, sizeof(fname), STR_TERMINATE);
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -505,7 +505,7 @@ int reply_setatr(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
START_PROFILE(SMBsetatr);
p = smb_buf(inbuf) + 1;
- p += srvstr_pull(inbuf, fname, p, sizeof(fname), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, fname, p, sizeof(fname), STR_TERMINATE);
unix_convert(fname,conn,0,&bad_path,&sbuf);
mode = SVAL(inbuf,smb_vwv0);
@@ -625,7 +625,7 @@ int reply_search(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
maxentries = SVAL(inbuf,smb_vwv0);
dirtype = SVAL(inbuf,smb_vwv1);
p = smb_buf(inbuf) + 1;
- p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, path, p, sizeof(path), STR_TERMINATE);
p++;
status_len = SVAL(p, 0);
p += 2;
@@ -806,7 +806,7 @@ int reply_fclose(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
outsize = set_message(outbuf,1,0,True);
p = smb_buf(inbuf) + 1;
- p += srvstr_pull(inbuf, path, p, sizeof(path), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, path, p, sizeof(path), STR_TERMINATE);
p++;
status_len = SVAL(p,0);
p += 2;
@@ -854,7 +854,7 @@ int reply_open(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
share_mode = SVAL(inbuf,smb_vwv0);
- srvstr_pull(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), STR_TERMINATE);
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -944,7 +944,7 @@ int reply_open_and_X(connection_struct *conn, char *inbuf,char *outbuf,int lengt
}
/* XXXX we need to handle passed times, sattr and flags */
- srvstr_pull(inbuf, fname, smb_buf(inbuf), sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -1063,7 +1063,7 @@ int reply_mknew(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
com = SVAL(inbuf,smb_com);
createmode = SVAL(inbuf,smb_vwv0);
- srvstr_pull(inbuf, fname, smb_buf(inbuf) + 1, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf) + 1, sizeof(fname), STR_TERMINATE);
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -1135,7 +1135,7 @@ int reply_ctemp(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
START_PROFILE(SMBctemp);
createmode = SVAL(inbuf,smb_vwv0);
- srvstr_pull(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf)+1, sizeof(fname), STR_TERMINATE);
pstrcat(fname,"\\TMXXXXXX");
RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
@@ -1393,7 +1393,7 @@ int reply_unlink(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
dirtype = SVAL(inbuf,smb_vwv0);
- srvstr_pull(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, name, smb_buf(inbuf) + 1, sizeof(name), STR_TERMINATE);
RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
@@ -2742,7 +2742,7 @@ int reply_mkdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
NTSTATUS status;
START_PROFILE(SMBmkdir);
- srvstr_pull(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), STR_TERMINATE);
status = mkdir_internal(conn, directory);
if (!NT_STATUS_IS_OK(status))
@@ -2903,7 +2903,7 @@ int reply_rmdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
SMB_STRUCT_STAT sbuf;
START_PROFILE(SMBrmdir);
- srvstr_pull(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, directory, smb_buf(inbuf) + 1, sizeof(directory), STR_TERMINATE);
RESOLVE_DFSPATH(directory, conn, inbuf, outbuf)
@@ -3264,9 +3264,9 @@ int reply_mv(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
START_PROFILE(SMBmv);
p = smb_buf(inbuf) + 1;
- p += srvstr_pull(inbuf, name, p, sizeof(name), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, name, p, sizeof(name), STR_TERMINATE);
p++;
- p += srvstr_pull(inbuf, newname, p, sizeof(newname), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, newname, p, sizeof(newname), STR_TERMINATE);
RESOLVE_DFSPATH(name, conn, inbuf, outbuf);
RESOLVE_DFSPATH(newname, conn, inbuf, outbuf);
@@ -3396,8 +3396,8 @@ int reply_copy(connection_struct *conn, char *inbuf,char *outbuf, int dum_size,
*directory = *mask = 0;
p = smb_buf(inbuf);
- p += srvstr_pull(inbuf, name, p, sizeof(name), -1, STR_TERMINATE);
- p += srvstr_pull(inbuf, newname, p, sizeof(newname), -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, name, p, sizeof(name), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, newname, p, sizeof(newname), STR_TERMINATE);
DEBUG(3,("reply_copy : %s -> %s\n",name,newname));
@@ -3549,7 +3549,7 @@ int reply_setdir(connection_struct *conn, char *inbuf,char *outbuf, int dum_size
return ERROR_DOS(ERRDOS,ERRnoaccess);
}
- srvstr_pull(inbuf, newdir, smb_buf(inbuf) + 1, sizeof(newdir), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, newdir, smb_buf(inbuf) + 1, sizeof(newdir), STR_TERMINATE);
if (strlen(newdir) == 0) {
ok = True;
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 270a69d96a..8b9d826067 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -611,7 +611,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
plaintext_password.data[passlen1] = 0;
}
- srvstr_pull(inbuf, user, smb_buf(inbuf)+passlen1, sizeof(user), -1, STR_TERMINATE);
+ srvstr_pull_buf(inbuf, user, smb_buf(inbuf)+passlen1, sizeof(user), STR_TERMINATE);
*domain = 0;
} else {
@@ -674,14 +674,10 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,
}
p += passlen1 + passlen2;
- p += srvstr_pull(inbuf, user, p, sizeof(user), -1,
- STR_TERMINATE);
- p += srvstr_pull(inbuf, domain, p, sizeof(domain),
- -1, STR_TERMINATE);
- p += srvstr_pull(inbuf, native_os, p, sizeof(native_os),
- -1, STR_TERMINATE);
- p += srvstr_pull(inbuf, native_lanman, p, sizeof(native_lanman),
- -1, STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, user, p, sizeof(user), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, domain, p, sizeof(domain), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, native_os, p, sizeof(native_os), STR_TERMINATE);
+ p += srvstr_pull_buf(inbuf, native_lanman, p, sizeof(native_lanman), STR_TERMINATE);
DEBUG(3,("Domain=[%s] NativeOS=[%s] NativeLanMan=[%s]\n",
domain,native_os,native_lanman));
}
diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c
index 90da422f13..36fecf5bd2 100644
--- a/source3/smbd/srvstr.c
+++ b/source3/smbd/srvstr.c
@@ -30,3 +30,12 @@ int srvstr_pull(void *base_ptr, char *dest, const void *src, int dest_len, int s
{
return pull_string(base_ptr, dest, src, dest_len, src_len, flags);
}
+
+/* pull a string from the smb_buf part of a packet. In this case the
+ string can either be null terminated or it can be terminated by the
+ end of the smbbuf area
+*/
+int srvstr_pull_buf(void *inbuf, char *dest, const void *src, int dest_len, int flags)
+{
+ return pull_string(inbuf, dest, src, dest_len, smb_bufrem(inbuf, src), flags);
+}
--
cgit
From 02f84c6bd0c06c3dacc93d6413d6645367f42744 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 10:40:23 +0000
Subject: i forgot to commit these parts of the string handling patch earlier.
Sorry. (This used to be commit bac0093a9713416b1679d1bc167b70f02b06ef78)
---
source3/include/smb_macros.h | 5 ++++-
source3/lib/charcnv.c | 10 +++++-----
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index c19be784a1..27a5961651 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -169,9 +169,12 @@
#define SMB_ROUNDUP_ALLOCATION(s) ((s) ? (SMB_ROUNDUP((SMB_OFF_T)((s)+1), ((SMB_OFF_T)SMB_ROUNDUP_ALLOCATION_SIZE))) : 0 )
/* Extra macros added by Ying Chen at IBM - speed increase by inlining. */
-#define smb_buf(buf) (buf + smb_size + CVAL(buf,smb_wct)*2)
+#define smb_buf(buf) ((buf) + smb_size + CVAL(buf,smb_wct)*2)
#define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2))
+/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */
+#define smb_bufrem(buf, p) (smb_buflen(buf)-PTR_DIFF(p, smb_buf(buf)))
+
/* Note that chain_size must be available as an extern int to this macro. */
#define smb_offset(p,buf) (PTR_DIFF(p,buf+4) + chain_size)
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index cdfca8eb97..be7701237e 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -354,7 +354,7 @@ int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags
dest_len = sizeof(pstring);
}
- if (flags & STR_TERMINATE) src_len = strlen(src)+1;
+ if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen(src)+1;
ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len);
@@ -525,7 +525,7 @@ copy a string from a ucs2 source to a unix char* destination
flags can have:
STR_TERMINATE means the string in src is null terminated
STR_NOALIGN means don't try to align
-if STR_TERMINATE is set then src_len is ignored
+if STR_TERMINATE is set then src_len is ignored if it is -1
src_len is the length of the source area in bytes
return the number of bytes occupied by the string in src
the resulting string in "dest" is always null terminated
@@ -543,7 +543,7 @@ int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, i
if (src_len > 0) src_len--;
}
- if (flags & STR_TERMINATE) src_len = strlen_w(src)*2+2;
+ if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen_w(src)*2+2;
/* ucs2 is always a multiple of 2 bytes */
src_len &= ~1;
@@ -609,7 +609,7 @@ int pull_utf8(char *dest, const void *src, int dest_len, int src_len, int flags)
dest_len = sizeof(pstring);
}
- if (flags & STR_TERMINATE) src_len = strlen(src)+1;
+ if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen(src)+1;
ret = convert_string(CH_UTF8, CH_UNIX, src, src_len, dest, dest_len);
if (dest_len) dest[MIN(ret, dest_len-1)] = 0;
@@ -687,7 +687,7 @@ flags can have:
STR_UNICODE means to force as unicode
STR_ASCII use ascii even with unicode packet
STR_NOALIGN means don't do alignment
-if STR_TERMINATE is set then src_len is ignored
+if STR_TERMINATE is set then src_len is ignored is it is -1
src_len is the length of the source area in bytes
return the number of bytes occupied by the string in src
the resulting string in "dest" is always null terminated
--
cgit
From b66932e1a5dc3a368474e6e110c5a88a251465f5 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 12:07:12 +0000
Subject: fixed the handling of STR_TERMINATE (This used to be commit
dbc6b137a83cf9fe0558625dd32f92f15296fba6)
---
source3/configure.in | 2 +-
source3/lib/charcnv.c | 24 +++++++++++++++++++++---
source3/lib/util_str.c | 12 ++++++++++++
3 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/source3/configure.in b/source3/configure.in
index bbfdc2e382..91ea0ff99e 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -601,7 +601,7 @@ else
RUNPROG=""
fi
-AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
+AC_CHECK_FUNCS(dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64)
AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid)
AC_CHECK_FUNCS(memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid)
AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent)
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index be7701237e..803cda36c8 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -354,7 +354,13 @@ int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags
dest_len = sizeof(pstring);
}
- if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen(src)+1;
+ if (flags & STR_TERMINATE) {
+ if (src_len == -1) {
+ src_len = strlen(src)+1;
+ } else {
+ src_len = strnlen(src, src_len) + 1;
+ }
+ }
ret = convert_string(CH_DOS, CH_UNIX, src, src_len, dest, dest_len);
@@ -543,7 +549,13 @@ int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, i
if (src_len > 0) src_len--;
}
- if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen_w(src)*2+2;
+ if (flags & STR_TERMINATE) {
+ if (src_len == -1) {
+ src_len = strlen_w(src)*2+2;
+ } else {
+ src_len = strnlen_w(src, src_len/2)*2+2;
+ }
+ }
/* ucs2 is always a multiple of 2 bytes */
src_len &= ~1;
@@ -609,7 +621,13 @@ int pull_utf8(char *dest, const void *src, int dest_len, int src_len, int flags)
dest_len = sizeof(pstring);
}
- if (src_len == -1 && (flags & STR_TERMINATE)) src_len = strlen(src)+1;
+ if (flags & STR_TERMINATE) {
+ if (src_len == -1) {
+ src_len = strlen(src)+1;
+ } else {
+ src_len = strnlen(src, src_len) + 1;
+ }
+ }
ret = convert_string(CH_UTF8, CH_UNIX, src, src_len, dest, dest_len);
if (dest_len) dest[MIN(ret, dest_len-1)] = 0;
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 6fdca658cd..9a841a36b3 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1001,3 +1001,15 @@ some platforms don't have strndup
return ret;
}
#endif
+
+#ifndef HAVE_STRNLEN
+/*******************************************************************
+some platforms don't have strndup
+********************************************************************/
+ size_t strnlen(const char *s, size_t n)
+{
+ int i;
+ for (i=0; s[i] && i
Date: Tue, 16 Apr 2002 12:24:42 +0000
Subject: reran configure after adding a test for strnlen() (This used to be
commit 78ead781261d397ace22640e3820d0f4fe17722c)
---
source3/configure | 2 +-
source3/include/config.h.in | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/source3/configure b/source3/configure
index 5e2416abe7..3e13dc1b22 100755
--- a/source3/configure
+++ b/source3/configure
@@ -5257,7 +5257,7 @@ else
RUNPROG=""
fi
-for ac_func in dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64
+for ac_func in dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5264: checking for $ac_func" >&5
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
index 7328d022c1..afe49d419c 100644
--- a/source3/include/config.h.in
+++ b/source3/include/config.h.in
@@ -809,6 +809,9 @@
/* Define if you have the strndup function. */
#undef HAVE_STRNDUP
+/* Define if you have the strnlen function. */
+#undef HAVE_STRNLEN
+
/* Define if you have the strpbrk function. */
#undef HAVE_STRPBRK
--
cgit
From f70836df9e44aaf076447190b310e43258179c23 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 12:27:54 +0000
Subject: ignore a few more files (This used to be commit
1c92fab4050f21b4c5cc962e0b80b5c551b24745)
---
source3/.cvsignore | 10 +++++++++-
source3/bin/.cvsignore | 2 ++
source3/tdb/.cvsignore | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/source3/.cvsignore b/source3/.cvsignore
index 77e82c5701..b68cf42338 100644
--- a/source3/.cvsignore
+++ b/source3/.cvsignore
@@ -1,8 +1,10 @@
*.po
*.po32
.headers.stamp
-.proto.stamp
+.inslog2
+.ix*
.proto.check
+.proto.stamp
ID
ID
Makefile
@@ -10,10 +12,16 @@ bin
config.cache
config.log
config.status
+configure.tridge
cvs.log
+diffs
+dmalloc.log
dmallog.log
dox
libtool
so_locations
+tca.log
testdir
testtmp
+trace.out
+typescript*
diff --git a/source3/bin/.cvsignore b/source3/bin/.cvsignore
index c152d8918a..c87d15fdb4 100644
--- a/source3/bin/.cvsignore
+++ b/source3/bin/.cvsignore
@@ -10,6 +10,7 @@ msgtest
net
nmbd
nmblookup
+nsstest
pdbedit
rpcclient
samsync
@@ -18,6 +19,7 @@ smbcacls
smbclient
smbcontrol
smbd
+smbfilter
smbgroupedit
smbmnt
smbmount
diff --git a/source3/tdb/.cvsignore b/source3/tdb/.cvsignore
index 15ff2846c7..66445fe269 100644
--- a/source3/tdb/.cvsignore
+++ b/source3/tdb/.cvsignore
@@ -1,5 +1,6 @@
*.po
*.po32
+tdbbackup
tdbdump
tdbtest
tdbtool
--
cgit
From 4fd802c444eac0e4ef270d35e6675d7a8f1de57f Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 13:10:54 +0000
Subject: fixed a problem with the smb_buf() macro on some compilers (This used
to be commit 66d6d4810ab7b0a1bf2039c387938aad69e01569)
---
source3/include/smb_macros.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h
index 27a5961651..a2351c705e 100644
--- a/source3/include/smb_macros.h
+++ b/source3/include/smb_macros.h
@@ -169,7 +169,7 @@
#define SMB_ROUNDUP_ALLOCATION(s) ((s) ? (SMB_ROUNDUP((SMB_OFF_T)((s)+1), ((SMB_OFF_T)SMB_ROUNDUP_ALLOCATION_SIZE))) : 0 )
/* Extra macros added by Ying Chen at IBM - speed increase by inlining. */
-#define smb_buf(buf) ((buf) + smb_size + CVAL(buf,smb_wct)*2)
+#define smb_buf(buf) (((char *)(buf)) + smb_size + CVAL(buf,smb_wct)*2)
#define smb_buflen(buf) (SVAL(buf,smb_vwv0 + (int)CVAL(buf, smb_wct)*2))
/* the remaining number of bytes in smb buffer 'buf' from pointer 'p'. */
--
cgit
From 7a661ac63c674472cf808d46bf48ea45a99e2041 Mon Sep 17 00:00:00 2001
From: Jean-François Micouleau
Date: Tue, 16 Apr 2002 15:49:24 +0000
Subject: we did not initialise global_myname and global_myworkgroup which lead
to duplicate entries in secrets.tdb and false SID generated.
took me *hours* to understand.
J.F.
(This used to be commit bfc3a25b776a5a66e1bd0e2c60c101cea87ef4d5)
---
source3/utils/smbgroupedit.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/source3/utils/smbgroupedit.c b/source3/utils/smbgroupedit.c
index cfa0dd8af9..04d46f4559 100644
--- a/source3/utils/smbgroupedit.c
+++ b/source3/utils/smbgroupedit.c
@@ -22,6 +22,7 @@
#include "includes.h"
extern pstring global_myname;
+extern pstring global_myworkgroup;
extern DOM_SID global_sam_sid;
/*
@@ -287,6 +288,18 @@ int main (int argc, char **argv)
dyn_CONFIGFILE);
exit(1);
}
+
+ if (!*global_myname) {
+ char *p;
+ pstrcpy( global_myname, myhostname() );
+ p = strchr_m(global_myname, '.' );
+ if (p)
+ *p = 0;
+ }
+
+ strupper(global_myname);
+
+ fstrcpy(global_myworkgroup, lp_workgroup());
if(!initialize_password_db(True)) {
fprintf(stderr, "Can't setup password database vectors.\n");
@@ -294,7 +307,7 @@ int main (int argc, char **argv)
}
if(pdb_generate_sam_sid()==False) {
- printf("Can not read machine SID\n");
+ fprintf(stderr, "Can not read machine SID\n");
return 0;
}
--
cgit
From 1d49e9bc71c8e88bbca8e9b9e70cdd04c9bec145 Mon Sep 17 00:00:00 2001
From: Gerald Carter
Date: Tue, 16 Apr 2002 16:49:08 +0000
Subject: merges from SAMBA_2_2 (This used to be commit
91929afbb0cad422cc6d05f9a10ba5c3d797d779)
---
source3/rpcclient/rpcclient.c | 105 ++++++++++++++++++++++++------------------
1 file changed, 61 insertions(+), 44 deletions(-)
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 688dd74004..7d49e7a9cb 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -576,7 +576,7 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd)
/* Print usage information */
static void usage(void)
{
- printf("Usage: rpcclient server [options]\n");
+ printf("Usage: rpcclient [options] server\n");
printf("\t-A or --authfile authfile file containing user credentials\n");
printf("\t-c or --command \"command string\" execute semicolon separated cmds\n");
@@ -660,52 +660,69 @@ static void usage(void)
pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
POPT_CONTEXT_KEEP_FIRST);
- while((opt = poptGetNextOpt(pc)) != -1) {
- switch (opt) {
- case 'A':
- /* only get the username, password, and domain from the file */
- read_authfile (opt_authfile, username,
- password, domain);
- if (strlen (password))
- got_pass = 1;
- break;
-
- case 'l':
- slprintf(logfile, sizeof(logfile) - 1, "%s.client",
- opt_logfile);
- lp_set_logfile(logfile);
- interactive = False;
- break;
-
- case 's':
- pstrcpy(dyn_CONFIGFILE, opt_configfile);
- break;
-
- case 'd':
- DEBUGLEVEL = opt_debuglevel;
- break;
-
- case 'U': {
- char *lp;
- pstrcpy(username,opt_username);
- if ((lp=strchr_m(username,'%'))) {
- *lp = 0;
- pstrcpy(password,lp+1);
- got_pass = 1;
- memset(strchr_m(opt_username,'%')+1,'X',strlen(password));
+ while (argc > optind) {
+ while((opt = poptGetNextOpt(pc)) != -1) {
+ switch (opt) {
+ case 'A':
+ /* only get the username, password, and domain from the file */
+ read_authfile (opt_authfile, username, password, domain);
+ if (strlen (password))
+ got_pass = 1;
+ break;
+
+ case 'l':
+ slprintf(logfile, sizeof(logfile) - 1, "%s.client",
+ opt_logfile);
+ lp_set_logfile(logfile);
+ interactive = False;
+ break;
+
+ case 's':
+ pstrcpy(dyn_CONFIGFILE, opt_configfile);
+ break;
+
+ case 'd':
+ DEBUGLEVEL = opt_debuglevel;
+ break;
+
+ case 'U': {
+ char *lp;
+ pstrcpy(username,opt_username);
+ if ((lp=strchr_m(username,'%'))) {
+ *lp = 0;
+ pstrcpy(password,lp+1);
+ got_pass = 1;
+ memset(strchr_m(opt_username,'%')+1,'X',strlen(password));
+ }
+ break;
}
- break;
- }
- case 'W':
- pstrcpy(domain, opt_domain);
- break;
-
- case 'h':
- default:
- usage();
- exit(1);
+ case 'W':
+ pstrcpy(domain, opt_domain);
+ break;
+
+ case 'h':
+ default:
+ usage();
+ exit(1);
+ }
}
+
+ if (argc > optind) {
+ if (strncmp("//", argv[optind], 2) == 0 ||
+ strncmp("\\\\", argv[optind], 2) == 0)
+ {
+ argv[optind] += 2;
+ }
+
+ pstrcpy(server, argv[optind]);
+ optind ++;
+ }
+ }
+
+ if (!server[0]) {
+ usage();
+ return 1;
}
poptFreeContext(pc);
--
cgit
From eebe9749e0f9d287e7320314b958260bd5a448be Mon Sep 17 00:00:00 2001
From: Gerald Carter
Date: Tue, 16 Apr 2002 16:52:20 +0000
Subject: few fixes and regenerate (This used to be commit
0ffda9ffad2073a5995ce34fde5c3b5fc4859b90)
---
docs/docbook/manpages/rpcclient.1.sgml | 2 +-
docs/htmldocs/rpcclient.1.html | 22 +++---
docs/htmldocs/smb.conf.5.html | 82 +++++++++++++++++----
docs/manpages/rpcclient.1 | 126 +++++++++++++++++----------------
docs/manpages/smb.conf.5 | 47 +++++++++---
5 files changed, 184 insertions(+), 95 deletions(-)
diff --git a/docs/docbook/manpages/rpcclient.1.sgml b/docs/docbook/manpages/rpcclient.1.sgml
index f2a44d69d9..9205439b01 100644
--- a/docs/docbook/manpages/rpcclient.1.sgml
+++ b/docs/docbook/manpages/rpcclient.1.sgml
@@ -16,7 +16,6 @@
rpcclient
- server
-A authfile
-c <command string>
-d debuglevel
@@ -27,6 +26,7 @@
-U username[%password]
-W workgroup
-N
+ server
diff --git a/docs/htmldocs/rpcclient.1.html b/docs/htmldocs/rpcclient.1.html
index 98a19c6ea2..eaa864f109 100644
--- a/docs/htmldocs/rpcclient.1.html
+++ b/docs/htmldocs/rpcclient.1.html
@@ -37,7 +37,7 @@ NAME="AEN8"
>rpcclient {server} [-A authfile] [-c <command string>] [-d debuglevel] [-h] [-l logfile] [-N] [-s <smb config file>] [-U username[%password]] [-W workgroup] [-N]
[-A authfile] [-c <command string>] [-d debuglevel] [-h] [-l logfile] [-N] [-s <smb config file>] [-U username[%password]] [-W workgroup] [-N] {server}.
-A filename -A|--authfile=filename
This option allows
@@ -125,14 +125,14 @@ CLASS="PROGRAMLISTING"
access from unwanted users.
-c 'command string' -c|--command='command string'
execute semicolon separated commands (listed
below))
-d debuglevel -d|--debug=debuglevel
set the debuglevel. Debug level 0 is the lowest
@@ -144,14 +144,14 @@ CLASS="FILENAME"
-h -h|--help
Print a summary of command line options.
-l logbasename -l|--logfile=logbasename
File name for log/debug files. The extension
@@ -163,7 +163,7 @@ CLASS="CONSTANT"
-N -N|--nopass
instruct option.
-s smb.conf -s|--conf=smb.conf
Specifies the location of the all important
@@ -192,7 +192,7 @@ CLASS="FILENAME"
> file.
-U username[%password] -U|--user=username[%password]
Sets the SMB username or username and password.
-W domain -W|--workgroup=domain
Set the SMB domain of the username. This
@@ -693,7 +693,7 @@ NAME="AEN222"
>
VERSION This man page is correct for version 2.2 of the Samba
+>This man page is correct for version 3.0 of the Samba
suite.
algorithmic rid base
COMPLETE LIST OF SERVICE PARAMETERS EXPLANATION OF EACH PARAMETER algorithmic rid base (G)This determines how Samba will use its
+ algorithmic mapping from uids/gid to the RIDs needed to construct
+ NT Security Identifiers.
Setting this option to a larger value could be useful to sites
+ transitioning from WinNT and Win2k, as existing user and
+ group rids would otherwise clash with sytem users etc.
+
All UIDs and GIDs must be able to be resolved into SIDs for
+ the correct operation of ACLs on the server. As such the algorithmic
+ mapping can't be 'turned off', but pushing it 'out of the way' should
+ resolve the issues. Users and groups can then be assigned 'low' RIDs
+ in arbitary-rid supporting backends.
Default: algorithmic rid base = 1000
Example: algorithmic rid base = 100000
allow trusted domains (G)passdb backend (G)
This option allows the administrator to chose what
- backend in which to store passwords. This allows (for example) both
- smbpasswd and tdbsam to be used without a recompile. Only one can
- be used at a time however, and experimental backends must still be selected
+>This option allows the administrator to chose which backends to retrieve and store passwords with. This allows (for example) both
+ smbpasswd and tdbsam to be used without a recompile.
+ Multiple backends can be specified, seperated by spaces. The backends will be searched in the order they are specified. New users are always added to the first backend specified.
+ Experimental backends must still be selected
(eg --with-tdbsam) at configure time.
Example: passdb backend = tdbsam:/etc/samba/private/passdb.tdb passdb backend = tdbsam:/etc/samba/private/passdb.tdb smbpasswd:/etc/samba/smbpasswd
Example:
Example: passdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args passdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args tdbsam:/etc/samba/private/passdb.tdb
section above for reasons
why you might want to do this.To use the CUPS printing interface set printcap name = cups
+ .
On System V systems that use lpstat modules for UNIX services.
Please note that setting this parameter to + causes problems
+ with group membership at least on glibc systems, as the character +
+ is used as a special character for NIS in /etc/group.
Example: winbind separator = \ winbind separator = \\
Example: winbind separator = + winbind separator = /
WARNINGS VERSION SEE ALSO AUTHOR
+.\" This manpage has been automatically generated by docbook2man-spec
+.\" from a DocBook document. docbook2man-spec can be found at:
+.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng
.
-.TH "RPCCLIENT" "1" "28 March 2002" "" ""
+.TH "RPCCLIENT" "1" "16 April 2002" "" ""
.SH NAME
rpcclient \- tool for executing client side MS-RPC functions
.SH SYNOPSIS
-
-\fBrpcclient\fR \fBserver\fR [ \fB-A authfile\fR] [ \fB-c \fR] [ \fB-d debuglevel\fR] [ \fB-h\fR] [ \fB-l logfile\fR] [ \fB-N\fR] [ \fB-s \fR] [ \fB-U username[%password]\fR] [ \fB-W workgroup\fR] [ \fB-N\fR]
-
+.sp
+\fBrpcclient\fR [ \fB-A authfile\fR ] [ \fB-c \fR ] [ \fB-d debuglevel\fR ] [ \fB-h\fR ] [ \fB-l logfile\fR ] [ \fB-N\fR ] [ \fB-s \fR ] [ \fB-U username[%password]\fR ] [ \fB-W workgroup\fR ] [ \fB-N\fR ] \fBserver\fR
.SH "DESCRIPTION"
.PP
This tool is part of the Sambasuite.
.PP
\fBrpcclient\fR is a utility initially developed
-to test MS-RPC functionality in Samba itself. It has undergone
-several stages of development and stability. Many system administrators
+to test MS-RPC functionality in Samba itself. It has undergone
+several stages of development and stability. Many system administrators
have now written scripts around it to manage Windows NT clients from
their UNIX workstation.
.SH "OPTIONS"
.TP
\fBserver\fR
NetBIOS name of Server to which to connect.
-The server can be any SMB/CIFS server. The name is
-resolved using the \fIname resolve order\fRline from
+The server can be any SMB/CIFS server. The name is
+resolved using the \fIname resolve order\fRline from
\fIsmb.conf(5)\fR.
.TP
\fB-A|--authfile=filename\fR
This option allows
you to specify a file from which to read the username and
-password used in the connection. The format of the file is
-
+password used in the connection. The format of the file is
+.sp
.nf
username =
password =
domain =
+.sp
.fi
Make certain that the permissions on the file restrict
@@ -57,13 +57,13 @@ Print a summary of command line options.
.TP
\fB-l|--logfile=logbasename\fR
File name for log/debug files. The extension
-\&'.client' will be appended. The log file is never removed
+\&'.client' will be appended. The log file is never removed
by the client.
.TP
\fB-N|--nopass\fR
instruct \fBrpcclient\fR not to ask
-for a password. By default, \fBrpcclient\fR will prompt
-for a password. See also the \fI-U\fR option.
+for a password. By default, \fBrpcclient\fR will prompt
+for a password. See also the \fI-U\fR option.
.TP
\fB-s|--conf=smb.conf\fR
Specifies the location of the all important
@@ -79,24 +79,24 @@ string is uppercased. If these environmental variables are not
found, the username GUEST is used.
A third option is to use a credentials file which
-contains the plaintext of the username and password. This
+contains the plaintext of the username and password. This
option is mainly provided for scripts where the admin doesn't
desire to pass the credentials on the command line or via environment
variables. If this method is used, make certain that the permissions
-on the file restrict access from unwanted users. See the
+on the file restrict access from unwanted users. See the
\fI-A\fR for more details.
Be cautious about including passwords in scripts. Also, on
many systems the command line of a running process may be seen
-via the \fBps\fR command. To be safe always allow
+via the \fBps\fR command. To be safe always allow
\fBrpcclient\fR to prompt for a password and type
it in directly.
.TP
\fB-W|--workgroup=domain\fR
-Set the SMB domain of the username. This
+Set the SMB domain of the username. This
overrides the default domain which is the domain defined in
-smb.conf. If the domain specified is the same as the server's NetBIOS name,
-it causes the client to log on using the server's local SAM (as
+smb.conf. If the domain specified is the same as the server's NetBIOS name,
+it causes the client to log on using the server's local SAM (as
opposed to the Domain SAM).
.SH "COMMANDS"
.PP
@@ -117,7 +117,9 @@ of usernames to SIDs.
\fBenumtrusts\fR
.PP
.PP
+.PP
\fBSAMR\fR
+.PP
.TP 0.2i
\(bu
\fBqueryuser\fR
@@ -144,20 +146,22 @@ of usernames to SIDs.
\fBenumdomgroups\fR
.PP
.PP
+.PP
\fBSPOOLSS\fR
+.PP
.TP 0.2i
\(bu
\fBadddriver \fR
- Execute an AddPrinterDriver() RPC to install the printer driver
-information on the server. Note that the driver files should
-already exist in the directory returned by
-\fBgetdriverdir\fR. Possible values for
+information on the server. Note that the driver files should
+already exist in the directory returned by
+\fBgetdriverdir\fR. Possible values for
\fIarch\fR are the same as those for
the \fBgetdriverdir\fR command.
The \fIconfig\fR parameter is defined as
follows:
-
+.sp
.nf
Long Printer Name:\\
Driver File Name:\\
@@ -168,43 +172,44 @@ follows:
Default Data Type:\\
Comma Separated list of Files
+.sp
.fi
Any empty fields should be enter as the string "NULL".
Samba does not need to support the concept of Print Monitors
since these only apply to local printers whose driver can make
-use of a bi-directional link for communication. This field should
-be "NULL". On a remote NT print server, the Print Monitor for a
+use of a bi-directional link for communication. This field should
+be "NULL". On a remote NT print server, the Print Monitor for a
driver must already be installed prior to adding the driver or
else the RPC will fail.
.TP 0.2i
\(bu
\fBaddprinter
\fR
-- Add a printer on the remote server. This printer
-will be automatically shared. Be aware that the printer driver
+- Add a printer on the remote server. This printer
+will be automatically shared. Be aware that the printer driver
must already be installed on the server (see \fBadddriver\fR)
and the \fIport\fRmust be a valid port name (see
\fBenumports\fR.
.TP 0.2i
\(bu
\fBdeldriver\fR - Delete the
-specified printer driver for all architectures. This
+specified printer driver for all architectures. This
does not delete the actual driver files from the server,
only the entry from the server's list of drivers.
.TP 0.2i
\(bu
\fBenumdata\fR - Enumerate all
-printer setting data stored on the server. On Windows NT clients,
-these values are stored in the registry, while Samba servers
-store them in the printers TDB. This command corresponds
+printer setting data stored on the server. On Windows NT clients,
+these values are stored in the registry, while Samba servers
+store them in the printers TDB. This command corresponds
to the MS Platform SDK GetPrinterData() function (* This
command is currently unimplemented).
.TP 0.2i
\(bu
\fBenumjobs \fR
-- List the jobs and status of a given printer.
+- List the jobs and status of a given printer.
This command corresponds to the MS Platform SDK EnumJobs()
function (* This command is currently unimplemented).
.TP 0.2i
@@ -215,22 +220,22 @@ info level. Currently only info levels 1 and 2 are supported.
.TP 0.2i
\(bu
\fBenumdrivers [level]\fR
-- Execute an EnumPrinterDrivers() call. This lists the various installed
-printer drivers for all architectures. Refer to the MS Platform SDK
+- Execute an EnumPrinterDrivers() call. This lists the various installed
+printer drivers for all architectures. Refer to the MS Platform SDK
documentation for more details of the various flags and calling
options. Currently supported info levels are 1, 2, and 3.
.TP 0.2i
\(bu
\fBenumprinters [level]\fR
-- Execute an EnumPrinters() call. This lists the various installed
-and share printers. Refer to the MS Platform SDK documentation for
+- Execute an EnumPrinters() call. This lists the various installed
+and share printers. Refer to the MS Platform SDK documentation for
more details of the various flags and calling options. Currently
supported info levels are 0, 1, and 2.
.TP 0.2i
\(bu
\fBgetdata \fR
-- Retrieve the data for a given printer setting. See
-the \fBenumdata\fR command for more information.
+- Retrieve the data for a given printer setting. See
+the \fBenumdata\fR command for more information.
This command corresponds to the GetPrinterData() MS Platform
SDK function (* This command is currently unimplemented).
.TP 0.2i
@@ -239,20 +244,20 @@ SDK function (* This command is currently unimplemented).
- Retrieve the printer driver information (such as driver file,
config file, dependent files, etc...) for
the given printer. This command corresponds to the GetPrinterDriver()
-MS Platform SDK function. Currently info level 1, 2, and 3 are supported.
+MS Platform SDK function. Currently info level 1, 2, and 3 are supported.
.TP 0.2i
\(bu
\fBgetdriverdir \fR
- Execute a GetPrinterDriverDirectory()
RPC to retreive the SMB share name and subdirectory for
-storing printer driver files for a given architecture. Possible
+storing printer driver files for a given architecture. Possible
values for \fIarch\fR are "Windows 4.0"
(for Windows 95/98), "Windows NT x86", "Windows NT PowerPC", "Windows
Alpha_AXP", and "Windows NT R4000".
.TP 0.2i
\(bu
\fBgetprinter \fR
-- Retrieve the current printer information. This command
+- Retrieve the current printer information. This command
corresponds to the GetPrinter() MS Platform SDK function.
.TP 0.2i
\(bu
@@ -263,14 +268,15 @@ against a given printer.
\(bu
\fBsetdriver \fR
- Execute a SetPrinter() command to update the printer driver associated
-with an installed printer. The printer driver must already be correctly
-installed on the print server.
+with an installed printer. The printer driver must already be correctly
+installed on the print server.
See also the \fBenumprinters\fR and
\fBenumdrivers\fR commands for obtaining a list of
of installed printers and drivers.
.PP
\fBGENERAL OPTIONS\fR
+.PP
.TP 0.2i
\(bu
\fBdebuglevel\fR - Set the current debug level
@@ -278,33 +284,33 @@ used to log information.
.TP 0.2i
\(bu
\fBhelp (?)\fR - Print a listing of all
-known commands or extended help on a particular command.
+known commands or extended help on a particular command.
.TP 0.2i
\(bu
\fBquit (exit)\fR - Exit \fBrpcclient
-\fR.
+\fR\&.
.SH "BUGS"
.PP
\fBrpcclient\fR is designed as a developer testing tool
-and may not be robust in certain areas (such as command line parsing).
-It has been known to generate a core dump upon failures when invalid
+and may not be robust in certain areas (such as command line parsing).
+It has been known to generate a core dump upon failures when invalid
parameters where passed to the interpreter.
.PP
From Luke Leighton's original rpcclient man page:
.PP
\fB"WARNING!\fR The MSRPC over SMB code has
-been developed from examining Network traces. No documentation is
-available from the original creators (Microsoft) on how MSRPC over
-SMB works, or how the individual MSRPC services work. Microsoft's
-implementation of these services has been demonstrated (and reported)
+been developed from examining Network traces. No documentation is
+available from the original creators (Microsoft) on how MSRPC over
+SMB works, or how the individual MSRPC services work. Microsoft's
+implementation of these services has been demonstrated (and reported)
to be... a bit flaky in places.
.PP
The development of Samba's implementation is also a bit rough,
-and as more of the services are understood, it can even result in
-versions of \fBsmbd(8)\fR and \fBrpcclient(1)\fR
-that are incompatible for some commands or services. Additionally,
-the developers are sending reports to Microsoft, and problems found
-or reported to Microsoft are fixed in Service Packs, which may
+and as more of the services are understood, it can even result in
+versions of \fBsmbd(8)\fR and \fBrpcclient(1)\fR
+that are incompatible for some commands or services. Additionally,
+the developers are sending reports to Microsoft, and problems found
+or reported to Microsoft are fixed in Service Packs, which may
result in incompatibilities."
.SH "VERSION"
.PP
@@ -318,6 +324,6 @@ by the Samba Team as an Open Source project similar
to the way the Linux kernel is developed.
.PP
The original rpcclient man page was written by Matthew
-Geddes, Luke Kenneth Casson Leighton, and rewritten by Gerald Carter.
+Geddes, Luke Kenneth Casson Leighton, and rewritten by Gerald Carter.
The conversion to DocBook for Samba 2.2 was done by Gerald
Carter.
diff --git a/docs/manpages/smb.conf.5 b/docs/manpages/smb.conf.5
index 32a40d2609..09a86a273a 100644
--- a/docs/manpages/smb.conf.5
+++ b/docs/manpages/smb.conf.5
@@ -3,7 +3,7 @@
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
-.TH "SMB.CONF" "5" "01 April 2002" "" ""
+.TH "SMB.CONF" "5" "16 April 2002" "" ""
.SH NAME
smb.conf \- The configuration file for the Samba suite
.SH "SYNOPSIS"
@@ -521,6 +521,9 @@ each parameter for details. Note that some are synonyms.
\fIadd machine script\fR
.TP 0.2i
\(bu
+\fIalgorithmic rid base\fR
+.TP 0.2i
+\(bu
\fIallow trusted domains\fR
.TP 0.2i
\(bu
@@ -1597,6 +1600,25 @@ Example: \fBadmin users = jason\fR
\fBallow hosts (S)\fR
Synonym for \fIhosts allow\fR.
.TP
+\fBalgorithmic rid base (G)\fR
+This determines how Samba will use its
+algorithmic mapping from uids/gid to the RIDs needed to construct
+NT Security Identifiers.
+
+Setting this option to a larger value could be useful to sites
+transitioning from WinNT and Win2k, as existing user and
+group rids would otherwise clash with sytem users etc.
+
+All UIDs and GIDs must be able to be resolved into SIDs for
+the correct operation of ACLs on the server. As such the algorithmic
+mapping can't be 'turned off', but pushing it 'out of the way' should
+resolve the issues. Users and groups can then be assigned 'low' RIDs
+in arbitary-rid supporting backends.
+
+Default: \fBalgorithmic rid base = 1000\fR
+
+Example: \fBalgorithmic rid base = 100000\fR
+.TP
\fBallow trusted domains (G)\fR
This option only takes effect when the \fIsecurity\fR option is set to
server or domain.
@@ -4629,10 +4651,10 @@ Default: \fBpanic action = \fR
Example: \fBpanic action = "/bin/sleep 90000"\fR
.TP
\fBpassdb backend (G)\fR
-This option allows the administrator to chose what
-backend in which to store passwords. This allows (for example) both
-smbpasswd and tdbsam to be used without a recompile. Only one can
-be used at a time however, and experimental backends must still be selected
+This option allows the administrator to chose which backends to retrieve and store passwords with. This allows (for example) both
+smbpasswd and tdbsam to be used without a recompile.
+Multiple backends can be specified, seperated by spaces. The backends will be searched in the order they are specified. New users are always added to the first backend specified.
+Experimental backends must still be selected
(eg --with-tdbsam) at configure time.
This paramater is in two parts, the backend's name, and a 'location'
@@ -4688,11 +4710,11 @@ for its own processing
Default: \fBpassdb backend = smbpasswd\fR
-Example: \fBpassdb backend = tdbsam:/etc/samba/private/passdb.tdb\fR
+Example: \fBpassdb backend = tdbsam:/etc/samba/private/passdb.tdb smbpasswd:/etc/samba/smbpasswd\fR
Example: \fBpassdb backend = ldapsam_nua:ldaps://ldap.example.com\fR
-Example: \fBpassdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args\fR
+Example: \fBpassdb backend = plugin:/usr/local/samba/lib/my_passdb.so:my_plugin_args tdbsam:/etc/samba/private/passdb.tdb\fR
.TP
\fBpasswd chat (G)\fR
This string controls the \fB"chat"\fR
@@ -5156,6 +5178,9 @@ This parameter may be used to override the
compiled-in default printcap name used by the server (usually \fI /etc/printcap\fR). See the discussion of the [printers] section above for reasons
why you might want to do this.
+To use the CUPS printing interface set \fBprintcap name = cups
+\fR\&.
+
On System V systems that use \fBlpstat\fR to
list available printers you can use \fBprintcap name = lpstat
\fRto automatically obtain lists of available printers. This
@@ -7016,9 +7041,13 @@ used when listing a username of the form of \fIDOMAIN
is only applicable when using the \fIpam_winbind.so\fR
and \fInss_winbind.so\fR modules for UNIX services.
-Example: \fBwinbind separator = \\\fR
+Please note that setting this parameter to + causes problems
+with group membership at least on glibc systems, as the character +
+is used as a special character for NIS in /etc/group.
+
+Example: \fBwinbind separator = \\\\\fR
-Example: \fBwinbind separator = +\fR
+Example: \fBwinbind separator = /\fR
.TP
\fBwinbind uid\fR
The winbind gid parameter specifies the range of group
--
cgit
From a32940d53e127bb7d46a4d46d24a53b17a23a8a4 Mon Sep 17 00:00:00 2001
From: Simo Sorce
Date: Tue, 16 Apr 2002 22:38:04 +0000
Subject: Fix incorrect zpadlen handling in fmtfp. Thanks to Ollie Oldham
for spotting it. few mods to make it easier to
compile the tests. addedd the "Ollie" test to the floating point ones. (This
used to be commit 415f9d92bc0a37d38b81a653a4b4c5f0fefa2fe8)
---
source3/lib/snprintf.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c
index 9a9dcdbae1..3034dfaaf6 100644
--- a/source3/lib/snprintf.c
+++ b/source3/lib/snprintf.c
@@ -57,6 +57,12 @@
#ifndef NO_CONFIG_H /* for some tests */
#include "config.h"
+#else
+#define NULL 0
+#endif
+
+#ifdef TEST_SNPRINTF /* need math library headers for testing */
+#include
#endif
#ifdef HAVE_STRING_H
@@ -656,9 +662,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
/* Convert integer part */
do {
- temp = intpart;
- my_modf(intpart*0.1, &intpart);
- temp = temp*0.1;
+ temp = intpart*0.1;
+ my_modf(temp, &intpart);
index = (int) ((temp -intpart +0.05)* 10.0);
/* index = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
/* printf ("%llf, %f, %x\n", temp, intpart, index); */
@@ -672,9 +677,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
if (fracpart)
{
do {
- temp = fracpart;
- my_modf(fracpart*0.1, &fracpart);
- temp = temp*0.1;
+ temp = fracpart*0.1;
+ my_modf(temp, &fracpart);
index = (int) ((temp -fracpart +0.05)* 10.0);
/* index = (int) ((((temp/10) -fracpart) +0.05) *10); */
/* printf ("%lf, %lf, %ld\n", temp, fracpart, index); */
@@ -726,14 +730,14 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
if (max > 0) {
dopr_outch (buffer, currlen, maxlen, '.');
+ while (zpadlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, '0');
+ --zpadlen;
+ }
+
while (fplace > 0)
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
}
-
- while (zpadlen > 0) {
- dopr_outch (buffer, currlen, maxlen, '0');
- --zpadlen;
- }
while (padlen < 0) {
dopr_outch (buffer, currlen, maxlen, ' ');
@@ -853,7 +857,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
NULL
};
double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
- 0.9996, 1.996, 4.136, 0};
+ 0.9996, 1.996, 4.136, 5.030201, 0};
char *int_fmt[] = {
"%-1.5d",
"%1.5d",
@@ -948,8 +952,10 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
{
double v0 = 0.12345678901234567890123456789012345678901;
for (x=0; x<100; x++) {
- snprintf(buf1, sizeof(buf1), "%1.1f", v0*pow(10, x));
- sprintf(buf2, "%1.1f", v0*pow(10, x));
+ double p = pow(10, x);
+ double r = v0*p;
+ snprintf(buf1, sizeof(buf1), "%1.1f", r);
+ sprintf(buf2, "%1.1f", r);
if (strcmp(buf1, buf2)) {
printf("we seem to support %d digits\n", x-1);
break;
--
cgit
From 7c0301d100885f3d4ee48a973158d1aa0036af1c Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Tue, 16 Apr 2002 22:55:39 +0000
Subject: stricter conditions on termination in strings this was a very nasty
bug with filename corruption and NT4 clients. The exact termination
conditions are quite critical ... (This used to be commit
a538efe7d00e7a61df194ca1c22e0583dcbb7a4a)
---
source3/lib/charcnv.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 803cda36c8..cd32779594 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -356,9 +356,9 @@ int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen(src)+1;
+ src_len = strlen(src);
} else {
- src_len = strnlen(src, src_len) + 1;
+ src_len = strnlen(src, src_len);
}
}
@@ -551,9 +551,9 @@ int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, i
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen_w(src)*2+2;
+ src_len = strlen_w(src)*2;
} else {
- src_len = strnlen_w(src, src_len/2)*2+2;
+ src_len = strnlen_w(src, src_len/2)*2;
}
}
@@ -623,9 +623,9 @@ int pull_utf8(char *dest, const void *src, int dest_len, int src_len, int flags)
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen(src)+1;
+ src_len = strlen(src);
} else {
- src_len = strnlen(src, src_len) + 1;
+ src_len = strnlen(src, src_len);
}
}
--
cgit
From 1416106736adb6190ac788ee27c2a4bf4eb1790f Mon Sep 17 00:00:00 2001
From: Simo Sorce
Date: Tue, 16 Apr 2002 22:56:08 +0000
Subject: sync with 2.2 (This used to be commit
18d5ffd835165d2570443c979d9157e2388b37d8)
---
source3/lib/snprintf.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c
index 3034dfaaf6..2733626108 100644
--- a/source3/lib/snprintf.c
+++ b/source3/lib/snprintf.c
@@ -100,6 +100,11 @@
#define LLONG long
#endif
+/* free memory if the pointer is valid and zero the pointer */
+#ifndef SAFE_FREE
+#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0)
+#endif
+
static size_t dopr(char *buffer, size_t maxlen, const char *format,
va_list args);
static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
@@ -822,10 +827,10 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
{
char *msg = NULL;
vasprintf(&msg, format, arglist);
- if (!msg)
- return;
- syslog(facility_priority, "%s", msg);
- free(msg);
+ if (!msg)
+ return;
+ syslog(facility_priority, "%s", msg);
+ SAFE_FREE(msg);
}
#endif /* HAVE_SYSLOG */
#endif /* HAVE_VSYSLOG */
--
cgit
From e35ac78c49c3bd2aeb871cf1ebee43cf73477c6a Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 17 Apr 2002 02:37:46 +0000
Subject: make suure we get the return value from the pull_*() functions right
for both null terminated and buffer length terminated strings (This used to
be commit e8fbf853e0eed61bb7405be731f18fb2426f8dc4)
---
source3/lib/charcnv.c | 18 ++++++++++++------
source3/lib/util_str.c | 2 +-
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index cd32779594..a6db286134 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -356,9 +356,11 @@ int pull_ascii(char *dest, const void *src, int dest_len, int src_len, int flags
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen(src);
+ src_len = strlen(src) + 1;
} else {
- src_len = strnlen(src, src_len);
+ int len = strnlen(src, src_len);
+ if (len < src_len) len++;
+ src_len = len;
}
}
@@ -551,9 +553,11 @@ int pull_ucs2(const void *base_ptr, char *dest, const void *src, int dest_len, i
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen_w(src)*2;
+ src_len = strlen_w(src)*2 + 2;
} else {
- src_len = strnlen_w(src, src_len/2)*2;
+ int len = strnlen_w(src, src_len/2);
+ if (len < src_len/2) len++;
+ src_len = len*2;
}
}
@@ -623,9 +627,11 @@ int pull_utf8(char *dest, const void *src, int dest_len, int src_len, int flags)
if (flags & STR_TERMINATE) {
if (src_len == -1) {
- src_len = strlen(src);
+ src_len = strlen(src) + 1;
} else {
- src_len = strnlen(src, src_len);
+ int len = strnlen(src, src_len);
+ if (len < src_len) len++;
+ src_len = len;
}
}
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 9a841a36b3..f6e579ddba 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1004,7 +1004,7 @@ some platforms don't have strndup
#ifndef HAVE_STRNLEN
/*******************************************************************
-some platforms don't have strndup
+some platforms don't have strnlen
********************************************************************/
size_t strnlen(const char *s, size_t n)
{
--
cgit
From 0e6ac42b4d6debba880190e6a1cdad3ac87dd0cc Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 17 Apr 2002 05:43:05 +0000
Subject: disabled the traversal of the brlock database at startup and
shutdown. I have just helped debug a very large Solaris server where the
traversal was taking so long that the clients timed out, created a new
process which in turn did a traversal!
we will need to find some other way of doing a brlock.tdb cleanup (if
its even needed at all)
(This used to be commit 2728d131356313db0d6341b0a01d6625d13367c3)
---
source3/locking/brlock.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index e7fa4022f6..abc20c8f0f 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -232,10 +232,6 @@ void brl_init(int read_only)
DEBUG(0,("Failed to open byte range locking database\n"));
return;
}
-
- /* delete any dead locks */
- if (!read_only)
- tdb_traverse(tdb, delete_fn, &check_self);
}
/****************************************************************************
@@ -249,10 +245,6 @@ void brl_shutdown(int read_only)
if (!tdb)
return;
- /* delete any dead locks */
- if (!read_only)
- tdb_traverse(tdb, delete_fn, &check_self);
-
tdb_close(tdb);
}
--
cgit
From 67d99a88c4f8dbb49a62bace4b1619465b7a50f4 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Wed, 17 Apr 2002 06:43:47 +0000
Subject: Fixed command line argument parsing. (This used to be commit
28c1fae4d89399ec4d15bfb3ccd17d8b5b0495fc)
---
source3/rpcclient/rpcclient.c | 124 ++++++++++++++++++------------------------
1 file changed, 54 insertions(+), 70 deletions(-)
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 7d49e7a9cb..1b3d0a756d 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -594,19 +594,16 @@ static void usage(void)
int main(int argc, char *argv[])
{
- extern char *optarg;
- extern int optind;
extern pstring global_myname;
static int got_pass = 0;
BOOL interactive = True;
int opt;
int olddebug;
- static char *cmdstr = "";
+ static char *cmdstr = "", *server;
struct cli_state *cli;
fstring password="",
username="",
- domain="",
- server="";
+ domain="";
static char *opt_authfile=NULL,
*opt_username=NULL,
*opt_domain=NULL,
@@ -649,78 +646,65 @@ static void usage(void)
return 0;
}
- if (strncmp("//", argv[1], 2) == 0 || strncmp("\\\\", argv[1], 2) == 0)
- argv[1] += 2;
-
- pstrcpy(server, argv[1]);
+ pc = poptGetContext("rpcclient", argc, (const char **) argv,
+ long_options, 0);
+
+ while((opt = poptGetNextOpt(pc)) != -1) {
+ switch (opt) {
+ case 'A':
+ /* only get the username, password, and domain from the file */
+ read_authfile (opt_authfile, username, password, domain);
+ if (strlen (password))
+ got_pass = 1;
+ break;
+
+ case 'l':
+ slprintf(logfile, sizeof(logfile) - 1, "%s.client",
+ opt_logfile);
+ lp_set_logfile(logfile);
+ interactive = False;
+ break;
+
+ case 's':
+ pstrcpy(dyn_CONFIGFILE, opt_configfile);
+ break;
+
+ case 'd':
+ DEBUGLEVEL = opt_debuglevel;
+ break;
+
+ case 'U': {
+ char *lp;
- argv++;
- argc--;
+ pstrcpy(username,opt_username);
- pc = poptGetContext(NULL, argc, (const char **) argv, long_options,
- POPT_CONTEXT_KEEP_FIRST);
-
- while (argc > optind) {
- while((opt = poptGetNextOpt(pc)) != -1) {
- switch (opt) {
- case 'A':
- /* only get the username, password, and domain from the file */
- read_authfile (opt_authfile, username, password, domain);
- if (strlen (password))
- got_pass = 1;
- break;
-
- case 'l':
- slprintf(logfile, sizeof(logfile) - 1, "%s.client",
- opt_logfile);
- lp_set_logfile(logfile);
- interactive = False;
- break;
-
- case 's':
- pstrcpy(dyn_CONFIGFILE, opt_configfile);
- break;
-
- case 'd':
- DEBUGLEVEL = opt_debuglevel;
- break;
-
- case 'U': {
- char *lp;
- pstrcpy(username,opt_username);
- if ((lp=strchr_m(username,'%'))) {
- *lp = 0;
- pstrcpy(password,lp+1);
- got_pass = 1;
- memset(strchr_m(opt_username,'%')+1,'X',strlen(password));
- }
- break;
- }
-
- case 'W':
- pstrcpy(domain, opt_domain);
- break;
-
- case 'h':
- default:
- usage();
- exit(1);
+ if ((lp=strchr_m(username,'%'))) {
+ *lp = 0;
+ pstrcpy(password,lp+1);
+ got_pass = 1;
+ memset(strchr_m(opt_username,'%') + 1, 'X',
+ strlen(password));
}
+ break;
}
-
- if (argc > optind) {
- if (strncmp("//", argv[optind], 2) == 0 ||
- strncmp("\\\\", argv[optind], 2) == 0)
- {
- argv[optind] += 2;
- }
-
- pstrcpy(server, argv[optind]);
- optind ++;
+
+ case 'W':
+ pstrcpy(domain, opt_domain);
+ break;
+
+ case 'h':
+ default:
+ usage();
+ exit(1);
}
}
- if (!server[0]) {
+ /* Get server as remaining unparsed argument. Print usage if more
+ than one unparsed argument is present. */
+
+ server = poptGetArg(pc);
+
+ if (!server || poptGetArg(pc)) {
usage();
return 1;
}
--
cgit
From 5e2547e4db108ea4832b229589ba85b6ac7befaa Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Wed, 17 Apr 2002 16:58:12 +0000
Subject: Fix unused warnings with deleted code. Jeremy. (This used to be
commit 255c68856eeccf75b152e15be66130175907188c)
---
source3/locking/brlock.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index abc20c8f0f..8c22f7d7ab 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -162,6 +162,10 @@ static BOOL brl_conflict_other(struct lock_struct *lck1, struct lock_struct *lck
}
+#if DONT_DO_THIS
+ /* doing this traversal could kill solaris machines under high load (tridge) */
+ /* delete any dead locks */
+
/****************************************************************************
Delete a record if it is for a dead process, if check_self is true, then
delete any records belonging to this pid also (there shouldn't be any).
@@ -215,6 +219,7 @@ static int delete_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *stat
tdb_chainunlock(tdb, kbuf);
return 0;
}
+#endif
/****************************************************************************
Open up the brlock.tdb database.
@@ -222,8 +227,6 @@ static int delete_fn(TDB_CONTEXT *ttdb, TDB_DATA kbuf, TDB_DATA dbuf, void *stat
void brl_init(int read_only)
{
- BOOL check_self = False;
-
if (tdb)
return;
tdb = tdb_open_log(lock_path("brlock.tdb"), 0, TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST),
@@ -232,6 +235,15 @@ void brl_init(int read_only)
DEBUG(0,("Failed to open byte range locking database\n"));
return;
}
+
+#if DONT_DO_THIS
+ /* doing this traversal could kill solaris machines under high load (tridge) */
+ /* delete any dead locks */
+ if (!read_only) {
+ BOOL check_self = False;
+ tdb_traverse(tdb, delete_fn, &check_self);
+ }
+#endif
}
/****************************************************************************
@@ -240,11 +252,18 @@ void brl_init(int read_only)
void brl_shutdown(int read_only)
{
- BOOL check_self = True;
-
if (!tdb)
return;
+#if DONT_DO_THIS
+ /* doing this traversal could kill solaris machines under high load (tridge) */
+ /* delete any dead locks */
+ if (!read_only) {
+ BOOL check_self = True;
+ tdb_traverse(tdb, delete_fn, &check_self);
+ }
+#endif
+
tdb_close(tdb);
}
--
cgit
From 37d67c3345e7016cc5e1626e9d0c4ffdebc596fb Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Wed, 17 Apr 2002 17:34:38 +0000
Subject: libsmb/cli_netlogon.c: Fixed confusing debug messages.
param/loadparm.c: Added missing debugs that would have helped me find a
misconfiguration I lost a day on.... Jeremy. (This used to be commit
6e9572379784c77f3c4e6a95e18a9641880a8ffc)
---
source3/libsmb/cli_netlogon.c | 8 ++++----
source3/param/loadparm.c | 27 +++++++++++++--------------
2 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/source3/libsmb/cli_netlogon.c b/source3/libsmb/cli_netlogon.c
index 125590b6d3..12651966d7 100644
--- a/source3/libsmb/cli_netlogon.c
+++ b/source3/libsmb/cli_netlogon.c
@@ -51,7 +51,7 @@ NTSTATUS new_cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal,
/* create and send a MSRPC command with api NET_REQCHAL */
- DEBUG(4,("cli_net_req_chal: LSA Request Challenge from %s to %s: %s\n",
+ DEBUG(4,("new_cli_net_req_chal: LSA Request Challenge from %s to %s: %s\n",
cli->desthost, global_myname, credstr(clnt_chal->data)));
/* store the parameters */
@@ -108,7 +108,7 @@ NTSTATUS new_cli_net_auth2(struct cli_state *cli,
/* create and send a MSRPC command with api NET_AUTH2 */
- DEBUG(4,("cli_net_auth2: srv:%s acct:%s sc:%x mc: %s chal %s neg: %x\n",
+ DEBUG(4,("new_cli_net_auth2: srv:%s acct:%s sc:%x mc: %s chal %s neg: %x\n",
cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname,
credstr(cli->clnt_cred.challenge.data), neg_flags));
@@ -147,7 +147,7 @@ NTSTATUS new_cli_net_auth2(struct cli_state *cli,
/*
* Server replied with bad credential. Fail.
*/
- DEBUG(0,("cli_net_auth2: server %s replied with bad credential (bad machine \
+ DEBUG(0,("new_cli_net_auth2: server %s replied with bad credential (bad machine \
password ?).\n", cli->desthost ));
result = NT_STATUS_ACCESS_DENIED;
goto done;
@@ -180,7 +180,7 @@ NTSTATUS new_cli_nt_setup_creds(struct cli_state *cli,
result = new_cli_net_req_chal(cli, &clnt_chal, &srv_chal);
if (!NT_STATUS_IS_OK(result)) {
- DEBUG(0,("cli_nt_setup_creds: request challenge failed\n"));
+ DEBUG(0,("new_cli_nt_setup_creds: request challenge failed\n"));
return result;
}
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 17b9f022f0..0d8df080bd 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -1505,6 +1505,8 @@ static char *lp_string(const char *s)
#define FN_LOCAL_STRING(fn_name,val) \
char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
+#define FN_LOCAL_CONST_STRING(fn_name,val) \
+ const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_LIST(fn_name,val) \
char **fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
#define FN_LOCAL_BOOL(fn_name,val) \
@@ -1701,6 +1703,7 @@ FN_LOCAL_STRING(lp_postexec, szPostExec)
FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
FN_LOCAL_STRING(lp_servicename, szService)
+FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
FN_LOCAL_STRING(lp_pathname, szPath)
FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
FN_LOCAL_STRING(lp_username, szUsername)
@@ -3550,37 +3553,33 @@ static void set_server_role(void)
switch (lp_security()) {
case SEC_SHARE:
- {
- if (lp_domain_logons()) {
- DEBUG(0,
- ("Server's Role (logon server) conflicts with share-level security\n"));
- }
+ if (lp_domain_logons())
+ DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
+ DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
break;
- }
case SEC_SERVER:
case SEC_DOMAIN:
case SEC_ADS:
- {
if (lp_domain_logons()) {
server_role = ROLE_DOMAIN_BDC;
+ DEBUG(10,("set_server_role:ROLE_DOMAIN_BDC\n"));
break;
}
server_role = ROLE_DOMAIN_MEMBER;
+ DEBUG(10,("set_server_role: ROLE_DOMAIN_MEMBER\n"));
break;
- }
case SEC_USER:
- {
if (lp_domain_logons()) {
server_role = ROLE_DOMAIN_PDC;
+ DEBUG(10,("set_server_role: ROLE_DOMAIN_PDC\n"));
break;
}
+ DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
break;
- }
default:
- {
- DEBUG(0,
- ("Server's Role undefined due to unknown security mode\n"));
- }
+ DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
+ DEBUG(10,("set_server_role: ROLE_STANDALONE\n"));
+ break;
}
}
--
cgit
From 82b573678d8b271bfaa00a36359916e8579e8499 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Wed, 17 Apr 2002 21:59:55 +0000
Subject: Fixed the AFP_Resource:$DATA filename creation bug. Jeremy. (This
used to be commit b6c466e8800c03d154381c02a3893f338430b82d)
---
source3/smbd/nttrans.c | 494 +++++++++++++++++++++++++------------------------
1 file changed, 255 insertions(+), 239 deletions(-)
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index 4dec0069f8..06d2b6d24e 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -454,6 +454,7 @@ to open_mode 0x%x\n", (unsigned long)*desired_access, (unsigned long)share_acces
/****************************************************************************
Reply to an NT create and X call on a pipe.
****************************************************************************/
+
static int nt_open_pipe(char *fname, connection_struct *conn,
char *inbuf, char *outbuf, int *ppnum)
{
@@ -605,12 +606,13 @@ int reply_ntcreate_and_X(connection_struct *conn,
}
if(!dir_fsp->is_directory) {
+
+ srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
+
/*
* Check to see if this is a mac fork of some kind.
*/
- srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
-
if( strchr_m(fname, ':')) {
END_PROFILE(SMBntcreateX);
return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
@@ -638,6 +640,15 @@ int reply_ntcreate_and_X(connection_struct *conn,
srvstr_pull_buf(inbuf, &fname[dir_name_len], smb_buf(inbuf), sizeof(fname)-dir_name_len, STR_TERMINATE);
} else {
srvstr_pull_buf(inbuf, fname, smb_buf(inbuf), sizeof(fname), STR_TERMINATE);
+
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
+
+ if( strchr_m(fname, ':')) {
+ END_PROFILE(SMBntcreateX);
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ }
}
/*
@@ -1004,304 +1015,308 @@ static int call_nt_transact_create(connection_struct *conn,
int bufsize, char **ppsetup, char **ppparams,
char **ppdata)
{
- pstring fname;
- char *params = *ppparams;
- char *data = *ppdata;
- int total_parameter_count = (int)IVAL(inbuf, smb_nt_TotalParameterCount);
- /* Breakout the oplock request bits so we can set the
- reply bits separately. */
- int oplock_request = 0;
- mode_t unixmode;
- int fmode=0,rmode=0;
- SMB_OFF_T file_len = 0;
- SMB_STRUCT_STAT sbuf;
- int smb_action = 0;
- BOOL bad_path = False;
- files_struct *fsp = NULL;
- char *p = NULL;
- uint32 flags;
- uint32 desired_access;
- uint32 file_attributes;
- uint32 share_access;
- uint32 create_disposition;
- uint32 create_options;
- uint32 sd_len;
- uint16 root_dir_fid;
- int smb_ofun;
- int smb_open_mode;
- int smb_attr;
- int error_class;
- uint32 error_code;
- time_t c_time;
-
- DEBUG(5,("call_nt_transact_create\n"));
+ pstring fname;
+ char *params = *ppparams;
+ char *data = *ppdata;
+ int total_parameter_count = (int)IVAL(inbuf, smb_nt_TotalParameterCount);
+ /* Breakout the oplock request bits so we can set the reply bits separately. */
+ int oplock_request = 0;
+ mode_t unixmode;
+ int fmode=0,rmode=0;
+ SMB_OFF_T file_len = 0;
+ SMB_STRUCT_STAT sbuf;
+ int smb_action = 0;
+ BOOL bad_path = False;
+ files_struct *fsp = NULL;
+ char *p = NULL;
+ uint32 flags;
+ uint32 desired_access;
+ uint32 file_attributes;
+ uint32 share_access;
+ uint32 create_disposition;
+ uint32 create_options;
+ uint32 sd_len;
+ uint16 root_dir_fid;
+ int smb_ofun;
+ int smb_open_mode;
+ int smb_attr;
+ int error_class;
+ uint32 error_code;
+ time_t c_time;
- /*
- * If it's an IPC, use the pipe handler.
- */
+ DEBUG(5,("call_nt_transact_create\n"));
- if (IS_IPC(conn)) {
+ /*
+ * If it's an IPC, use the pipe handler.
+ */
+
+ if (IS_IPC(conn)) {
if (lp_nt_pipe_support())
return do_nt_transact_create_pipe(conn, inbuf, outbuf, length,
bufsize, ppsetup, ppparams, ppdata);
else
return ERROR_DOS(ERRDOS,ERRbadaccess);
- }
+ }
- /*
- * Ensure minimum number of parameters sent.
- */
+ /*
+ * Ensure minimum number of parameters sent.
+ */
- if(total_parameter_count < 54) {
- DEBUG(0,("call_nt_transact_create - insufficient parameters (%u)\n", (unsigned int)total_parameter_count));
- return ERROR_DOS(ERRDOS,ERRbadaccess);
- }
+ if(total_parameter_count < 54) {
+ DEBUG(0,("call_nt_transact_create - insufficient parameters (%u)\n", (unsigned int)total_parameter_count));
+ return ERROR_DOS(ERRDOS,ERRbadaccess);
+ }
- flags = IVAL(params,0);
- desired_access = IVAL(params,8);
- file_attributes = IVAL(params,20);
- share_access = IVAL(params,24);
- create_disposition = IVAL(params,28);
- create_options = IVAL(params,32);
- sd_len = IVAL(params,36);
- root_dir_fid = (uint16)IVAL(params,4);
- smb_attr = (file_attributes & SAMBA_ATTRIBUTES_MASK);
+ flags = IVAL(params,0);
+ desired_access = IVAL(params,8);
+ file_attributes = IVAL(params,20);
+ share_access = IVAL(params,24);
+ create_disposition = IVAL(params,28);
+ create_options = IVAL(params,32);
+ sd_len = IVAL(params,36);
+ root_dir_fid = (uint16)IVAL(params,4);
+ smb_attr = (file_attributes & SAMBA_ATTRIBUTES_MASK);
- /*
- * We need to construct the open_and_X ofun value from the
- * NT values, as that's what our code is structured to accept.
- */
+ /*
+ * We need to construct the open_and_X ofun value from the
+ * NT values, as that's what our code is structured to accept.
+ */
- if((smb_ofun = map_create_disposition( create_disposition )) == -1)
- return ERROR_DOS(ERRDOS,ERRbadmem);
+ if((smb_ofun = map_create_disposition( create_disposition )) == -1)
+ return ERROR_DOS(ERRDOS,ERRbadmem);
- /*
- * Get the file name.
- */
+ /*
+ * Get the file name.
+ */
- if(root_dir_fid != 0) {
- /*
- * This filename is relative to a directory fid.
- */
+ if(root_dir_fid != 0) {
+ /*
+ * This filename is relative to a directory fid.
+ */
- files_struct *dir_fsp = file_fsp(params,4);
- size_t dir_name_len;
+ files_struct *dir_fsp = file_fsp(params,4);
+ size_t dir_name_len;
- if(!dir_fsp)
- return ERROR_DOS(ERRDOS,ERRbadfid);
+ if(!dir_fsp)
+ return ERROR_DOS(ERRDOS,ERRbadfid);
- if(!dir_fsp->is_directory) {
- /*
- * Check to see if this is a mac fork of some kind.
- */
+ if(!dir_fsp->is_directory) {
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
- if( strchr_m(fname, ':')) {
- return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
- }
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
- return ERROR_DOS(ERRDOS,ERRbadfid);
- }
+ if( strchr_m(fname, ':'))
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
- /*
- * Copy in the base directory name.
- */
+ return ERROR_DOS(ERRDOS,ERRbadfid);
+ }
- pstrcpy( fname, dir_fsp->fsp_name );
- dir_name_len = strlen(fname);
+ /*
+ * Copy in the base directory name.
+ */
- /*
- * Ensure it ends in a '\'.
- */
+ pstrcpy( fname, dir_fsp->fsp_name );
+ dir_name_len = strlen(fname);
- if((fname[dir_name_len-1] != '\\') && (fname[dir_name_len-1] != '/')) {
- pstrcat(fname, "\\");
- dir_name_len++;
- }
+ /*
+ * Ensure it ends in a '\'.
+ */
- srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len,
- total_parameter_count-53, STR_TERMINATE);
- } else {
- srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
- }
+ if((fname[dir_name_len-1] != '\\') && (fname[dir_name_len-1] != '/')) {
+ pstrcat(fname, "\\");
+ dir_name_len++;
+ }
- /*
- * Now contruct the smb_open_mode value from the desired access
- * and the share access.
- */
+ srvstr_pull(inbuf, &fname[dir_name_len], params+53, sizeof(fname)-dir_name_len,
+ total_parameter_count-53, STR_TERMINATE);
+ } else {
+ srvstr_pull(inbuf, fname, params+53, sizeof(fname), total_parameter_count-53, STR_TERMINATE);
- if((smb_open_mode = map_share_mode( fname, create_options, &desired_access,
- share_access, file_attributes)) == -1)
- return ERROR_DOS(ERRDOS,ERRbadaccess);
+ /*
+ * Check to see if this is a mac fork of some kind.
+ */
- oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
- oplock_request |= (flags & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
+ if( strchr_m(fname, ':'))
+ return ERROR_NT(NT_STATUS_OBJECT_PATH_NOT_FOUND);
+ }
- /*
- * Check if POSIX semantics are wanted.
- */
+ /*
+ * Now contruct the smb_open_mode value from the desired access
+ * and the share access.
+ */
- set_posix_case_semantics(file_attributes);
+ if((smb_open_mode = map_share_mode( fname, create_options, &desired_access,
+ share_access, file_attributes)) == -1)
+ return ERROR_DOS(ERRDOS,ERRbadaccess);
+
+ oplock_request = (flags & REQUEST_OPLOCK) ? EXCLUSIVE_OPLOCK : 0;
+ oplock_request |= (flags & REQUEST_BATCH_OPLOCK) ? BATCH_OPLOCK : 0;
+
+ /*
+ * Check if POSIX semantics are wanted.
+ */
+
+ set_posix_case_semantics(file_attributes);
- RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
+ RESOLVE_DFSPATH(fname, conn, inbuf, outbuf);
- unix_convert(fname,conn,0,&bad_path,&sbuf);
+ unix_convert(fname,conn,0,&bad_path,&sbuf);
- unixmode = unix_mode(conn,smb_attr | aARCH, fname);
+ unixmode = unix_mode(conn,smb_attr | aARCH, fname);
- /*
- * If it's a request for a directory open, deal with it separately.
- */
+ /*
+ * If it's a request for a directory open, deal with it separately.
+ */
- if(create_options & FILE_DIRECTORY_FILE) {
+ if(create_options & FILE_DIRECTORY_FILE) {
- oplock_request = 0;
+ oplock_request = 0;
- /*
- * We will get a create directory here if the Win32
- * app specified a security descriptor in the
- * CreateDirectory() call.
- */
+ /*
+ * We will get a create directory here if the Win32
+ * app specified a security descriptor in the
+ * CreateDirectory() call.
+ */
- fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
+ fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
- if(!fsp) {
- restore_case_semantics(file_attributes);
- set_bad_path_error(errno, bad_path);
- return(UNIXERROR(ERRDOS,ERRnoaccess));
- }
+ if(!fsp) {
+ restore_case_semantics(file_attributes);
+ set_bad_path_error(errno, bad_path);
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
- } else {
+ } else {
- /*
- * Ordinary file case.
- */
+ /*
+ * Ordinary file case.
+ */
- fsp = open_file_shared1(conn,fname,&sbuf,desired_access,
- smb_open_mode,smb_ofun,unixmode,
- oplock_request,&rmode,&smb_action);
+ fsp = open_file_shared1(conn,fname,&sbuf,desired_access,
+ smb_open_mode,smb_ofun,unixmode,
+ oplock_request,&rmode,&smb_action);
- if (!fsp) {
+ if (!fsp) {
- if(errno == EISDIR) {
+ if(errno == EISDIR) {
- /*
- * Fail the open if it was explicitly a non-directory file.
- */
+ /*
+ * Fail the open if it was explicitly a non-directory file.
+ */
- if (create_options & FILE_NON_DIRECTORY_FILE) {
- restore_case_semantics(file_attributes);
- SSVAL(outbuf, smb_flg2,
- SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
- return ERROR_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
- }
+ if (create_options & FILE_NON_DIRECTORY_FILE) {
+ restore_case_semantics(file_attributes);
+ SSVAL(outbuf, smb_flg2, SVAL(outbuf,smb_flg2) | FLAGS2_32_BIT_ERROR_CODES);
+ return ERROR_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
+ }
- oplock_request = 0;
- fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
+ oplock_request = 0;
+ fsp = open_directory(conn, fname, &sbuf, desired_access, smb_open_mode, smb_ofun, unixmode, &smb_action);
- if(!fsp) {
+ if(!fsp) {
+ restore_case_semantics(file_attributes);
+ set_bad_path_error(errno, bad_path);
+ return(UNIXERROR(ERRDOS,ERRnoaccess));
+ }
+ } else {
restore_case_semantics(file_attributes);
set_bad_path_error(errno, bad_path);
return(UNIXERROR(ERRDOS,ERRnoaccess));
}
- } else {
-
- restore_case_semantics(file_attributes);
- set_bad_path_error(errno, bad_path);
- return(UNIXERROR(ERRDOS,ERRnoaccess));
- }
- }
+ }
- file_len = sbuf.st_size;
- fmode = dos_mode(conn,fname,&sbuf);
- if(fmode == 0)
- fmode = FILE_ATTRIBUTE_NORMAL;
+ file_len = sbuf.st_size;
+ fmode = dos_mode(conn,fname,&sbuf);
+ if(fmode == 0)
+ fmode = FILE_ATTRIBUTE_NORMAL;
- if (fmode & aDIR) {
- close_file(fsp,False);
- restore_case_semantics(file_attributes);
- return ERROR_DOS(ERRDOS,ERRnoaccess);
- }
+ if (fmode & aDIR) {
+ close_file(fsp,False);
+ restore_case_semantics(file_attributes);
+ return ERROR_DOS(ERRDOS,ERRnoaccess);
+ }
- /*
- * If the caller set the extended oplock request bit
- * and we granted one (by whatever means) - set the
- * correct bit for extended oplock reply.
- */
+ /*
+ * If the caller set the extended oplock request bit
+ * and we granted one (by whatever means) - set the
+ * correct bit for extended oplock reply.
+ */
- if (oplock_request && lp_fake_oplocks(SNUM(conn)))
- smb_action |= EXTENDED_OPLOCK_GRANTED;
+ if (oplock_request && lp_fake_oplocks(SNUM(conn)))
+ smb_action |= EXTENDED_OPLOCK_GRANTED;
- if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
- smb_action |= EXTENDED_OPLOCK_GRANTED;
- }
+ if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
+ smb_action |= EXTENDED_OPLOCK_GRANTED;
+ }
- /*
- * Now try and apply the desired SD.
- */
+ /*
+ * Now try and apply the desired SD.
+ */
- if (!set_sd( fsp, data, sd_len, ALL_SECURITY_INFORMATION, &error_class, &error_code)) {
- close_file(fsp,False);
- restore_case_semantics(file_attributes);
- return ERROR_DOS(error_class, error_code);
- }
+ if (!set_sd( fsp, data, sd_len, ALL_SECURITY_INFORMATION, &error_class, &error_code)) {
+ close_file(fsp,False);
+ restore_case_semantics(file_attributes);
+ return ERROR_DOS(error_class, error_code);
+ }
- restore_case_semantics(file_attributes);
+ restore_case_semantics(file_attributes);
- /* Realloc the size of parameters and data we will return */
- params = Realloc(*ppparams, 69);
- if(params == NULL)
- return ERROR_DOS(ERRDOS,ERRnomem);
+ /* Realloc the size of parameters and data we will return */
+ params = Realloc(*ppparams, 69);
+ if(params == NULL)
+ return ERROR_DOS(ERRDOS,ERRnomem);
- *ppparams = params;
+ *ppparams = params;
- memset((char *)params,'\0',69);
+ memset((char *)params,'\0',69);
- p = params;
- if (smb_action & EXTENDED_OPLOCK_GRANTED)
- SCVAL(p,0, BATCH_OPLOCK_RETURN);
- else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
- SCVAL(p,0, LEVEL_II_OPLOCK_RETURN);
- else
- SCVAL(p,0,NO_OPLOCK_RETURN);
+ p = params;
+ if (smb_action & EXTENDED_OPLOCK_GRANTED)
+ SCVAL(p,0, BATCH_OPLOCK_RETURN);
+ else if (LEVEL_II_OPLOCK_TYPE(fsp->oplock_type))
+ SCVAL(p,0, LEVEL_II_OPLOCK_RETURN);
+ else
+ SCVAL(p,0,NO_OPLOCK_RETURN);
- p += 2;
- SSVAL(p,0,fsp->fnum);
- p += 2;
- SIVAL(p,0,smb_action);
- p += 8;
-
- /* Create time. */
- c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
-
- if (lp_dos_filetime_resolution(SNUM(conn))) {
- c_time &= ~1;
- sbuf.st_atime &= ~1;
- sbuf.st_mtime &= ~1;
- sbuf.st_mtime &= ~1;
- }
+ p += 2;
+ SSVAL(p,0,fsp->fnum);
+ p += 2;
+ SIVAL(p,0,smb_action);
+ p += 8;
- put_long_date(p,c_time);
- p += 8;
- put_long_date(p,sbuf.st_atime); /* access time */
- p += 8;
- put_long_date(p,sbuf.st_mtime); /* write time */
- p += 8;
- put_long_date(p,sbuf.st_mtime); /* change time */
- p += 8;
- SIVAL(p,0,fmode); /* File Attributes. */
- p += 4;
- SOFF_T(p, 0, SMB_ROUNDUP_ALLOCATION(file_len));
- p += 8;
- SOFF_T(p,0,file_len);
-
- DEBUG(5,("call_nt_transact_create: open name = %s\n", fname));
-
- /* Send the required number of replies */
- send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 69, *ppdata, 0);
+ /* Create time. */
+ c_time = get_create_time(&sbuf,lp_fake_dir_create_times(SNUM(conn)));
- return -1;
+ if (lp_dos_filetime_resolution(SNUM(conn))) {
+ c_time &= ~1;
+ sbuf.st_atime &= ~1;
+ sbuf.st_mtime &= ~1;
+ sbuf.st_mtime &= ~1;
+ }
+
+ put_long_date(p,c_time);
+ p += 8;
+ put_long_date(p,sbuf.st_atime); /* access time */
+ p += 8;
+ put_long_date(p,sbuf.st_mtime); /* write time */
+ p += 8;
+ put_long_date(p,sbuf.st_mtime); /* change time */
+ p += 8;
+ SIVAL(p,0,fmode); /* File Attributes. */
+ p += 4;
+ SOFF_T(p, 0, SMB_ROUNDUP_ALLOCATION(file_len));
+ p += 8;
+ SOFF_T(p,0,file_len);
+
+ DEBUG(5,("call_nt_transact_create: open name = %s\n", fname));
+
+ /* Send the required number of replies */
+ send_nt_replies(inbuf, outbuf, bufsize, NT_STATUS_OK, params, 69, *ppdata, 0);
+
+ return -1;
}
/****************************************************************************
@@ -1588,18 +1603,19 @@ static int call_nt_transact_set_security_desc(connection_struct *conn,
/****************************************************************************
Reply to IOCTL - not implemented - no plans.
****************************************************************************/
+
static int call_nt_transact_ioctl(connection_struct *conn,
char *inbuf, char *outbuf, int length,
int bufsize,
char **ppsetup, char **ppparams, char **ppdata)
{
- static BOOL logged_message = False;
+ static BOOL logged_message = False;
- if(!logged_message) {
- DEBUG(0,("call_nt_transact_ioctl: Currently not implemented.\n"));
- logged_message = True; /* Only print this once... */
- }
- return ERROR_DOS(ERRSRV,ERRnosupport);
+ if(!logged_message) {
+ DEBUG(0,("call_nt_transact_ioctl: Currently not implemented.\n"));
+ logged_message = True; /* Only print this once... */
+ }
+ return ERROR_DOS(ERRSRV,ERRnosupport);
}
/****************************************************************************
--
cgit
From 4e5e5481707537c93f8ab7b9eae00498131ed5d9 Mon Sep 17 00:00:00 2001
From: Richard Sharpe
Date: Wed, 17 Apr 2002 22:50:02 +0000
Subject: Fix smbtorture so it can handle collisions etc ... (This used to be
commit ba4d6c76aabd3d1fd8dc1e2335baf50c58d636a7)
---
source3/torture/nbio.c | 23 +++++++++++++++++++----
source3/torture/torture.c | 4 ++--
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index 0d6955c879..bf9305f8e8 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -79,6 +79,16 @@ void nbio_shmem(int n)
}
}
+static int ne_find_handle(int handle)
+{
+ int i;
+ children[nbio_id].line = line_count;
+ for (i=0;i
Date: Thu, 18 Apr 2002 01:48:45 +0000
Subject: Fix found by Li Shao @ HP - XP clients don't bother to set the
devmode_ptr in the SetPrinter() call - they send it in the devmode_ctr
instead. Jeremy. (This used to be commit
f988a1af034b4cea2412171a257a752192afaece)
---
source3/rpc_server/srv_spoolss_nt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index a8552cd14d..5fa45b0b44 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -5084,7 +5084,7 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
goto done;
}
- if (info->info_2->devmode_ptr != 0) {
+ if (devmode) {
/* we have a valid devmode
convert it and link it*/
--
cgit
From 5b8135e038b2d6b130219e39b8e88cc242604cab Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Thu, 18 Apr 2002 02:13:55 +0000
Subject: - fixed the is_mangled() interface to handle multiple components -
fixed the no-extension case of reverse mangling (This used to be commit
64a2ae5cee4ffc5ae3c902705b6e1050f649e3a5)
---
source3/smbd/mangle_hash2.c | 47 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 959a93e07b..5b3c63ec55 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -184,12 +184,12 @@ static const char *cache_lookup(u32 hash)
In this algorithm, mangled names use only pure ascii characters (no
multi-byte) so we can avoid doing a UCS2 conversion
-*/
-static BOOL is_mangled(const char *name)
+ */
+static BOOL is_mangled_component(const char *name)
{
int len, i;
- M_DEBUG(0,("is_mangled %s ?\n", name));
+ M_DEBUG(0,("is_mangled_component %s ?\n", name));
/* the best distinguishing characteristic is the ~ */
if (name[6] != '~') return False;
@@ -229,6 +229,39 @@ static BOOL is_mangled(const char *name)
}
+
+/*
+ determine if a string is possibly in a mangled format, ignoring
+ case
+
+ In this algorithm, mangled names use only pure ascii characters (no
+ multi-byte) so we can avoid doing a UCS2 conversion
+
+ NOTE! This interface must be able to handle a path with unix
+ directory separators. It should return true if any component is
+ mangled
+ */
+static BOOL is_mangled(const char *name)
+{
+ char *p;
+ char *s;
+
+ M_DEBUG(0,("is_mangled %s ?\n", name));
+
+ for (s=name; (p=strchr(s, '/')); s=p+1) {
+ char *component = strndup(s, PTR_DIFF(p, s));
+ if (is_mangled_component(component)) {
+ free(component);
+ return True;
+ }
+ free(component);
+ }
+
+ /* and the last part ... */
+ return is_mangled_component(s);
+}
+
+
/*
see if a filename is an allowable 8.3 name.
@@ -343,8 +376,12 @@ static BOOL check_cache(char *name)
}
/* we found it - construct the full name */
- strncpy(extension, name+9, 3);
- extension[3] = 0;
+ if (name[8] == '.') {
+ strncpy(extension, name+9, 3);
+ extension[3] = 0;
+ } else {
+ extension[0] = 0;
+ }
if (extension[0]) {
M_DEBUG(0,("check_cache: %s -> %s.%s\n", name, prefix, extension));
--
cgit
From eaf7e2b374d6a77e573195da1d7617bea97b1a94 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Thu, 18 Apr 2002 03:24:02 +0000
Subject: make proto (This used to be commit
a721843197d39c0edc6c464214123be3300d0b91)
---
source3/python/py_lsa_proto.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/python/py_lsa_proto.h b/source3/python/py_lsa_proto.h
index 066a0aad53..1c6f6ab1d1 100644
--- a/source3/python/py_lsa_proto.h
+++ b/source3/python/py_lsa_proto.h
@@ -6,8 +6,8 @@
/* The following definitions come from python/py_lsa.c */
-PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol);
+PyObject *new_lsa_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ POLICY_HND *pol);
void initlsa(void);
#endif /* _PY_LSA_PROTO_H */
--
cgit
From b0fbd72b41dda039d4fd1036998721ee7387cd45 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Thu, 18 Apr 2002 03:35:05 +0000
Subject: Started working on setprinter code. (This used to be commit
38d2b1794a0942ac4c2787f06bc5e546508c2515)
---
source3/python/py_common_proto.h | 6 +-
source3/python/py_ntsec.c | 151 ++++++++++++++++++++++++++++--
source3/python/py_spoolss_printers.c | 42 +++------
source3/python/py_spoolss_printers_conv.c | 27 +++++-
source3/python/py_spoolss_proto.h | 15 +--
source3/python/samba-head.patch | 15 ++-
6 files changed, 197 insertions(+), 59 deletions(-)
diff --git a/source3/python/py_common_proto.h b/source3/python/py_common_proto.h
index 0c227ffef8..bca59689a4 100644
--- a/source3/python/py_common_proto.h
+++ b/source3/python/py_common_proto.h
@@ -19,12 +19,12 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
/* The following definitions come from python/py_ntsec.c */
BOOL py_from_SID(PyObject **obj, DOM_SID *sid);
-BOOL py_to_SID(DOM_SID *sid, PyObject *dict);
+BOOL py_to_SID(DOM_SID *sid, PyObject *obj);
BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace);
BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict);
BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl);
-BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict);
+BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx);
BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd);
-BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict);
+BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx);
#endif /* _PY_COMMON_PROTO_H */
diff --git a/source3/python/py_ntsec.c b/source3/python/py_ntsec.c
index d97bbb6f8c..d8ed50379f 100644
--- a/source3/python/py_ntsec.c
+++ b/source3/python/py_ntsec.c
@@ -43,9 +43,19 @@ BOOL py_from_SID(PyObject **obj, DOM_SID *sid)
return True;
}
-BOOL py_to_SID(DOM_SID *sid, PyObject *dict)
+BOOL py_to_SID(DOM_SID *sid, PyObject *obj)
{
- return False;
+ BOOL result;
+
+ if (!PyString_Check(obj))
+ return False;
+
+ result = string_to_sid(sid, PyString_AsString(obj));
+
+ if (result)
+ DEBUG(0, ("py: got sid %s\n", PyString_AsString(obj)));
+
+ return result;
}
BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace)
@@ -72,7 +82,50 @@ BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace)
BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict)
{
- return False;
+ PyObject *obj;
+ uint8 ace_type, ace_flags;
+ DOM_SID trustee;
+ SEC_ACCESS sec_access;
+
+ if (!PyDict_Check(dict))
+ return False;
+
+ if (!(obj = PyDict_GetItemString(dict, "type")) ||
+ !PyInt_Check(obj))
+ return False;
+
+ ace_type = PyInt_AsLong(obj);
+
+ DEBUG(0, ("py: got ace_type %d\n", ace_type));
+
+ if (!(obj = PyDict_GetItemString(dict, "flags")) ||
+ !PyInt_Check(obj))
+ return False;
+
+ ace_flags = PyInt_AsLong(obj);
+
+ DEBUG(0, ("py: got ace_flags %d\n", ace_flags));
+
+ if (!(obj = PyDict_GetItemString(dict, "trustee")) ||
+ !PyString_Check(obj))
+ return False;
+
+ if (!py_to_SID(&trustee, obj))
+ return False;
+
+ DEBUG(0, ("py: got trustee\n"));
+
+ if (!(obj = PyDict_GetItemString(dict, "mask")) ||
+ !PyInt_Check(obj))
+ return False;
+
+ sec_access.mask = PyInt_AsLong(obj);
+
+ DEBUG(0, ("py: got mask 0x%08x\n", sec_access.mask));
+
+ init_sec_ace(ace, &trustee, ace_type, sec_access, ace_flags);
+
+ return True;
}
BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl)
@@ -104,9 +157,39 @@ BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl)
return True;
}
-BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict)
+BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx)
{
- return False;
+ PyObject *obj;
+ uint32 i;
+
+ if (!(obj = PyDict_GetItemString(dict, "revision")) ||
+ !PyInt_Check(obj))
+ return False;
+
+ acl->revision = PyInt_AsLong(obj);
+
+ DEBUG(0, ("py: got revision %d\n", acl->revision));
+
+ if (!(obj = PyDict_GetItemString(dict, "ace_list")) ||
+ !PyList_Check(obj))
+ return False;
+
+ acl->num_aces = PyList_Size(obj);
+
+ DEBUG(0, ("py: got num_aces %d\n", acl->num_aces));
+
+ acl->ace = talloc(mem_ctx, acl->num_aces * sizeof(SEC_ACE));
+
+ for (i = 0; i < acl->num_aces; i++) {
+ PyObject *py_ace = PyList_GetItem(obj, i);
+
+ if (!py_to_ACE(acl->ace, py_ace))
+ return False;
+
+ DEBUG(0, ("py: got ace %d\n", i));
+ }
+
+ return True;
}
BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd)
@@ -116,7 +199,6 @@ BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd)
*dict = PyDict_New();
PyDict_SetItemString(*dict, "revision", PyInt_FromLong(sd->revision));
- PyDict_SetItemString(*dict, "type", PyInt_FromLong(sd->type));
if (py_from_SID(&obj, sd->owner_sid))
PyDict_SetItemString(*dict, "owner_sid", obj);
@@ -133,7 +215,60 @@ BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd)
return True;
}
-BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict)
+BOOL py_to_SECDESC(SEC_DESC **sd, PyObject *dict, TALLOC_CTX *mem_ctx)
{
- return False;
+ PyObject *obj;
+ uint16 revision;
+ DOM_SID owner_sid, group_sid;
+ SEC_ACL sacl, dacl;
+ size_t sd_size;
+ BOOL got_dacl = False, got_sacl = False;
+
+ ZERO_STRUCT(dacl); ZERO_STRUCT(sacl);
+ ZERO_STRUCT(owner_sid); ZERO_STRUCT(group_sid);
+
+ if (!(obj = PyDict_GetItemString(dict, "revision")))
+ return False;
+
+ revision = PyInt_AsLong(obj);
+
+ if (!(obj = PyDict_GetItemString(dict, "owner_sid")))
+ return False;
+
+ if (!py_to_SID(&owner_sid, obj))
+ return False;
+
+ if (!(obj = PyDict_GetItemString(dict, "group_sid")))
+ return False;
+
+ if (!py_to_SID(&group_sid, obj))
+ return False;
+
+ if ((obj = PyDict_GetItemString(dict, "dacl"))) {
+
+ if (!py_to_ACL(&dacl, obj, mem_ctx))
+ return False;
+
+ got_dacl = True;
+ }
+
+ DEBUG(0, ("py: got dacl\n"));
+
+ if ((obj = PyDict_GetItemString(dict, "sacl"))) {
+ if (obj != Py_None) {
+
+ if (!py_to_ACL(&sacl, obj, mem_ctx))
+ return False;
+
+ got_sacl = True;
+ }
+ }
+
+ DEBUG(0, ("py: got sacl\n"));
+
+ *sd = make_sec_desc(mem_ctx, revision, &owner_sid, &group_sid,
+ got_sacl ? &sacl : NULL,
+ got_dacl ? &dacl : NULL, &sd_size);
+
+ return True;
}
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index 69b2733cfb..48321500e7 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -181,12 +181,8 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw)
uint32 level;
static char *kwlist[] = {"dict", NULL};
union {
- PRINTER_INFO_0 printers_0;
- PRINTER_INFO_1 printers_1;
PRINTER_INFO_2 printers_2;
PRINTER_INFO_3 printers_3;
- PRINTER_INFO_4 printers_4;
- PRINTER_INFO_5 printers_5;
} pinfo;
/* Parse parameters */
@@ -199,12 +195,22 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw)
if ((level_obj = PyDict_GetItemString(info, "level"))) {
- if (!PyInt_Check(level_obj))
+ if (!PyInt_Check(level_obj)) {
+ DEBUG(0, ("** level not an integer\n"));
goto error;
+ }
level = PyInt_AsLong(level_obj);
+ /* Only level 2, 3 supported by NT */
+
+ if (level != 2 && level != 3) {
+ DEBUG(0, ("** unsupported info level\n"));
+ goto error;
+ }
+
} else {
+ DEBUG(0, ("** no level info\n"));
error:
PyErr_SetString(spoolss_error, "invalid info");
return NULL;
@@ -215,34 +221,14 @@ PyObject *spoolss_setprinter(PyObject *self, PyObject *args, PyObject *kw)
ZERO_STRUCT(ctr);
switch (level) {
- case 2: {
- PyObject *devmode_obj;
-
+ case 2:
ctr.printers_2 = &pinfo.printers_2;
- if (!py_to_PRINTER_INFO_2(&pinfo.printers_2, info))
+ if (!py_to_PRINTER_INFO_2(&pinfo.printers_2, info,
+ hnd->mem_ctx))
goto error;
-#if 0
- devmode_obj = PyDict_GetItemString(info, "device_mode");
-
- pinfo.printers_2.devmode = talloc(
- hnd->mem_ctx, sizeof(DEVICEMODE));
-
- PyDEVICEMODE_AsDEVICEMODE(pinfo.printers_2.devmode,
- devmode_obj);
-
-#else
-
- /* FIXME: can we actually set the security descriptor using
- a setprinter level 2? */
-
- pinfo.printers_2.secdesc = NULL;
- pinfo.printers_2.secdesc = NULL;
-
-#endif
break;
- }
default:
PyErr_SetString(spoolss_error, "unsupported info level");
return NULL;
diff --git a/source3/python/py_spoolss_printers_conv.c b/source3/python/py_spoolss_printers_conv.c
index 84b36ddbb2..4b78f087e6 100644
--- a/source3/python/py_spoolss_printers_conv.c
+++ b/source3/python/py_spoolss_printers_conv.c
@@ -165,9 +165,7 @@ BOOL py_to_DEVICEMODE(DEVICEMODE *devmode, PyObject *dict)
to_struct(devmode, dict, py_DEVICEMODE);
- obj = PyDict_GetItemString(dict, "private");
-
- if (!obj)
+ if (!(obj = PyDict_GetItemString(dict, "private")))
return False;
devmode->private = PyString_AsString(obj);
@@ -225,9 +223,28 @@ BOOL py_from_PRINTER_INFO_2(PyObject **dict, PRINTER_INFO_2 *info)
return True;
}
-BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict)
+BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
+ TALLOC_CTX *mem_ctx)
{
- return False;
+ PyObject *obj;
+
+ to_struct(info, dict, py_PRINTER_INFO_2);
+
+ if (!(obj = PyDict_GetItemString(dict, "security_descriptor")))
+ return False;
+
+ if (!py_to_SECDESC(&info->secdesc, obj, mem_ctx))
+ return False;
+
+ if (!(obj = PyDict_GetItemString(dict, "device_mode")))
+ return False;
+
+ info->devmode = talloc(mem_ctx, sizeof(DEVICEMODE));
+
+ if (!py_to_DEVICEMODE(info->devmode, obj))
+ return False;
+
+ return True;
}
/*
diff --git a/source3/python/py_spoolss_proto.h b/source3/python/py_spoolss_proto.h
index 3e3e5ef6ee..47602d175d 100644
--- a/source3/python/py_spoolss_proto.h
+++ b/source3/python/py_spoolss_proto.h
@@ -6,8 +6,8 @@
/* The following definitions come from python/py_spoolss.c */
-PyObject *new_policy_hnd_object(struct cli_state *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol);
+PyObject *new_spoolss_policy_hnd_object(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx, POLICY_HND *pol);
void initspoolss(void);
/* The following definitions come from python/py_spoolss_drivers.c */
@@ -66,14 +66,6 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw);
/* The following definitions come from python/py_spoolss_printers_conv.c */
-BOOL py_from_SID(PyObject **obj, DOM_SID *sid);
-BOOL py_to_SID(DOM_SID *sid, PyObject *dict);
-BOOL py_from_ACE(PyObject **dict, SEC_ACE *ace);
-BOOL py_to_ACE(SEC_ACE *ace, PyObject *dict);
-BOOL py_from_ACL(PyObject **dict, SEC_ACL *acl);
-BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict);
-BOOL py_from_SECDESC(PyObject **dict, SEC_DESC *sd);
-BOOL py_to_SECDESC(SEC_DESC *sd, PyObject *dict);
BOOL py_from_DEVICEMODE(PyObject **dict, DEVICEMODE *devmode);
BOOL py_to_DEVICEMODE(DEVICEMODE *devmode, PyObject *dict);
BOOL py_from_PRINTER_INFO_0(PyObject **dict, PRINTER_INFO_0 *info);
@@ -81,7 +73,8 @@ BOOL py_to_PRINTER_INFO_0(PRINTER_INFO_0 *info, PyObject *dict);
BOOL py_from_PRINTER_INFO_1(PyObject **dict, PRINTER_INFO_1 *info);
BOOL py_to_PRINTER_INFO_1(PRINTER_INFO_1 *info, PyObject *dict);
BOOL py_from_PRINTER_INFO_2(PyObject **dict, PRINTER_INFO_2 *info);
-BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict);
+BOOL py_to_PRINTER_INFO_2(PRINTER_INFO_2 *info, PyObject *dict,
+ TALLOC_CTX *mem_ctx);
BOOL py_from_PRINTER_INFO_3(PyObject **dict, PRINTER_INFO_3 *info);
BOOL py_to_PRINTER_INFO_3(PRINTER_INFO_3 *info, PyObject *dict);
diff --git a/source3/python/samba-head.patch b/source3/python/samba-head.patch
index 223e0179fb..c8089934b8 100644
--- a/source3/python/samba-head.patch
+++ b/source3/python/samba-head.patch
@@ -4,8 +4,8 @@ RCS file: /data/cvs/samba/source/Makefile.in,v
retrieving revision 1.470
diff -u -r1.470 Makefile.in
--- Makefile.in 2002/04/13 11:45:33 1.470
-+++ Makefile.in 2002/04/14 01:01:05
-@@ -787,6 +787,36 @@
++++ Makefile.in 2002/04/18 03:34:05
+@@ -787,6 +787,43 @@
-$(INSTALLCMD) -d ${prefix}/include
-$(INSTALLCMD) include/libsmbclient.h ${prefix}/include
@@ -22,7 +22,9 @@ diff -u -r1.470 Makefile.in
+
+PY_LSA_PROTO_OBJ = python/py_lsa.o
+
-+python_proto: python_spoolss_proto python_lsa_proto
++PY_COMMON_PROTO_OBJ = python/py_common.c python/py_ntsec.c
++
++python_proto: python_spoolss_proto python_lsa_proto python_common_proto
+
+python_spoolss_proto:
+ @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
@@ -34,6 +36,11 @@ diff -u -r1.470 Makefile.in
+ -h _PY_LSA_PROTO_H python/py_lsa_proto.h \
+ $(PY_LSA_PROTO_OBJ)
+
++python_common_proto:
++ @cd $(srcdir) && $(SHELL) script/mkproto.sh $(AWK) \
++ -h _PY_COMMON_PROTO_H python/py_common_proto.h \
++ $(PY_COMMON_PROTO_OBJ)
++
+python_ext: $(PYTHON_OBJS)
+ @echo python python/setup.py build
+ @PYTHON_OBJS="$(PYTHON_OBJS)" PYTHON_CFLAGS="$(CFLAGS) $(CPPFLAGS)" \
@@ -48,7 +55,7 @@ RCS file: /data/cvs/samba/source/configure.in,v
retrieving revision 1.300
diff -u -r1.300 configure.in
--- configure.in 2002/04/11 15:26:58 1.300
-+++ configure.in 2002/04/14 01:01:08
++++ configure.in 2002/04/18 03:34:05
@@ -2716,7 +2716,7 @@
builddir=`pwd`
AC_SUBST(builddir)
--
cgit
From 6a9bc86d62cc9ba532392af02a5d71e50b6b0411 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Thu, 18 Apr 2002 03:59:02 +0000
Subject: nicer strndup() function (This used to be commit
546764f3cbbefaad312386280dd2ebbbe5b4446d)
---
source3/lib/util_str.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index f6e579ddba..ff3559ce14 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -991,13 +991,13 @@ some platforms don't have strndup
char *strndup(const char *s, size_t n)
{
char *ret;
- int i;
- for (i=0;s[i] && i
Date: Thu, 18 Apr 2002 06:56:44 +0000
Subject: fixed the fallback to a BDC for ADS connections (This used to be
commit 3e58a1ee83ea0b4347ce24e566445cc6cb67bb3a)
---
source3/include/ads.h | 1 +
source3/libads/ads_struct.c | 19 ++++++++++++++++++-
source3/libads/ldap.c | 24 ++++++++++++++++++++++++
source3/nsswitch/winbindd_ads.c | 4 +++-
source3/smbd/negprot.c | 2 +-
source3/smbd/sesssetup.c | 2 +-
source3/utils/net_ads.c | 9 ++++-----
7 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/source3/include/ads.h b/source3/include/ads.h
index 8658e72f6a..b3e18f18b8 100644
--- a/source3/include/ads.h
+++ b/source3/include/ads.h
@@ -7,6 +7,7 @@
typedef struct {
void *ld;
char *realm;
+ char *workgroup;
char *ldap_server;
char *ldap_server_name;
char *kdc_server;
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 489f301ae2..816b616097 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -90,7 +90,12 @@ static char *find_ldap_server(ADS_STRUCT *ads)
}
/* get desperate, find the domain controller IP */
- if (resolve_name(lp_workgroup(), &ip, 0x1B)) {
+ if (resolve_name(ads->workgroup, &ip, 0x1B)) {
+ return strdup(inet_ntoa(ip));
+ }
+
+ /* or a BDC ... */
+ if (resolve_name(ads->workgroup, &ip, 0x1C)) {
return strdup(inet_ntoa(ip));
}
@@ -115,6 +120,7 @@ static char *find_ldap_server(ADS_STRUCT *ads)
initialise a ADS_STRUCT, ready for some ads_ ops
*/
ADS_STRUCT *ads_init(const char *realm,
+ const char *workgroup,
const char *ldap_server,
const char *bind_path,
const char *password)
@@ -124,7 +130,12 @@ ADS_STRUCT *ads_init(const char *realm,
ads = (ADS_STRUCT *)smb_xmalloc(sizeof(*ads));
ZERO_STRUCTP(ads);
+ if (!workgroup) {
+ workgroup = lp_workgroup();
+ }
+
ads->realm = realm? strdup(realm) : NULL;
+ ads->workgroup = strdup(workgroup);
ads->ldap_server = ldap_server? strdup(ldap_server) : NULL;
ads->bind_path = bind_path? strdup(bind_path) : NULL;
ads->ldap_port = LDAP_PORT;
@@ -153,6 +164,12 @@ ADS_STRUCT *ads_init(const char *realm,
return ads;
}
+/* a simpler ads_init() interface using all defaults */
+ADS_STRUCT *ads_init_simple(void)
+{
+ return ads_init(NULL, NULL, NULL, NULL, NULL);
+}
+
/*
free the memory used by the ADS structure initialized with 'ads_init(...)'
*/
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index e2e351bd4b..3b787c6a8f 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -46,9 +46,33 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
ads->last_attempt = time(NULL);
ads->ld = ldap_open(ads->ldap_server, ads->ldap_port);
+
+ /* if that failed then try each of the BDC's in turn */
+ if (!ads->ld) {
+ struct in_addr *ip_list;
+ int count;
+
+ if (get_dc_list(False, ads->workgroup, &ip_list, &count)) {
+ int i;
+ for (i=0;ild = ldap_open(inet_ntoa(ip_list[i]),
+ ads->ldap_port);
+ if (ads->ld) break;
+ }
+ if (ads->ld) {
+ free(ads->ldap_server);
+ ads->ldap_server = strdup(inet_ntoa(ip_list[i]));
+ }
+ free(ip_list);
+ }
+ }
+
if (!ads->ld) {
return ADS_ERROR_SYSTEM(errno);
}
+
+ DEBUG(3,("Connected to LDAP server %s\n", ads->ldap_server));
+
status = ads_server_info(ads);
if (!ADS_ERR_OK(status)) {
DEBUG(1,("Failed to get ldap server info\n"));
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index af0933716b..6c00ddb95f 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -119,6 +119,8 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
if (resolve_name(domain->name, &server_ip, 0x1b)) {
sname = inet_ntoa(server_ip);
+ } else if (resolve_name(domain->name, &server_ip, 0x1c)) {
+ sname = inet_ntoa(server_ip);
} else {
if (strcasecmp(domain->name, lp_workgroup()) != 0) {
DEBUG(1,("can't find domain controller for %s\n", domain->name));
@@ -127,7 +129,7 @@ static ADS_STRUCT *ads_cached_connection(struct winbindd_domain *domain)
sname = NULL;
}
- ads = ads_init(primary_realm, sname, NULL, NULL);
+ ads = ads_init(primary_realm, domain->name, NULL, NULL, NULL);
if (!ads) {
DEBUG(1,("ads_init for domain %s failed\n", domain->name));
return NULL;
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index 18682e6c9f..c548ee6196 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -197,7 +197,7 @@ static int negprot_spnego(char *p)
blob = spnego_gen_negTokenInit(guid, OIDs_plain, "NONE");
} else {
ADS_STRUCT *ads;
- ads = ads_init(NULL, NULL, NULL, NULL);
+ ads = ads_init_simple();
/* win2000 uses host$@REALM, which we will probably use eventually,
but for now this works */
asprintf(&principal, "HOST/%s@%s", guid, ads->realm);
diff --git a/source3/smbd/sesssetup.c b/source3/smbd/sesssetup.c
index 8b9d826067..66eb6a2d92 100644
--- a/source3/smbd/sesssetup.c
+++ b/source3/smbd/sesssetup.c
@@ -120,7 +120,7 @@ static int reply_spnego_kerberos(connection_struct *conn,
return ERROR_NT(NT_STATUS_LOGON_FAILURE);
}
- ads = ads_init(NULL, NULL, NULL, NULL);
+ ads = ads_init_simple();
ret = ads_verify_ticket(ads, &ticket, &client, &auth_data);
if (!NT_STATUS_IS_OK(ret)) {
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 68fa89ea35..ea261187ce 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -56,7 +56,7 @@ static int net_ads_info(int argc, const char **argv)
{
ADS_STRUCT *ads;
- ads = ads_init(NULL, opt_host, NULL, NULL);
+ ads = ads_init(NULL, NULL, opt_host, NULL, NULL);
ads_connect(ads);
if (!ads) {
@@ -81,7 +81,7 @@ static ADS_STRUCT *ads_startup(void)
BOOL need_password = False;
BOOL second_time = False;
- ads = ads_init(NULL, opt_host, NULL, NULL);
+ ads = ads_init(NULL, NULL, opt_host, NULL, NULL);
if (!opt_user_name) {
opt_user_name = "administrator";
@@ -650,7 +650,7 @@ static int net_ads_password(int argc, const char **argv)
/* use the realm so we can eventually change passwords for users
in realms other than default */
- if (!(ads = ads_init(realm, NULL, NULL, NULL))) return -1;
+ if (!(ads = ads_init(realm, NULL, NULL, NULL, NULL))) return -1;
asprintf(&prompt, "Enter new password for %s:", argv[0]);
@@ -681,8 +681,7 @@ static int net_ads_change_localhost_pass(int argc, const char **argv)
char *hostname;
ADS_STATUS ret;
-
- if (!(ads = ads_init(NULL, NULL, NULL, NULL))) return -1;
+ if (!(ads = ads_init_simple())) return -1;
hostname = strdup(global_myname);
strlower(hostname);
--
cgit
From ba309aaffac945fd8f2ecbb4d068e5bb7283a032 Mon Sep 17 00:00:00 2001
From: Richard Sharpe
Date: Thu, 18 Apr 2002 18:36:17 +0000
Subject: Back out the wrong changes I made yesterday ... (This used to be
commit 6d52aa1fc892b48d72a790800ee00d6d7bdc4844)
---
source3/torture/nbio.c | 13 ++++---------
source3/torture/torture.c | 4 ++--
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index bf9305f8e8..2d519b40ba 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -137,7 +137,7 @@ void nb_unlink(char *fname)
void nb_createx(char *fname,
- unsigned create_options, unsigned create_disposition, int handle, int no_err)
+ unsigned create_options, unsigned create_disposition, int handle)
{
int fd, i;
uint32 desired_access;
@@ -157,7 +157,7 @@ void nb_createx(char *fname,
if (fd == -1 && handle != -1) {
printf("ERROR: cli_nt_create_full failed for %s - %s\n",
fname, cli_errstr(c));
- if (!no_err) exit(1);
+ exit(1);
}
if (fd != -1 && handle == -1) {
printf("ERROR: cli_nt_create_full succeeded for %s\n", fname);
@@ -206,15 +206,10 @@ void nb_readx(int handle, int offset, int size, int ret_size)
children[nbio_id].bytes_in += ret_size;
}
-void nb_close(int handle, int no_err)
+void nb_close(int handle)
{
int i;
- if (no_err) {
- i = ne_find_handle(handle);
- if (i < 0) return;
- }
- else
- i = find_handle(handle);
+ i = find_handle(handle);
if (!cli_close(c, ftable[i].fd)) {
printf("(%d) close failed on handle %d\n", line_count, handle);
exit(1);
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index cce39d2112..23624d0733 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -707,9 +707,9 @@ static BOOL run_netbench(int client)
if (!strcmp(params[0],"NTCreateX")) {
nb_createx(params[1], ival(params[2]), ival(params[3]),
- ival(params[4]),ival(params[5]));
+ ival(params[4]));
} else if (!strcmp(params[0],"Close")) {
- nb_close(ival(params[1]),ival(params[2]));
+ nb_close(ival(params[1]));
} else if (!strcmp(params[0],"Rename")) {
nb_rename(params[1], params[2]);
} else if (!strcmp(params[0],"Unlink")) {
--
cgit
From dcb572e0b26858f58ddcf5cac1c94be31cda844d Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Fri, 19 Apr 2002 00:16:18 +0000
Subject: fixed a namequery bug caused by my recent string length patches (This
used to be commit b2329039d255928faf53474ee7ab06b6353b9fbe)
---
source3/libsmb/namequery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 7928d44652..c578df6621 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -191,7 +191,7 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t
if (i == count)
goto done;
- pull_ascii(name, status[i].name, 15, 0, STR_TERMINATE);
+ pull_ascii(name, status[i].name, 15, -1, STR_TERMINATE);
result = True;
done:
--
cgit
From 302b581ddc1f9dcee5c1bcb32da558ae2a7b24c1 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 02:08:52 +0000
Subject: First cut at fix for the EINTR problem... More needs to be done I
think. Jeremy. (This used to be commit
48475a7a697242b9fd7b1aec24389afb112569c4)
---
source3/lib/system.c | 45 ++++++++
source3/lib/util.c | 9 +-
source3/lib/util_sock.c | 266 +++++++++++++++++++++++-------------------------
source3/tdb/tdb.c | 8 +-
4 files changed, 187 insertions(+), 141 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 8c7eec939e..d97751eb4b 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -72,6 +72,51 @@ int sys_usleep(long usecs)
#endif /* HAVE_USLEEP */
}
+/*******************************************************************
+A read wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_read(int fd, void *buf, size_t count)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = read(fd, buf, count);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A write wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_write(int fd, const void *buf, size_t count)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = write(fd, buf, count);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A send wrapper that will deal with EINTR.
+********************************************************************/
+
+int sys_send(int s, const void *msg, size_t len, int flags)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = send(s, msg, len, flags);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
/*******************************************************************
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 7e2ad49639..c524adaa7a 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1353,11 +1353,12 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
lock.l_len = count;
lock.l_pid = 0;
- errno = 0;
+ do {
+ errno = 0;
+ ret = fcntl(fd,op,&lock);
+ } while (ret == -1 && errno == EINTR);
- ret = fcntl(fd,op,&lock);
-
- if (errno != 0)
+ if (ret == -1 && errno != 0)
DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
/* a lock query */
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index af3182264d..1c7f9ce115 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -247,10 +247,10 @@ static ssize_t read_socket_with_timeout(int fd,char *buf,size_t mincnt,size_t ma
if (fd == sslFd) {
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
} else {
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
}
#else /* WITH_SSL */
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
#endif /* WITH_SSL */
if (readret == 0) {
@@ -304,10 +304,10 @@ static ssize_t read_socket_with_timeout(int fd,char *buf,size_t mincnt,size_t ma
if (fd == sslFd) {
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
}else{
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
}
#else /* WITH_SSL */
- readret = read(fd, buf+nread, maxcnt-nread);
+ readret = sys_read(fd, buf+nread, maxcnt-nread);
#endif /* WITH_SSL */
if (readret == 0) {
@@ -357,10 +357,10 @@ ssize_t read_with_timeout(int fd, char *buf, size_t mincnt, size_t maxcnt,
if(fd == sslFd){
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
}else{
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
}
#else /* WITH_SSL */
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
#endif /* WITH_SSL */
if (readret <= 0)
@@ -387,10 +387,10 @@ ssize_t read_with_timeout(int fd, char *buf, size_t mincnt, size_t maxcnt,
if(fd == sslFd){
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
}else{
- readret = read(fd, buf + nread, maxcnt - nread);
+ readret = sys_read(fd, buf + nread, maxcnt - nread);
}
#else /* WITH_SSL */
- readret = read(fd, buf+nread, maxcnt-nread);
+ readret = sys_read(fd, buf+nread, maxcnt-nread);
#endif /* WITH_SSL */
if (readret <= 0)
@@ -409,12 +409,12 @@ send a keepalive packet (rfc1002)
BOOL send_keepalive(int client)
{
- unsigned char buf[4];
+ unsigned char buf[4];
- buf[0] = SMBkeepalive;
- buf[1] = buf[2] = buf[3] = 0;
+ buf[0] = SMBkeepalive;
+ buf[1] = buf[2] = buf[3] = 0;
- return(write_socket_data(client,(char *)buf,4) == 4);
+ return(write_socket_data(client,(char *)buf,4) == 4);
}
/****************************************************************************
@@ -423,38 +423,36 @@ BOOL send_keepalive(int client)
ssize_t read_data(int fd,char *buffer,size_t N)
{
- ssize_t ret;
- size_t total=0;
+ ssize_t ret;
+ size_t total=0;
- smb_read_error = 0;
+ smb_read_error = 0;
- while (total < N)
- {
+ while (total < N) {
#ifdef WITH_SSL
- if(fd == sslFd){
- ret = SSL_read(ssl, buffer + total, N - total);
- }else{
- ret = read(fd,buffer + total,N - total);
- }
+ if(fd == sslFd){
+ ret = SSL_read(ssl, buffer + total, N - total);
+ }else{
+ ret = sys_read(fd,buffer + total,N - total);
+ }
#else /* WITH_SSL */
- ret = read(fd,buffer + total,N - total);
+ ret = sys_read(fd,buffer + total,N - total);
#endif /* WITH_SSL */
- if (ret == 0)
- {
- DEBUG(10,("read_data: read of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
- smb_read_error = READ_EOF;
- return 0;
- }
- if (ret == -1)
- {
- DEBUG(0,("read_data: read failure for %d. Error = %s\n", (int)(N - total), strerror(errno) ));
- smb_read_error = READ_ERROR;
- return -1;
- }
- total += ret;
- }
- return (ssize_t)total;
+ if (ret == 0) {
+ DEBUG(10,("read_data: read of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
+ smb_read_error = READ_EOF;
+ return 0;
+ }
+
+ if (ret == -1) {
+ DEBUG(0,("read_data: read failure for %d. Error = %s\n", (int)(N - total), strerror(errno) ));
+ smb_read_error = READ_ERROR;
+ return -1;
+ }
+ total += ret;
+ }
+ return (ssize_t)total;
}
/****************************************************************************
@@ -463,38 +461,36 @@ ssize_t read_data(int fd,char *buffer,size_t N)
static ssize_t read_socket_data(int fd,char *buffer,size_t N)
{
- ssize_t ret;
- size_t total=0;
+ ssize_t ret;
+ size_t total=0;
- smb_read_error = 0;
+ smb_read_error = 0;
- while (total < N)
- {
+ while (total < N) {
#ifdef WITH_SSL
- if(fd == sslFd){
- ret = SSL_read(ssl, buffer + total, N - total);
- }else{
- ret = read(fd,buffer + total,N - total);
+ if(fd == sslFd){
+ ret = SSL_read(ssl, buffer + total, N - total);
+ }else{
+ ret = sys_read(fd,buffer + total,N - total);
}
#else /* WITH_SSL */
- ret = read(fd,buffer + total,N - total);
+ ret = sys_read(fd,buffer + total,N - total);
#endif /* WITH_SSL */
- if (ret == 0)
- {
- DEBUG(10,("read_socket_data: recv of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
- smb_read_error = READ_EOF;
- return 0;
- }
- if (ret == -1)
- {
- DEBUG(0,("read_socket_data: recv failure for %d. Error = %s\n", (int)(N - total), strerror(errno) ));
- smb_read_error = READ_ERROR;
- return -1;
- }
- total += ret;
- }
- return (ssize_t)total;
+ if (ret == 0) {
+ DEBUG(10,("read_socket_data: recv of %d returned 0. Error = %s\n", (int)(N - total), strerror(errno) ));
+ smb_read_error = READ_EOF;
+ return 0;
+ }
+
+ if (ret == -1) {
+ DEBUG(0,("read_socket_data: recv failure for %d. Error = %s\n", (int)(N - total), strerror(errno) ));
+ smb_read_error = READ_ERROR;
+ return -1;
+ }
+ total += ret;
+ }
+ return (ssize_t)total;
}
/****************************************************************************
@@ -503,30 +499,30 @@ static ssize_t read_socket_data(int fd,char *buffer,size_t N)
ssize_t write_data(int fd,char *buffer,size_t N)
{
- size_t total=0;
- ssize_t ret;
+ size_t total=0;
+ ssize_t ret;
- while (total < N)
- {
+ while (total < N) {
#ifdef WITH_SSL
- if(fd == sslFd){
- ret = SSL_write(ssl,buffer + total,N - total);
- }else{
- ret = write(fd,buffer + total,N - total);
- }
+ if(fd == sslFd){
+ ret = SSL_write(ssl,buffer + total,N - total);
+ }else{
+ ret = sys_write(fd,buffer + total,N - total);
+ }
#else /* WITH_SSL */
- ret = write(fd,buffer + total,N - total);
+ ret = sys_write(fd,buffer + total,N - total);
#endif /* WITH_SSL */
- if (ret == -1) {
- DEBUG(0,("write_data: write failure. Error = %s\n", strerror(errno) ));
- return -1;
- }
- if (ret == 0) return total;
+ if (ret == -1) {
+ DEBUG(0,("write_data: write failure. Error = %s\n", strerror(errno) ));
+ return -1;
+ }
+ if (ret == 0)
+ return total;
- total += ret;
- }
- return (ssize_t)total;
+ total += ret;
+ }
+ return (ssize_t)total;
}
/****************************************************************************
@@ -535,30 +531,30 @@ ssize_t write_data(int fd,char *buffer,size_t N)
ssize_t write_socket_data(int fd,char *buffer,size_t N)
{
- size_t total=0;
- ssize_t ret;
+ size_t total=0;
+ ssize_t ret;
- while (total < N)
- {
+ while (total < N) {
#ifdef WITH_SSL
- if(fd == sslFd){
- ret = SSL_write(ssl,buffer + total,N - total);
- }else{
- ret = send(fd,buffer + total,N - total, 0);
+ if(fd == sslFd){
+ ret = SSL_write(ssl,buffer + total,N - total);
+ }else{
+ ret = sys_send(fd,buffer + total,N - total, 0);
}
#else /* WITH_SSL */
- ret = send(fd,buffer + total,N - total,0);
+ ret = sys_send(fd,buffer + total,N - total,0);
#endif /* WITH_SSL */
- if (ret == -1) {
- DEBUG(0,("write_socket_data: write failure. Error = %s\n", strerror(errno) ));
- return -1;
- }
- if (ret == 0) return total;
+ if (ret == -1) {
+ DEBUG(0,("write_socket_data: write failure. Error = %s\n", strerror(errno) ));
+ return -1;
+ }
+ if (ret == 0)
+ return total;
- total += ret;
- }
- return (ssize_t)total;
+ total += ret;
+ }
+ return (ssize_t)total;
}
/****************************************************************************
@@ -567,17 +563,17 @@ write to a socket
ssize_t write_socket(int fd,char *buf,size_t len)
{
- ssize_t ret=0;
+ ssize_t ret=0;
- DEBUG(6,("write_socket(%d,%d)\n",fd,(int)len));
- ret = write_socket_data(fd,buf,len);
+ DEBUG(6,("write_socket(%d,%d)\n",fd,(int)len));
+ ret = write_socket_data(fd,buf,len);
- DEBUG(6,("write_socket(%d,%d) wrote %d\n",fd,(int)len,(int)ret));
- if(ret <= 0)
- DEBUG(0,("write_socket: Error writing %d bytes to socket %d: ERRNO = %s\n",
- (int)len, fd, strerror(errno) ));
+ DEBUG(6,("write_socket(%d,%d) wrote %d\n",fd,(int)len,(int)ret));
+ if(ret <= 0)
+ DEBUG(0,("write_socket: Error writing %d bytes to socket %d: ERRNO = %s\n",
+ (int)len, fd, strerror(errno) ));
- return(ret);
+ return(ret);
}
/****************************************************************************
@@ -590,30 +586,29 @@ timeout is in milliseconds.
static ssize_t read_smb_length_return_keepalive(int fd,char *inbuf,unsigned int timeout)
{
- ssize_t len=0;
- int msg_type;
- BOOL ok = False;
+ ssize_t len=0;
+ int msg_type;
+ BOOL ok = False;
- while (!ok)
- {
- if (timeout > 0)
- ok = (read_socket_with_timeout(fd,inbuf,4,4,timeout) == 4);
- else
- ok = (read_socket_data(fd,inbuf,4) == 4);
+ while (!ok) {
+ if (timeout > 0)
+ ok = (read_socket_with_timeout(fd,inbuf,4,4,timeout) == 4);
+ else
+ ok = (read_socket_data(fd,inbuf,4) == 4);
- if (!ok)
- return(-1);
+ if (!ok)
+ return(-1);
- len = smb_len(inbuf);
- msg_type = CVAL(inbuf,0);
+ len = smb_len(inbuf);
+ msg_type = CVAL(inbuf,0);
- if (msg_type == SMBkeepalive)
- DEBUG(5,("Got keepalive packet\n"));
- }
+ if (msg_type == SMBkeepalive)
+ DEBUG(5,("Got keepalive packet\n"));
+ }
- DEBUG(10,("got smb length of %d\n",len));
+ DEBUG(10,("got smb length of %d\n",len));
- return(len);
+ return(len);
}
/****************************************************************************
@@ -625,23 +620,22 @@ timeout is in milliseconds.
ssize_t read_smb_length(int fd,char *inbuf,unsigned int timeout)
{
- ssize_t len;
+ ssize_t len;
- for(;;)
- {
- len = read_smb_length_return_keepalive(fd, inbuf, timeout);
+ for(;;) {
+ len = read_smb_length_return_keepalive(fd, inbuf, timeout);
- if(len < 0)
- return len;
+ if(len < 0)
+ return len;
- /* Ignore session keepalives. */
- if(CVAL(inbuf,0) != SMBkeepalive)
- break;
- }
+ /* Ignore session keepalives. */
+ if(CVAL(inbuf,0) != SMBkeepalive)
+ break;
+ }
- DEBUG(10,("read_smb_length: got smb length of %d\n",len));
+ DEBUG(10,("read_smb_length: got smb length of %d\n",len));
- return len;
+ return len;
}
/****************************************************************************
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index 98caca82a1..e3ba1db0d2 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -169,6 +169,7 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
int rw_type, int lck_type, int probe)
{
struct flock fl;
+ int ret;
if (tdb->flags & TDB_NOLOCK)
return 0;
@@ -183,7 +184,12 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
fl.l_len = 1;
fl.l_pid = 0;
- if (fcntl(tdb->fd,lck_type,&fl) == -1) {
+ do {
+ errno = 0;
+ ret = fcntl(tdb->fd,lck_type,&fl);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret == -1) {
if (!probe) {
TDB_LOG((tdb, 5,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d\n",
tdb->fd, offset, rw_type, lck_type));
--
cgit
From e41915d7c802566f598ac844514913fb230f4f7d Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 02:15:10 +0000
Subject: Fix send and recvfrom. Jeremy. (This used to be commit
8cbc24c3bd0e2d2349625c3b5d2e12ac092ec5a8)
---
source3/lib/system.c | 17 ++++++++++++++++-
source3/lib/util_sock.c | 22 +++++++++++-----------
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index d97751eb4b..61f93dd6a5 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -106,7 +106,7 @@ ssize_t sys_write(int fd, const void *buf, size_t count)
A send wrapper that will deal with EINTR.
********************************************************************/
-int sys_send(int s, const void *msg, size_t len, int flags)
+ssize_t sys_send(int s, const void *msg, size_t len, int flags)
{
ssize_t ret;
@@ -117,6 +117,21 @@ int sys_send(int s, const void *msg, size_t len, int flags)
return ret;
}
+/*******************************************************************
+A recvfrom wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = recvfrom(s, buf, len, flags, from, fromlen);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
/*******************************************************************
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 1c7f9ce115..27336cefa2 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -42,20 +42,19 @@ int smb_read_error = 0;
BOOL is_a_socket(int fd)
{
- int v,l;
- l = sizeof(int);
- return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
+ int v,l;
+ l = sizeof(int);
+ return(getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0);
}
enum SOCK_OPT_TYPES {OPT_BOOL,OPT_INT,OPT_ON};
-typedef struct smb_socket_option
-{
- char *name;
- int level;
- int option;
- int value;
- int opttype;
+typedef struct smb_socket_option {
+ char *name;
+ int level;
+ int option;
+ int value;
+ int opttype;
} smb_socket_option;
smb_socket_option socket_options[] = {
@@ -97,6 +96,7 @@ smb_socket_option socket_options[] = {
/****************************************************************************
Print socket options.
****************************************************************************/
+
static void print_socket_options(int s)
{
int value, vlen = 4;
@@ -178,7 +178,7 @@ ssize_t read_udp_socket(int fd,char *buf,size_t len)
memset((char *)&sock,'\0',socklen);
memset((char *)&lastip,'\0',sizeof(lastip));
- ret = (ssize_t)recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen);
+ ret = (ssize_t)sys_recvfrom(fd,buf,len,0,(struct sockaddr *)&sock,&socklen);
if (ret <= 0) {
DEBUG(2,("read socket failed. ERRNO=%s\n",strerror(errno)));
return(0);
--
cgit
From 87fc82801285a83b6e2e0faf85ca0984e939b088 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 02:16:54 +0000
Subject: Fix oplock recvfrom. Jeremy. (This used to be commit
68c0eb5ca7bc96cfdc8df07bd84f3e49de024b81)
---
source3/smbd/oplock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 23606f1d14..2f74c4cd8c 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -131,7 +131,7 @@ BOOL receive_local_message(fd_set *fds, char *buffer, int buffer_len, int timeou
/*
* Read a loopback udp message.
*/
- msg_len = recvfrom(oplock_sock, &buffer[OPBRK_CMD_HEADER_LEN],
+ msg_len = sys_recvfrom(oplock_sock, &buffer[OPBRK_CMD_HEADER_LEN],
buffer_len - OPBRK_CMD_HEADER_LEN, 0, (struct sockaddr *)&from, &fromlen);
if(msg_len < 0) {
--
cgit
From e762f93821a21f460fecf7452d2363574ab04dad Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 02:20:04 +0000
Subject: Fixed sendto in oplock code. Jeremy. (This used to be commit
64974fa334fd757ff5cfd1bd32d7300bf8a6208c)
---
source3/lib/system.c | 15 +++++++++++++++
source3/smbd/oplock.c | 4 ++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 61f93dd6a5..7734328795 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -117,6 +117,21 @@ ssize_t sys_send(int s, const void *msg, size_t len, int flags)
return ret;
}
+/*******************************************************************
+A sendto wrapper that will deal with EINTR.
+********************************************************************/
+
+ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct sockaddr *to, socklen_t tolen)
+{
+ ssize_t ret;
+
+ do {
+ errno = 0;
+ ret = sendto(s, msg, len, flags, to, tolen);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
/*******************************************************************
A recvfrom wrapper that will deal with EINTR.
********************************************************************/
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 2f74c4cd8c..9469c05ec6 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -417,7 +417,7 @@ oplocks. Returning success.\n"));
toaddr.sin_port = htons(from_port);
toaddr.sin_family = AF_INET;
- if(sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0,
+ if(sys_sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0,
(struct sockaddr *)&toaddr, sizeof(toaddr)) < 0) {
DEBUG(0,("process_local_message: sendto process %d failed. Errno was %s\n",
(int)remotepid, strerror(errno)));
@@ -930,7 +930,7 @@ dev = %x, inode = %.0f, file_id = %lu and no fsp found !\n",
(unsigned int)dev, (double)inode, file_id );
}
- if(sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0,
+ if(sys_sendto(oplock_sock,op_break_msg,OPLOCK_BREAK_MSG_LEN,0,
(struct sockaddr *)&addr_out,sizeof(addr_out)) < 0) {
if( DEBUGLVL( 0 ) ) {
dbgtext( "request_oplock_break: failed when sending a oplock " );
--
cgit
From fc78c773f8216df1bbaa88d9007cf3f5df386e3d Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Fri, 19 Apr 2002 03:00:29 +0000
Subject: fixed trust relationships in ADS winbindd after breaking them with my
BDC changes ... (This used to be commit
8096032663690eafb6bb8b4f405d6231389d4f80)
---
source3/libads/ads_struct.c | 9 ++++++---
source3/libads/ldap.c | 8 ++++++--
source3/nsswitch/winbindd_ads.c | 2 +-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c
index 816b616097..638dc0b22e 100644
--- a/source3/libads/ads_struct.c
+++ b/source3/libads/ads_struct.c
@@ -81,7 +81,8 @@ static char *find_ldap_server(ADS_STRUCT *ads)
char *list = NULL;
struct in_addr ip;
- if (ads->realm &&
+ if (ads->realm &&
+ strcasecmp(ads->workgroup, lp_workgroup()) == 0 &&
ldap_domain2hostlist(ads->realm, &list) == LDAP_SUCCESS) {
char *p;
p = strchr(list, ':');
@@ -151,8 +152,10 @@ ADS_STRUCT *ads_init(const char *realm,
ads->bind_path = ads_build_dn(ads->realm);
}
if (!ads->ldap_server) {
- ads->ldap_server = strdup(lp_ads_server());
- if (!ads->ldap_server[0]) {
+ if (strcasecmp(ads->workgroup, lp_workgroup()) == 0) {
+ ads->ldap_server = strdup(lp_ads_server());
+ }
+ if (!ads->ldap_server || !ads->ldap_server[0]) {
ads->ldap_server = find_ldap_server(ads);
}
}
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index 3b787c6a8f..543e53bcf8 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -45,7 +45,11 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
ads->last_attempt = time(NULL);
- ads->ld = ldap_open(ads->ldap_server, ads->ldap_port);
+ ads->ld = NULL;
+
+ if (ads->ldap_server) {
+ ads->ld = ldap_open(ads->ldap_server, ads->ldap_port);
+ }
/* if that failed then try each of the BDC's in turn */
if (!ads->ld) {
@@ -60,7 +64,7 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
if (ads->ld) break;
}
if (ads->ld) {
- free(ads->ldap_server);
+ SAFE_FREE(ads->ldap_server);
ads->ldap_server = strdup(inet_ntoa(ip_list[i]));
}
free(ip_list);
diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c
index 6c00ddb95f..c16231b25d 100644
--- a/source3/nsswitch/winbindd_ads.c
+++ b/source3/nsswitch/winbindd_ads.c
@@ -58,7 +58,7 @@ ADS_STATUS ads_do_search_retry(ADS_STRUCT *ads, const char *bind_path, int scope
if (*res) ads_msgfree(ads, *res);
*res = NULL;
- DEBUG(1,("Reopening ads connection to %s after error %s\n",
+ DEBUG(3,("Reopening ads connection to %s after error %s\n",
ads->ldap_server, ads_errstr(status)));
if (ads->ld) {
ldap_unbind(ads->ld);
--
cgit
From b63be4e1abf419f68755c6b4def8d960c32e70cb Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 03:05:38 +0000
Subject: Added sys_fcntl (not to be used everywhere). Added sys_read/sys_write
for transfer_file. Jeremy. (This used to be commit
c7ff521bab838c070931f2b0ece4be3371fbcdbf)
---
source3/lib/system.c | 15 +++++++++++++++
source3/lib/util.c | 11 ++++-------
source3/lib/util_file.c | 1 +
source3/smbd/notify_kernel.c | 6 +++---
source3/smbd/oplock_irix.c | 12 ++++++------
source3/smbd/vfs-wrap.c | 4 ++--
6 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 7734328795..eaaa76743a 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -147,6 +147,21 @@ ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *f
return ret;
}
+/*******************************************************************
+A fcntl wrapper that will deal with EINTR.
+********************************************************************/
+
+int sys_fcntl(int fd, int cmd, void *arg)
+{
+ int ret;
+
+ do {
+ errno = 0;
+ ret = fcntl(fd, cmd, arg);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
/*******************************************************************
A stat() wrapper that will deal with 64 bit filesizes.
********************************************************************/
diff --git a/source3/lib/util.c b/source3/lib/util.c
index c524adaa7a..1ee1a9c06a 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -552,13 +552,13 @@ int set_blocking(int fd, BOOL set)
#endif
#endif
- if((val = fcntl(fd, F_GETFL, 0)) == -1)
+ if((val = sys_fcntl(fd, F_GETFL, 0)) == -1)
return -1;
if(set) /* Turn blocking on - ie. clear nonblock flag */
val &= ~FLAG_TO_SET;
else
val |= FLAG_TO_SET;
- return fcntl( fd, F_SETFL, val);
+ return sys_fcntl( fd, F_SETFL, val);
#undef FLAG_TO_SET
}
@@ -620,7 +620,7 @@ ssize_t transfer_file_internal(int infd, int outfd, size_t n, ssize_t (*read_fn)
SMB_OFF_T transfer_file(int infd,int outfd,SMB_OFF_T n)
{
- return (SMB_OFF_T)transfer_file_internal(infd, outfd, (size_t)n, read, write);
+ return (SMB_OFF_T)transfer_file_internal(infd, outfd, (size_t)n, sys_read, sys_write);
}
/*******************************************************************
@@ -1353,10 +1353,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
lock.l_len = count;
lock.l_pid = 0;
- do {
- errno = 0;
- ret = fcntl(fd,op,&lock);
- } while (ret == -1 && errno == EINTR);
+ ret = sys_fcntl(fd,op,&lock);
if (ret == -1 && errno != 0)
DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index e80267f84b..fd3aeb99d9 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -51,6 +51,7 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
lock.l_pid = 0;
alarm(waitsecs);
+ /* Note we must *NOT* use sys_fcntl here ! JRA */
ret = fcntl(fd, SMB_F_SETLKW, &lock);
alarm(0);
CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN);
diff --git a/source3/smbd/notify_kernel.c b/source3/smbd/notify_kernel.c
index 19ea41e195..e40b91443e 100644
--- a/source3/smbd/notify_kernel.c
+++ b/source3/smbd/notify_kernel.c
@@ -130,7 +130,7 @@ static void *kernel_register_notify(connection_struct *conn, char *path, uint32
return NULL;
}
- if (fcntl(fd, F_SETSIG, RT_SIGNAL_NOTIFY) == -1) {
+ if (sys_fcntl(fd, F_SETSIG, RT_SIGNAL_NOTIFY) == -1) {
DEBUG(3,("Failed to set signal handler for change notify\n"));
return NULL;
}
@@ -147,7 +147,7 @@ static void *kernel_register_notify(connection_struct *conn, char *path, uint32
if (flags & FILE_NOTIFY_CHANGE_EA) kernel_flags |= DN_ATTRIB;
if (flags & FILE_NOTIFY_CHANGE_FILE_NAME) kernel_flags |= DN_RENAME|DN_DELETE;
- if (fcntl(fd, F_NOTIFY, kernel_flags) == -1) {
+ if (sys_fcntl(fd, F_NOTIFY, kernel_flags) == -1) {
DEBUG(3,("Failed to set async flag for change notify\n"));
return NULL;
}
@@ -168,7 +168,7 @@ static BOOL kernel_notify_available(void)
int fd, ret;
fd = open("/tmp", O_RDONLY);
if (fd == -1) return False; /* uggh! */
- ret = fcntl(fd, F_NOTIFY, 0);
+ ret = sys_fcntl(fd, F_NOTIFY, 0);
close(fd);
return ret == 0;
}
diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c
index 14f6de27c4..65ede6ef73 100644
--- a/source3/smbd/oplock_irix.c
+++ b/source3/smbd/oplock_irix.c
@@ -56,7 +56,7 @@ static BOOL irix_oplocks_available(void)
unlink(tmpname);
- if(fcntl(fd, F_OPLKREG, pfd[1]) == -1) {
+ if(sys_fcntl(fd, F_OPLKREG, pfd[1]) == -1) {
DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \
Disabling kernel oplock support.\n" ));
close(pfd[0]);
@@ -65,7 +65,7 @@ Disabling kernel oplock support.\n" ));
return False;
}
- if(fcntl(fd, F_OPLKACK, OP_REVOKE) < 0 ) {
+ if(sys_fcntl(fd, F_OPLKACK, OP_REVOKE) < 0 ) {
DEBUG(0,("check_kernel_oplocks: Error when removing kernel oplock. Error was %s. \
Disabling kernel oplock support.\n", strerror(errno) ));
close(pfd[0]);
@@ -111,7 +111,7 @@ Error was %s.\n", strerror(errno) ));
* request outstanding.
*/
- if(fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) {
+ if(sys_fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) {
DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \
Error was %s.\n", strerror(errno) ));
if(errno == EAGAIN) {
@@ -164,7 +164,7 @@ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->i
static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type)
{
- if (fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) {
+ if (sys_fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) {
if(errno != EAGAIN) {
DEBUG(0,("set_file_oplock: Unable to get kernel oplock on file %s, dev = %x, \
inode = %.0f, file_id = %ul. Error was %s\n",
@@ -195,7 +195,7 @@ static void irix_release_kernel_oplock(files_struct *fsp)
* Check and print out the current kernel
* oplock state of this file.
*/
- int state = fcntl(fsp->fd, F_OPLKACK, -1);
+ int state = sys_fcntl(fsp->fd, F_OPLKACK, -1);
dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \
oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
(double)fsp->inode, fsp->file_id, state );
@@ -204,7 +204,7 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
/*
* Remove the kernel oplock on this file.
*/
- if(fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) {
+ if(sys_fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) {
if( DEBUGLVL( 0 )) {
dbgtext("release_kernel_oplock: Error when removing kernel oplock on file " );
dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n",
diff --git a/source3/smbd/vfs-wrap.c b/source3/smbd/vfs-wrap.c
index fadc435a2f..394086dc07 100644
--- a/source3/smbd/vfs-wrap.c
+++ b/source3/smbd/vfs-wrap.c
@@ -147,7 +147,7 @@ ssize_t vfswrap_read(files_struct *fsp, int fd, void *data, size_t n)
ssize_t result;
START_PROFILE_BYTES(syscall_read, n);
- result = read(fd, data, n);
+ result = sys_read(fd, data, n);
END_PROFILE(syscall_read);
return result;
}
@@ -157,7 +157,7 @@ ssize_t vfswrap_write(files_struct *fsp, int fd, const void *data, size_t n)
ssize_t result;
START_PROFILE_BYTES(syscall_write, n);
- result = write(fd, data, n);
+ result = sys_write(fd, data, n);
END_PROFILE(syscall_write);
return result;
}
--
cgit
From 82951732067b1b8ec86d44f250f5f2d80aba9a27 Mon Sep 17 00:00:00 2001
From: Jean-François Micouleau
Date: Fri, 19 Apr 2002 13:39:52 +0000
Subject: DEBUG cleanup.
J.F.
(This used to be commit 1ece80a6b70ab26eb1a8484134b536efa007f6f9)
---
source3/groupdb/mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 99ccffb464..060937fee2 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -637,7 +637,7 @@ BOOL get_group_map_from_ntname(char *name, GROUP_MAP *map, BOOL with_priv)
PRIVILEGE_SET *set;
if(!init_group_mapping()) {
- DEBUG(0,("failed to initialize group mapping"));
+ DEBUG(0,("get_group_map_from_ntname:failed to initialize group mapping"));
return(False);
}
--
cgit
From 2ad27d872c27461c5bb0c037f9861209a63bcc59 Mon Sep 17 00:00:00 2001
From: Jean-François Micouleau
Date: Fri, 19 Apr 2002 13:41:43 +0000
Subject: add NetUserEnum and NetGroupEnum lanmap API calls, untested. I don't
have anymore a SNAP/DELL NAS to test. from Kevin Stefanik.
J.F.
(This used to be commit d0ce52230b456108ad91361b51e30d9a9cb25dff)
---
source3/smbd/lanman.c | 246 +++++++++++++++++++++++++++++++-------------------
1 file changed, 152 insertions(+), 94 deletions(-)
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index 666bbb5f61..f8875c5c0f 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -1754,82 +1754,104 @@ static BOOL api_RNetGroupEnum(connection_struct *conn,uint16 vuid, char *param,c
char **rdata,char **rparam,
int *rdata_len,int *rparam_len)
{
+ int i;
+ int errflags=0;
+ int resume_context, cli_buf_size;
char *str1 = param+2;
char *str2 = skip_string(str1,1);
char *p = skip_string(str2,1);
- int uLevel = SVAL(p,0);
- char *p2;
- int count=0;
- if (!prefix_ok(str1,"WrLeh")) return False;
-
- /* check it's a supported variant */
- switch( uLevel )
- {
- case 0:
- p2 = "B21";
- break;
- default:
- return False;
+ GROUP_MAP *group_list;
+ int num_entries;
+
+ if (strcmp(str1,"WrLeh") != 0)
+ return False;
+
+ /* parameters
+ * W-> resume context (number of users to skip)
+ * r -> return parameter pointer to receive buffer
+ * L -> length of receive buffer
+ * e -> return parameter number of entries
+ * h -> return parameter total number of users
+ */
+ if (strcmp("B21",str2) != 0)
+ return False;
+
+ /* get list of domain groups SID_DOMAIN_GRP=2 */
+ if(!enum_group_mapping(2 , &group_list, &num_entries, False, False)) {
+ DEBUG(3,("api_RNetGroupEnum:failed to get group list"));
+ return False;
}
- if (strcmp(p2,str2) != 0) return False;
+ resume_context = SVAL(p,0);
+ cli_buf_size=SVAL(p+2,0);
+ DEBUG(10,("api_RNetGroupEnum:resume context: %d, client buffer size: %d\n", resume_context, cli_buf_size));
- *rdata_len = mdrcnt + 1024;
+ *rdata_len = cli_buf_size;
*rdata = REALLOC(*rdata,*rdata_len);
- SSVAL(*rparam,0,NERR_Success);
- SSVAL(*rparam,2,0); /* converter word */
-
p = *rdata;
- /* XXXX we need a real SAM database some day */
- pstrcpy(p,"Users"); p += 21; count++;
- pstrcpy(p,"Domain Users"); p += 21; count++;
- pstrcpy(p,"Guests"); p += 21; count++;
- pstrcpy(p,"Domain Guests"); p += 21; count++;
+ for(i=resume_context; i resume context (number of users to skip)
+ * r -> return parameter pointer to receive buffer
+ * L -> length of receive buffer
+ * e -> return parameter number of entries
+ * h -> return parameter total number of users
+ */
+
+ resume_context = SVAL(p,0);
+ cli_buf_size=SVAL(p+2,0);
+ DEBUG(10,("api_RNetUserEnum:resume context: %d, client buffer size: %d\n", resume_context, cli_buf_size));
+
*rparam_len = 8;
*rparam = REALLOC(*rparam,*rparam_len);
- SSVAL(*rparam,4,count); /* is this right?? */
- SSVAL(*rparam,6,count); /* is this right?? */
+ /* check it's a supported varient */
+ if (strcmp("B21",str2) != 0)
+ return False;
- DEBUG(3,("api_RNetUserEnum gave %d entries\n", count));
+ *rdata_len = cli_buf_size;
+ *rdata = REALLOC(*rdata,*rdata_len);
- return(True);
+ p = *rdata;
+
+ /* to get user list enumerations for NetUserEnum in B21 format */
+ pdb_init_sam(&pwd);
+
+ /* Open the passgrp file - not for update. */
+ become_root();
+ if(!pdb_setsampwent(False)) {
+ DEBUG(0, ("api_RNetUserEnum:unable to open sam database.\n"));
+ unbecome_root();
+ return False;
+ }
+ errflags=NERR_Success;
+
+ while ( pdb_getsampwent(pwd) ) {
+ const char *name=pdb_get_username(pwd);
+ if( *(name+strlen(name)-1)!='$' ) {
+ count_total++;
+ if(count_total>=resume_context) {
+ if( ((PTR_DIFF(p,*rdata)+21)<=*rdata_len)&&(strlen(name)<=21) ) {
+ pstrcpy(p,name);
+ DEBUG(10,("api_RNetUserEnum:adding entry %d username %s\n",count_sent,p));
+ p += 21;
+ count_sent++;
+ } else {
+ /* set overflow error */
+ DEBUG(10,("api_RNetUserEnum:overflow on entry %d username %s\n",count_sent,name));
+ errflags=234;
+ break;
+ }
+ }
+ }
+ } ;
+
+ pdb_endsampwent();
+ unbecome_root();
+
+ pdb_free_sam(&pwd);
+
+ *rdata_len = PTR_DIFF(p,*rdata);
+
+ SSVAL(*rparam,0,errflags);
+ SSVAL(*rparam,2,0); /* converter word */
+ SSVAL(*rparam,4,count_sent); /* is this right?? */
+ SSVAL(*rparam,6,count_total); /* is this right?? */
+
+ return True;
}
@@ -2769,56 +2877,6 @@ static BOOL api_RNetUserGetInfo(connection_struct *conn,uint16 vuid, char *param
return(True);
}
-/*******************************************************************
- get groups that a user is a member of
- ******************************************************************/
-static BOOL api_NetUserGetGroups(connection_struct *conn,uint16 vuid, char *param,char *data,
- int mdrcnt,int mprcnt,
- char **rdata,char **rparam,
- int *rdata_len,int *rparam_len)
-{
- char *str1 = param+2;
- char *str2 = skip_string(str1,1);
- char *UserName = skip_string(str2,1);
- char *p = skip_string(UserName,1);
- int uLevel = SVAL(p,0);
- char *p2;
- int count=0;
-
- *rparam_len = 8;
- *rparam = REALLOC(*rparam,*rparam_len);
-
- /* check it's a supported varient */
- if (strcmp(str1,"zWrLeh") != 0) return False;
- switch( uLevel ) {
- case 0: p2 = "B21"; break;
- default: return False;
- }
- if (strcmp(p2,str2) != 0) return False;
-
- *rdata_len = mdrcnt + 1024;
- *rdata = REALLOC(*rdata,*rdata_len);
-
- SSVAL(*rparam,0,NERR_Success);
- SSVAL(*rparam,2,0); /* converter word */
-
- p = *rdata;
-
- /* XXXX we need a real SAM database some day */
- pstrcpy(p,"Users"); p += 21; count++;
- pstrcpy(p,"Domain Users"); p += 21; count++;
- pstrcpy(p,"Guests"); p += 21; count++;
- pstrcpy(p,"Domain Guests"); p += 21; count++;
-
- *rdata_len = PTR_DIFF(p,*rdata);
-
- SSVAL(*rparam,4,count); /* is this right?? */
- SSVAL(*rparam,6,count); /* is this right?? */
-
- return(True);
-}
-
-
static BOOL api_WWkstaUserLogon(connection_struct *conn,uint16 vuid, char *param,char *data,
int mdrcnt,int mprcnt,
char **rdata,char **rparam,
--
cgit
From baf8e2e7127eb037264472ceb463cd61d1425a65 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 17:10:56 +0000
Subject: When opening a tdb fails - don't expect to be able to do tdb_errstr !
(Doh!). Jeremy. (This used to be commit
9209d8e718e860e6a58937376cbb437b6b7adbbb)
---
source3/printing/printing.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index a28d95fcc8..d7ac1f49c7 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -55,8 +55,8 @@ BOOL print_backend_init(void)
if (tdb && local_pid == sys_getpid()) return True;
tdb = tdb_open_log(lock_path("printing.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb) {
- DEBUG(0,("print_backend_init: Failed to open printing backend database. Error = [%s]\n",
- tdb_errorstr(tdb)));
+ DEBUG(0,("print_backend_init: Failed to open printing backend database %s\n",
+ lock_path("printing.tdb") ));
return False;
}
local_pid = sys_getpid();
--
cgit
From 8bc0e73a4366d79e292c21bebf671a2a2a6e5531 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 17:22:32 +0000
Subject: Fixed one more sendto. Jeremy. (This used to be commit
7adcc930ca56bf879b5e73b74bca19ac2353f1c0)
---
source3/lib/util_sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 27336cefa2..5bdfb24be4 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -789,7 +789,7 @@ BOOL send_one_packet(char *buf,int len,struct in_addr ip,int port,int type)
len,inet_ntoa(ip),port,type==SOCK_DGRAM?"DGRAM":"STREAM"));
/* send it */
- ret = (sendto(out_fd,buf,len,0,(struct sockaddr *)&sock_out,sizeof(sock_out)) >= 0);
+ ret = (sys_sendto(out_fd,buf,len,0,(struct sockaddr *)&sock_out,sizeof(sock_out)) >= 0);
if (!ret)
DEBUG(0,("Packet send to %s(%d) failed ERRNO=%s\n",
--
cgit
From 4f4d25d3e14a297f8ee31917f4307667f7b8a46b Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 17:30:27 +0000
Subject: Fix different args to sys_fcntl without going varargs.... Jeremy.
(This used to be commit 65742067e07195048edcee46dae95a58a4a50950)
---
source3/lib/system.c | 17 ++++++++++++++++-
source3/lib/util.c | 6 +++---
source3/smbd/notify_kernel.c | 6 +++---
source3/smbd/oplock_irix.c | 12 ++++++------
4 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index eaaa76743a..d9a4bbd83b 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -151,7 +151,22 @@ ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *f
A fcntl wrapper that will deal with EINTR.
********************************************************************/
-int sys_fcntl(int fd, int cmd, void *arg)
+int sys_fcntl_ptr(int fd, int cmd, void *arg)
+{
+ int ret;
+
+ do {
+ errno = 0;
+ ret = fcntl(fd, cmd, arg);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A fcntl wrapper that will deal with EINTR.
+********************************************************************/
+
+int sys_fcntl_long(int fd, int cmd, long arg)
{
int ret;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1ee1a9c06a..ea1670ea27 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -552,13 +552,13 @@ int set_blocking(int fd, BOOL set)
#endif
#endif
- if((val = sys_fcntl(fd, F_GETFL, 0)) == -1)
+ if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1)
return -1;
if(set) /* Turn blocking on - ie. clear nonblock flag */
val &= ~FLAG_TO_SET;
else
val |= FLAG_TO_SET;
- return sys_fcntl( fd, F_SETFL, val);
+ return sys_fcntl_long( fd, F_SETFL, val);
#undef FLAG_TO_SET
}
@@ -1353,7 +1353,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
lock.l_len = count;
lock.l_pid = 0;
- ret = sys_fcntl(fd,op,&lock);
+ ret = sys_fcntl_ptr(fd,op,&lock);
if (ret == -1 && errno != 0)
DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));
diff --git a/source3/smbd/notify_kernel.c b/source3/smbd/notify_kernel.c
index e40b91443e..f4eac38a1b 100644
--- a/source3/smbd/notify_kernel.c
+++ b/source3/smbd/notify_kernel.c
@@ -130,7 +130,7 @@ static void *kernel_register_notify(connection_struct *conn, char *path, uint32
return NULL;
}
- if (sys_fcntl(fd, F_SETSIG, RT_SIGNAL_NOTIFY) == -1) {
+ if (sys_fcntl_long(fd, F_SETSIG, RT_SIGNAL_NOTIFY) == -1) {
DEBUG(3,("Failed to set signal handler for change notify\n"));
return NULL;
}
@@ -147,7 +147,7 @@ static void *kernel_register_notify(connection_struct *conn, char *path, uint32
if (flags & FILE_NOTIFY_CHANGE_EA) kernel_flags |= DN_ATTRIB;
if (flags & FILE_NOTIFY_CHANGE_FILE_NAME) kernel_flags |= DN_RENAME|DN_DELETE;
- if (sys_fcntl(fd, F_NOTIFY, kernel_flags) == -1) {
+ if (sys_fcntl_long(fd, F_NOTIFY, kernel_flags) == -1) {
DEBUG(3,("Failed to set async flag for change notify\n"));
return NULL;
}
@@ -168,7 +168,7 @@ static BOOL kernel_notify_available(void)
int fd, ret;
fd = open("/tmp", O_RDONLY);
if (fd == -1) return False; /* uggh! */
- ret = sys_fcntl(fd, F_NOTIFY, 0);
+ ret = sys_fcntl_long(fd, F_NOTIFY, 0);
close(fd);
return ret == 0;
}
diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c
index 65ede6ef73..c712e7d3ec 100644
--- a/source3/smbd/oplock_irix.c
+++ b/source3/smbd/oplock_irix.c
@@ -56,7 +56,7 @@ static BOOL irix_oplocks_available(void)
unlink(tmpname);
- if(sys_fcntl(fd, F_OPLKREG, pfd[1]) == -1) {
+ if(sys_fcntl_long(fd, F_OPLKREG, pfd[1]) == -1) {
DEBUG(0,("check_kernel_oplocks: Kernel oplocks are not available on this machine. \
Disabling kernel oplock support.\n" ));
close(pfd[0]);
@@ -65,7 +65,7 @@ Disabling kernel oplock support.\n" ));
return False;
}
- if(sys_fcntl(fd, F_OPLKACK, OP_REVOKE) < 0 ) {
+ if(sys_fcntl_long(fd, F_OPLKACK, OP_REVOKE) < 0 ) {
DEBUG(0,("check_kernel_oplocks: Error when removing kernel oplock. Error was %s. \
Disabling kernel oplock support.\n", strerror(errno) ));
close(pfd[0]);
@@ -111,7 +111,7 @@ Error was %s.\n", strerror(errno) ));
* request outstanding.
*/
- if(sys_fcntl(oplock_pipe_read, F_OPLKSTAT, &os) < 0) {
+ if(sys_fcntl_ptr(oplock_pipe_read, F_OPLKSTAT, &os) < 0) {
DEBUG(0,("receive_local_message: fcntl of kernel notification failed. \
Error was %s.\n", strerror(errno) ));
if(errno == EAGAIN) {
@@ -164,7 +164,7 @@ dev = %x, inode = %.0f\n, file_id = %ul", (unsigned int)fsp->dev, (double)fsp->i
static BOOL irix_set_kernel_oplock(files_struct *fsp, int oplock_type)
{
- if (sys_fcntl(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) {
+ if (sys_fcntl_long(fsp->fd, F_OPLKREG, oplock_pipe_write) == -1) {
if(errno != EAGAIN) {
DEBUG(0,("set_file_oplock: Unable to get kernel oplock on file %s, dev = %x, \
inode = %.0f, file_id = %ul. Error was %s\n",
@@ -195,7 +195,7 @@ static void irix_release_kernel_oplock(files_struct *fsp)
* Check and print out the current kernel
* oplock state of this file.
*/
- int state = sys_fcntl(fsp->fd, F_OPLKACK, -1);
+ int state = sys_fcntl_long(fsp->fd, F_OPLKACK, -1);
dbgtext("release_kernel_oplock: file %s, dev = %x, inode = %.0f file_id = %ul, has kernel \
oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
(double)fsp->inode, fsp->file_id, state );
@@ -204,7 +204,7 @@ oplock state of %x.\n", fsp->fsp_name, (unsigned int)fsp->dev,
/*
* Remove the kernel oplock on this file.
*/
- if(sys_fcntl(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) {
+ if(sys_fcntl_long(fsp->fd, F_OPLKACK, OP_REVOKE) < 0) {
if( DEBUGLVL( 0 )) {
dbgtext("release_kernel_oplock: Error when removing kernel oplock on file " );
dbgtext("%s, dev = %x, inode = %.0f, file_id = %ul. Error was %s\n",
--
cgit
From 16e1ff4f3a09a1207e5c7b1d26c0fbe961de76d1 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 17:59:13 +0000
Subject: Added Martin's lpq parse fixes from 2.2. Jeremy. (This used to be
commit 3853234c2649c501e9876f940f802be86cb6383d)
---
source3/include/safe_string.h | 3 +++
source3/printing/lpq_parse.c | 32 ++++++++++++--------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h
index 1ee97833c5..118c2302bd 100644
--- a/source3/include/safe_string.h
+++ b/source3/include/safe_string.h
@@ -53,6 +53,9 @@
#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
+#define fstrterminate(d) (((d)[sizeof(fstring)-1]) = '\0')
+#define pstrterminate(d) (((d)[sizeof(pstring)-1]) = '\0')
+
#define wpstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wpstring))
#define wpstrcat(d,s) safe_strcat_w((d),(s),sizeof(wpstring))
#define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring))
diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c
index 13b87045cd..9d8b1cc2aa 100644
--- a/source3/printing/lpq_parse.c
+++ b/source3/printing/lpq_parse.c
@@ -149,21 +149,17 @@ static BOOL parse_lpq_bsd(char *line,print_queue_struct *buf,BOOL first)
StrnCpy(buf->fs_file,tok[FILETOK],sizeof(buf->fs_file)-1);
if ((FILETOK + 1) != TOTALTOK) {
- int bufsize;
int i;
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
-
for (i = (FILETOK + 1); i < TOTALTOK; i++) {
- safe_strcat(buf->fs_file," ",bufsize);
- safe_strcat(buf->fs_file,tok[i],bufsize - 1);
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
- if (bufsize <= 0) {
- break;
- }
+ /* FIXME: Using fstrcat rather than other means is a bit
+ * inefficient; this might be a problem for enormous queues with
+ * many fields. */
+ fstrcat(buf->fs_file, " ");
+ fstrcat(buf->fs_file, tok[i]);
}
/* Ensure null termination. */
- buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
+ fstrterminate(buf->fs_file);
}
#ifdef PRIOTOK
@@ -282,21 +278,17 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first)
StrnCpy(buf->fs_file,tokarr[LPRNG_FILETOK],sizeof(buf->fs_file)-1);
if ((LPRNG_FILETOK + 1) != LPRNG_TOTALTOK) {
- int bufsize;
int i;
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
-
for (i = (LPRNG_FILETOK + 1); i < LPRNG_TOTALTOK; i++) {
- safe_strcat(buf->fs_file," ",bufsize);
- safe_strcat(buf->fs_file,tokarr[i],bufsize - 1);
- bufsize = sizeof(buf->fs_file) - strlen(buf->fs_file) - 1;
- if (bufsize <= 0) {
- break;
- }
+ /* FIXME: Using fstrcat rather than other means is a bit
+ * inefficient; this might be a problem for enormous queues with
+ * many fields. */
+ fstrcat(buf->fs_file, " ");
+ fstrcat(buf->fs_file, tokarr[i]);
}
/* Ensure null termination. */
- buf->fs_file[sizeof(buf->fs_file)-1] = '\0';
+ fstrterminate(buf->fs_file);
}
return(True);
--
cgit
From ca2e14ddc3d753f79319060f3024a0c9b3a57b98 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Fri, 19 Apr 2002 21:45:02 +0000
Subject: We cannot set errno=0 in any of the wrapper calls as this breaks UNIX
error returns to the client. Jeremy. (This used to be commit
1d66e53a64ec2878293e6d74a852b736ddab8f21)
---
source3/lib/system.c | 7 -------
source3/tdb/tdb.c | 1 -
2 files changed, 8 deletions(-)
diff --git a/source3/lib/system.c b/source3/lib/system.c
index d9a4bbd83b..dfd206027e 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -81,7 +81,6 @@ ssize_t sys_read(int fd, void *buf, size_t count)
ssize_t ret;
do {
- errno = 0;
ret = read(fd, buf, count);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -96,7 +95,6 @@ ssize_t sys_write(int fd, const void *buf, size_t count)
ssize_t ret;
do {
- errno = 0;
ret = write(fd, buf, count);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -111,7 +109,6 @@ ssize_t sys_send(int s, const void *msg, size_t len, int flags)
ssize_t ret;
do {
- errno = 0;
ret = send(s, msg, len, flags);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -126,7 +123,6 @@ ssize_t sys_sendto(int s, const void *msg, size_t len, int flags, const struct
ssize_t ret;
do {
- errno = 0;
ret = sendto(s, msg, len, flags, to, tolen);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -141,7 +137,6 @@ ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *f
ssize_t ret;
do {
- errno = 0;
ret = recvfrom(s, buf, len, flags, from, fromlen);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -156,7 +151,6 @@ int sys_fcntl_ptr(int fd, int cmd, void *arg)
int ret;
do {
- errno = 0;
ret = fcntl(fd, cmd, arg);
} while (ret == -1 && errno == EINTR);
return ret;
@@ -171,7 +165,6 @@ int sys_fcntl_long(int fd, int cmd, long arg)
int ret;
do {
- errno = 0;
ret = fcntl(fd, cmd, arg);
} while (ret == -1 && errno == EINTR);
return ret;
diff --git a/source3/tdb/tdb.c b/source3/tdb/tdb.c
index e3ba1db0d2..5c0fd436e3 100644
--- a/source3/tdb/tdb.c
+++ b/source3/tdb/tdb.c
@@ -185,7 +185,6 @@ static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
fl.l_pid = 0;
do {
- errno = 0;
ret = fcntl(tdb->fd,lck_type,&fl);
} while (ret == -1 && errno == EINTR);
--
cgit
From 5c261ce93d369d8c3901117777c3bb421178a186 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Sat, 20 Apr 2002 07:17:36 +0000
Subject: Return exception text if getprinter level not [0..3] (This used to be
commit c02a7a71d6ddae711c84094e410d1117efc031f0)
---
source3/python/py_spoolss_printers.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/source3/python/py_spoolss_printers.c b/source3/python/py_spoolss_printers.c
index 48321500e7..623e693124 100644
--- a/source3/python/py_spoolss_printers.c
+++ b/source3/python/py_spoolss_printers.c
@@ -119,12 +119,19 @@ PyObject *spoolss_getprinter(PyObject *self, PyObject *args, PyObject *kw)
int level = 1;
uint32 needed;
static char *kwlist[] = {"level", NULL};
-
+
/* Parse parameters */
if (!PyArg_ParseTupleAndKeywords(args, kw, "|i", kwlist, &level))
return NULL;
+ if (level < 0 || level > 3) {
+ PyErr_SetString(spoolss_error, "Invalid info level");
+ return NULL;
+ }
+
+ ZERO_STRUCT(ctr);
+
/* Call rpc function */
werror = cli_spoolss_getprinter(
--
cgit
From 86cf3b9f11a7ca756079ed2f9248415e13adb7f7 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Sat, 20 Apr 2002 07:28:46 +0000
Subject: try to cope better with the take ownership operation for foreign SIDs
what we do is map to the authenticated user when the sid is unmappable and
dos filemodes are enabled (This used to be commit
b6c2ef4f54e7b42125f8c89ee5a62b0ba6b52f59)
---
source3/smbd/open.c | 6 +++--
source3/smbd/posix_acls.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 29a854a397..f8ba1ca8d8 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1046,7 +1046,7 @@ flags=0x%X flags2=0x%X mode=0%o returned %d\n",
Open a file for for write to ensure that we can fchmod it.
****************************************************************************/
-files_struct *open_file_fchmod(connection_struct *conn, char *fname, SMB_STRUCT_STAT *psbuf)
+files_struct *open_file_fchmod(connection_struct *conn, const char *fname, SMB_STRUCT_STAT *psbuf)
{
files_struct *fsp = NULL;
BOOL fsp_open;
@@ -1058,7 +1058,9 @@ files_struct *open_file_fchmod(connection_struct *conn, char *fname, SMB_STRUCT_
if(!fsp)
return NULL;
- fsp_open = open_file(fsp,conn,fname,psbuf,O_WRONLY,0,0);
+ /* note! we must use a non-zero desired access or we don't get
+ a real file descriptor. Oh what a twisted web we weave. */
+ fsp_open = open_file(fsp,conn,fname,psbuf,O_WRONLY,0,FILE_WRITE_DATA);
/*
* This is not a user visible file open.
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 9c8835214f..713210f693 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -439,9 +439,15 @@ static BOOL unpack_nt_owners(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *pgrp,
if (security_info_sent & OWNER_SECURITY_INFORMATION) {
sid_copy(&owner_sid, psd->owner_sid);
if (!sid_to_uid( &owner_sid, puser, &sid_type)) {
+#if ACL_FORCE_UNMAPPABLE
+ /* this allows take ownership to work reasonably */
+ extern struct current_user current_user;
+ *puser = current_user.uid;
+#else
DEBUG(3,("unpack_nt_owners: unable to validate owner sid for %s\n",
sid_string_static(&owner_sid)));
return False;
+#endif
}
}
@@ -453,8 +459,14 @@ static BOOL unpack_nt_owners(SMB_STRUCT_STAT *psbuf, uid_t *puser, gid_t *pgrp,
if (security_info_sent & GROUP_SECURITY_INFORMATION) {
sid_copy(&grp_sid, psd->grp_sid);
if (!sid_to_gid( &grp_sid, pgrp, &sid_type)) {
+#if ACL_FORCE_UNMAPPABLE
+ /* this allows take group ownership to work reasonably */
+ extern struct current_user current_user;
+ *pgrp = current_user.gid;
+#else
DEBUG(3,("unpack_nt_owners: unable to validate group sid.\n"));
return False;
+#endif
}
}
@@ -1996,6 +2008,52 @@ size_t get_nt_acl(files_struct *fsp, SEC_DESC **ppdesc)
return sd_size;
}
+/*
+ try to chown a file. We will be able to chown it under the following conditions
+
+ 1) if we have root privileges, then it will just work
+ 2) if we have write permission to the file and dos_filemodes is set
+ then allow chown to the currently authenticated user.
+
+ */
+static int try_chown(connection_struct *conn, const char *fname, uid_t uid, gid_t gid)
+{
+ int ret;
+ extern struct current_user current_user;
+ files_struct *fsp;
+ SMB_STRUCT_STAT st;
+
+ /* try the direct way first */
+ ret = vfs_chown(conn, fname, uid, gid);
+ if (ret == 0) return 0;
+
+ if(!CAN_WRITE(conn) || !lp_dos_filemode(SNUM(conn)))
+ return -1;
+
+ if (vfs_stat(conn,fname,&st)) {
+ return -1;
+ }
+
+ fsp = open_file_fchmod(conn,fname,&st);
+ if (!fsp) {
+ return -1;
+ }
+
+ /* only allow chown to the current user. This is more secure,
+ and also copes with the case where the SID in a take ownership ACL is
+ a local SID on the users workstation
+ */
+ uid = current_user.uid;
+
+ become_root();
+ ret = vfswrap_fchown(fsp, fsp->fd, uid, gid);
+ unbecome_root();
+
+ close_file_fchmod(fsp);
+
+ return ret;
+}
+
/****************************************************************************
Reply to set a security descriptor on an fsp. security_info_sent is the
description of the following NT ACL.
@@ -2052,7 +2110,7 @@ BOOL set_nt_acl(files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd)
DEBUG(3,("set_nt_acl: chown %s. uid = %u, gid = %u.\n",
fsp->fsp_name, (unsigned int)user, (unsigned int)grp ));
- if(vfs_chown( fsp->conn, fsp->fsp_name, user, grp) == -1) {
+ if(try_chown( fsp->conn, fsp->fsp_name, user, grp) == -1) {
DEBUG(3,("set_nt_acl: chown %s, %u, %u failed. Error = %s.\n",
fsp->fsp_name, (unsigned int)user, (unsigned int)grp, strerror(errno) ));
return False;
--
cgit
From 0fb9ea9fa45d28ea6660bab09998e704fd6502f8 Mon Sep 17 00:00:00 2001
From: "Christopher R. Hertel"
Date: Mon, 22 Apr 2002 03:08:33 +0000
Subject: My seven-year-old daughter calls me 'Captain Pedantic'. I don't know
which is freakier... the name or the fact that a seven-year-old knows what it
means.
Small change to correct the value we place in the DGM_LENGTH field of
NBT Datagram messages. We have been counting the full datagram, but it's
fairly clear in the RFCs that we should only count the source name,
destination name, and payload. We've been overcharging by 14 bytes
(the size of the NBT DGM header).
This fix brings us in line with what Windows does, and what the RFCs
say should be done. I'm a little surprised that this didn't cause any
bugs or error messages. I guess no one actually checks this field.
(This used to be commit 3156c020e5b6f12a448d58669977ad4449789460)
---
source3/libsmb/nmblib.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index c78946fa09..9a37b4252a 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -766,6 +766,14 @@ static BOOL send_udp(int fd,char *buf,int len,struct in_addr ip,int port)
XXXX This currently doesn't handle packets too big for one
datagram. It should split them and use the packet_offset, more and
first flags to handle the fragmentation. Yuck.
+
+ [...but it isn't clear that we would ever need to send a
+ a fragmented NBT Datagram. The IP layer does its own
+ fragmentation to ensure that messages can fit into the path
+ MTU. It *is* important to be able to receive and rebuild
+ fragmented NBT datagrams, just in case someone out there
+ really has implemented this 'feature'. crh -)------ ]
+
******************************************************************/
static int build_dgram(char *buf,struct packet_struct *p)
{
@@ -795,8 +803,11 @@ static int build_dgram(char *buf,struct packet_struct *p)
memcpy(ubuf+offset,dgram->data,dgram->datasize);
offset += dgram->datasize;
- /* automatically set the dgm_length */
- dgram->header.dgm_length = offset;
+ /* automatically set the dgm_length
+ * NOTE: RFC1002 says the dgm_length does *not*
+ * include the fourteen-byte header. crh
+ */
+ dgram->header.dgm_length = (offset - 14);
RSSVAL(ubuf,10,dgram->header.dgm_length);
return(offset);
--
cgit
From dde9187728936df5825cf19bda74fce1185ffb21 Mon Sep 17 00:00:00 2001
From: Gerald Carter
Date: Mon, 22 Apr 2002 18:47:36 +0000
Subject: merge from SAMBA_2_2 (This used to be commit
5e381abbbfaa15f3ebd89cba3cd9bb6de8e4ff4e)
---
source3/rpc_parse/parse_spoolss.c | 61 ++++++++++++-------------------------
source3/rpc_server/srv_spoolss.c | 4 ---
source3/rpc_server/srv_spoolss_nt.c | 8 +----
3 files changed, 20 insertions(+), 53 deletions(-)
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index b74ee3c5c5..e9f0ca858a 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -628,7 +628,6 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
break;
/* See the comments on the DEVMODE in the msdn GDI documentation */
- /* (WINVER >= 0x0400) */
case 0x0400:
case 0x0401:
if (!prs_uint32("icmmethod", ps, depth, &devmode->icmmethod))
@@ -643,14 +642,10 @@ BOOL spoolss_io_devmode(char *desc, prs_struct *ps, int depth, DEVICEMODE *devmo
return False;
if (!prs_uint32("reserved2", ps, depth, &devmode->reserved2))
return False;
-
- /* (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400) */
- if (devmode->specversion == 0x401) {
if (!prs_uint32("panningwidth", ps, depth, &devmode->panningwidth))
return False;
if (!prs_uint32("panningheight", ps, depth, &devmode->panningheight))
return False;
- }
break;
/* log an error if we see something else */
@@ -1726,12 +1721,19 @@ static uint32 size_of_relative_string(UNISTR *string)
uint32 size=0;
size=str_len_uni(string); /* the string length */
- size=size+1; /* add the leading zero */
+ size=size+1; /* add the trailing zero */
size=size*2; /* convert in char */
- /* Ensure size is 4 byte multiple (prs_align is being called...). */
- size += ((4 - (size & 3)) & 3);
size=size+4; /* add the size of the ptr */
+#if 0 /* JERRY */
+ /*
+ * Do not include alignment as Win2k does not align relative
+ * strings within a buffer --jerry
+ */
+ /* Ensure size is 4 byte multiple (prs_align is being called...). */
+ /* size += ((4 - (size & 3)) & 3); */
+#endif
+
return size;
}
@@ -1759,32 +1761,6 @@ static uint32 size_of_systemtime(SYSTEMTIME *systime)
return (sizeof(SYSTEMTIME) +4);
}
-/*******************************************************************
- * write a UNICODE string.
- * used by all the RPC structs passing a buffer
- ********************************************************************/
-
-static BOOL spoolss_smb_io_unistr(char *desc, UNISTR *uni, prs_struct *ps, int depth)
-{
- if (uni == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "spoolss_smb_io_unistr");
- depth++;
-
- /* there should be no align here as it can mess up
- parsing a NEW_BUFFER->prs */
-#if 0 /* JERRY */
- if (!prs_align(ps))
- return False;
-#endif
-
- if (!prs_unistr("unistr", ps, depth, uni))
- return False;
-
- return True;
-}
-
/*******************************************************************
* write a UNICODE string and its relative pointer.
* used by all the RPC structs passing a buffer
@@ -1816,8 +1792,14 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str
buffer->string_at_end -= (size_of_relative_string(string) - 4);
if(!prs_set_offset(ps, buffer->string_at_end))
return False;
+#if 0 /* JERRY */
+ /*
+ * Win2k does not align strings in a buffer
+ * Tested against WinNT 4.0 SP 6a & 2k SP2 --jerry
+ */
if (!prs_align(ps))
return False;
+#endif
buffer->string_at_end = prs_offset(ps);
/* write the string */
@@ -1844,7 +1826,7 @@ static BOOL smb_io_relstr(char *desc, NEW_BUFFER *buffer, int depth, UNISTR *str
return False;
/* read the string */
- if (!spoolss_smb_io_unistr(desc, string, ps, depth))
+ if (!smb_io_unistr(desc, string, ps, depth))
return False;
if(!prs_set_offset(ps, old_offset))
@@ -1901,7 +1883,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
}
/* write the string */
- if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth)) {
+ if (!smb_io_unistr(desc, &chaine, ps, depth)) {
SAFE_FREE(chaine.buffer);
return False;
}
@@ -1940,7 +1922,7 @@ static BOOL smb_io_relarraystr(char *desc, NEW_BUFFER *buffer, int depth, uint16
return False;
do {
- if (!spoolss_smb_io_unistr(desc, &chaine, ps, depth))
+ if (!smb_io_unistr(desc, &chaine, ps, depth))
return False;
l_chaine=str_len_uni(&chaine);
@@ -5032,11 +5014,6 @@ BOOL make_spoolss_q_addprinterdriver(TALLOC_CTX *mem_ctx,
make_spoolss_driver_info_3(mem_ctx, &q_u->info.info_3, info->info3);
break;
- /* info level 6 is supported by WinME and Win2k */
- case 6:
- /* WRITEME!! will add later --jerry */
- break;
-
default:
DEBUG(0,("make_spoolss_q_addprinterdriver: Unknown info level [%d]\n", level));
break;
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index e6c152c668..c7dc5d27ff 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -1451,11 +1451,7 @@ struct api_struct api_spoolss_cmds[] =
{"SPOOLSS_SETPRINTERDATAEX", SPOOLSS_SETPRINTERDATAEX, api_spoolss_setprinterdataex },
{"SPOOLSS_ENUMPRINTERKEY", SPOOLSS_ENUMPRINTERKEY, api_spoolss_enumprinterkey },
{"SPOOLSS_ENUMPRINTERDATAEX", SPOOLSS_ENUMPRINTERDATAEX, api_spoolss_enumprinterdataex },
-#if 0
- /* Disabled because it doesn't fix the bug I am looking at but it would be
- a shame to throw away the code. -tpot */
{"SPOOLSS_GETPRINTPROCESSORDIRECTORY",SPOOLSS_GETPRINTPROCESSORDIRECTORY,api_spoolss_getprintprocessordirectory},
-#endif
{ NULL, 0, NULL }
};
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 5fa45b0b44..d6ce065548 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7807,13 +7807,7 @@ static WERROR getprintprocessordirectory_level_1(UNISTR2 *name,
if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL)
return WERR_NOMEM;
- /* Not sure what to return here - are UNC names valid here?.
- Windows returns the string: C:\WINNT\System32\spool\PRTPROCS\W32X86
- which is pretty bogus for a RPC. */
-
- slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", get_called_name(), short_archi);
-
- DEBUG(4,("print processor directory: [%s]\n", path));
+ pstrcpy(path, "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86");
fill_printprocessordirectory_1(info, path);
--
cgit
From 4df4aca784db3aef5395a2aed311823ba5ffe97b Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Mon, 22 Apr 2002 22:44:44 +0000
Subject: Ensure auth requests from the same machine are completely serialized.
NT4.x DC's require this. Jeremy. (This used to be commit
d162b6285d549370a24a926ab1c46cef7e7f630a)
---
source3/auth/auth_domain.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 5 deletions(-)
diff --git a/source3/auth/auth_domain.c b/source3/auth/auth_domain.c
index a77bbeade3..32949a575e 100644
--- a/source3/auth/auth_domain.c
+++ b/source3/auth/auth_domain.c
@@ -26,6 +26,32 @@ BOOL global_machine_password_needs_changing = False;
extern pstring global_myname;
extern userdom_struct current_user_info;
+static char *mutex_server_name;
+
+static BOOL grab_server_mutex(const char *name)
+{
+ mutex_server_name = strdup(name);
+ if (!mutex_server_name) {
+ DEBUG(0,("grab_server_mutex: malloc failed for %s\n", name));
+ return False;
+ }
+ if (!message_named_mutex(name, 20)) {
+ DEBUG(10,("grab_server_mutex: failed for %s\n", name));
+ SAFE_FREE(mutex_server_name);
+ return False;
+ }
+
+ return True;
+}
+
+static void release_server_mutex(void)
+{
+ if (mutex_server_name) {
+ message_named_mutex_release(mutex_server_name);
+ SAFE_FREE(mutex_server_name);
+ }
+}
+
/**
* Connect to a remote server for domain security authenticaion.
*
@@ -87,18 +113,21 @@ static NTSTATUS connect_to_domain_password_server(struct cli_state **cli,
/* we use a mutex to prevent two connections at once - when a NT PDC gets
two connections where one hasn't completed a negprot yet it will send a
TCP reset to the first connection (tridge) */
- if (!message_named_mutex(server, 20)) {
- DEBUG(1,("connect_to_domain_password_server: domain mutex failed for %s\n", server));
+
+ /*
+ * With NT4.x DC's *all* authentication must be serialized to avoid
+ * ACCESS_DENIED errors if 2 auths are done from the same machine. JRA.
+ */
+
+ if (!grab_server_mutex(server))
return NT_STATUS_UNSUCCESSFUL;
- }
/* Attempt connection */
result = cli_full_connection(cli, global_myname, server,
&dest_ip, 0, "IPC$", "IPC", "", "", "", 0);
- message_named_mutex_release(server);
-
if (!NT_STATUS_IS_OK(result)) {
+ release_server_mutex();
return result;
}
@@ -121,12 +150,14 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
cli_nt_session_close(*cli);
cli_ulogoff(*cli);
cli_shutdown(*cli);
+ release_server_mutex();
return NT_STATUS_UNSUCCESSFUL;
}
snprintf((*cli)->mach_acct, sizeof((*cli)->mach_acct) - 1, "%s$", setup_creds_as);
if (!(*cli)->mach_acct) {
+ release_server_mutex();
return NT_STATUS_NO_MEMORY;
}
@@ -138,9 +169,12 @@ machine %s. Error was : %s.\n", remote_machine, cli_errstr(*cli)));
cli_nt_session_close(*cli);
cli_ulogoff(*cli);
cli_shutdown(*cli);
+ release_server_mutex();
return result;
}
+ /* We exit here with the mutex *locked*. JRA */
+
return NT_STATUS_OK;
}
@@ -406,6 +440,7 @@ static NTSTATUS domain_client_validate(TALLOC_CTX *mem_ctx,
cli_nt_session_close(cli);
cli_ulogoff(cli);
cli_shutdown(cli);
+ release_server_mutex();
return nt_status;
}
--
cgit
From 569fa9b3dd31b72b35e224ffffe65715a858b7c3 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Tue, 23 Apr 2002 02:16:48 +0000
Subject: Fix for a bug Jerry found with printing where a smbd connection may
be idled even with an open pipe. Jeremy. (This used to be commit
3a93c5daeca3edd4f319199c8a6068d25cb6750e)
---
source3/rpc_server/srv_pipe_hnd.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 44dd5fac65..4b20ee5558 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -240,6 +240,9 @@ smb_np_struct *open_rpc_pipe_p(char *pipe_name,
for (p_it = Pipes; p_it; p_it = p_it->next)
DEBUG(5,("open pipes: name %s pnum=%x\n", p_it->name, p_it->pnum));
+ /* Ensure the connection isn't idled whilst this pipe is open. */
+ conn->num_files_open++;
+
return chain_p;
}
@@ -1055,7 +1058,9 @@ BOOL close_rpc_pipe_hnd(smb_np_struct *p)
ZERO_STRUCTP(p);
SAFE_FREE(p);
-
+
+ conn->num_files_open--;
+
return True;
}
--
cgit
From bfa6281944be923816572ce8b0d0f26045c60c3d Mon Sep 17 00:00:00 2001
From: Andrew Bartlett
Date: Tue, 23 Apr 2002 04:43:44 +0000
Subject: Spelling fixes from vance (This used to be commit
70c6f5fc6d3ec3121b29d1e46e7fd3933fbcce6b)
---
source3/passdb/pdb_ldap.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index c4f95dcdee..797cc28ee6 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -237,7 +237,7 @@ static BOOL ldapsam_connect_system(struct ldapsam_privates *ldap_state, LDAP * l
return False;
}
- DEBUG(2, ("ldap_connect_system: succesful connection to the LDAP server\n"));
+ DEBUG(2, ("ldap_connect_system: successful connection to the LDAP server\n"));
return True;
}
@@ -521,7 +521,7 @@ static BOOL init_sam_from_ldap (struct ldapsam_privates *ldap_state,
pw = getpwnam_alloc(username);
if (pw == NULL) {
- DEBUG (2,("init_sam_from_ldap: User [%s] does not ave a uid!\n", username));
+ DEBUG (2,("init_sam_from_ldap: User [%s] does not have a uid!\n", username));
return False;
}
uid = pw->pw_uid;
@@ -740,7 +740,7 @@ static BOOL init_ldap_from_sam (struct ldapsam_privates *ldap_state,
} else if (ldap_state->permit_non_unix_accounts) {
rid = ldapsam_get_next_available_nua_rid(ldap_state);
if (rid == 0) {
- DEBUG(0, ("NO user RID specified on account %s, and findining next available NUA RID failed, cannot store!\n", pdb_get_username(sampass)));
+ DEBUG(0, ("NO user RID specified on account %s, and finding next available NUA RID failed, cannot store!\n", pdb_get_username(sampass)));
return False;
}
} else {
@@ -1097,7 +1097,7 @@ static BOOL ldapsam_getsampwnam(struct pdb_methods *my_methods, SAM_ACCOUNT * us
if (ldap_count_entries(ldap_struct, result) < 1)
{
DEBUG(4,
- ("We don't find this user [%s] count=%d\n", sname,
+ ("We didn't find the user [%s] count=%d\n", sname,
ldap_count_entries(ldap_struct, result)));
ldap_unbind(ldap_struct);
return False;
@@ -1151,7 +1151,7 @@ static BOOL ldapsam_getsampwrid(struct pdb_methods *my_methods, SAM_ACCOUNT * us
if (ldap_count_entries(ldap_struct, result) < 1)
{
DEBUG(0,
- ("We don't find this rid [%i] count=%d\n", rid,
+ ("We didn't find the rid [%i] count=%d\n", rid,
ldap_count_entries(ldap_struct, result)));
ldap_unbind(ldap_struct);
return False;
@@ -1205,7 +1205,7 @@ static BOOL ldapsam_delete_sam_account(struct pdb_methods *my_methods, const SAM
if (!ldapsam_connect_system(ldap_state, ldap_struct)) {
ldap_unbind (ldap_struct);
- DEBUG(0, ("Failed to delete user %s from LDAP.\n", sname));
+ DEBUG(0, ("failed to delete user %s from the LDAP database.\n", sname));
return False;
}
--
cgit
From fd99accdb55ea7e6be8f61155efad88c9d5edaf6 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Tue, 23 Apr 2002 18:34:52 +0000
Subject: Fix my stupid compile bug in num_files_open. Jeremy. (This used to be
commit 7c02db7c4f0d04b7c45a9c580f3e85f52fa505d5)
---
source3/rpc_server/srv_pipe_hnd.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index 4b20ee5558..a4a9e85ae4 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -240,9 +240,6 @@ smb_np_struct *open_rpc_pipe_p(char *pipe_name,
for (p_it = Pipes; p_it; p_it = p_it->next)
DEBUG(5,("open pipes: name %s pnum=%x\n", p_it->name, p_it->pnum));
- /* Ensure the connection isn't idled whilst this pipe is open. */
- conn->num_files_open++;
-
return chain_p;
}
@@ -301,6 +298,10 @@ static void *make_internal_rpc_pipe_p(char *pipe_name,
DLIST_ADD(InternalPipes, p);
p->conn = conn;
+
+ /* Ensure the connection isn't idled whilst this pipe is open. */
+ p->conn->num_files_open++;
+
p->vuid = vuid;
p->ntlmssp_chal_flags = 0;
@@ -1059,8 +1060,6 @@ BOOL close_rpc_pipe_hnd(smb_np_struct *p)
SAFE_FREE(p);
- conn->num_files_open--;
-
return True;
}
@@ -1090,6 +1089,8 @@ static BOOL close_internal_rpc_pipe_hnd(void *np_conn)
DLIST_REMOVE(InternalPipes, p);
+ p->conn->num_files_open--;
+
ZERO_STRUCTP(p);
SAFE_FREE(p);
--
cgit
From 4547fde9f5a2ab1445ad273b53a83cdaccb23be4 Mon Sep 17 00:00:00 2001
From: Jeremy Allison
Date: Tue, 23 Apr 2002 18:50:10 +0000
Subject: When doing a non-io open the stat failing is no cause for a debug
zero to be printed, it just means file not found. Jeremy. (This used to be
commit 25dea499b82da5e84412bf10781adbd240aa46f0)
---
source3/smbd/open.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index f8ba1ca8d8..4d49b2cb59 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -169,11 +169,15 @@ static BOOL open_file(files_struct *fsp,connection_struct *conn,
if (fsp->fd == -1)
ret = vfs_stat(conn, fname, psbuf);
- else
+ else {
ret = vfs_fstat(fsp,fsp->fd,psbuf);
+ /* If we have an fd, this stat should succeed. */
+ if (ret == -1)
+ DEBUG(0,("Error doing fstat on open file %s (%s)\n", fname,strerror(errno) ));
+ }
+ /* For a non-io open, this stat failing means file not found. JRA */
if (ret == -1) {
- DEBUG(0,("Error doing fstat on open file %s (%s)\n", fname,strerror(errno) ));
fd_close(conn, fsp);
return False;
}
--
cgit
From 27173b205f05aebd9226fa43fc40424bf8e79a72 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 04:09:37 +0000
Subject: prototypes for some systems that don't have them (This used to be
commit 2dde9f711979c04cd02107447395a55307f7a30a)
---
source3/include/includes.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 1dfebcea78..becf7e5e39 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -943,6 +943,14 @@ size_t strlcat(char *d, const char *s, size_t bufsize);
int ftruncate(int f,long l);
#endif
+#ifndef HAVE_STRNDUP
+char *strndup(const char *s, size_t n);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *s, size_t n);
+#endif
+
#ifndef HAVE_STRTOUL
unsigned long strtoul(const char *nptr, char **endptr, int base);
#endif
--
cgit
From a67b5ac62fcd3e8bcef668a29094635a548e5744 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 04:11:27 +0000
Subject: a new "dual daemon" operating mode for winbindd
this mode improves the response time of winbindd by having a
background process update the cache while the forground process
responds to queries from cache.
You can enable this mode using the -B command line option. It is quite
experimental, which is why it is not the default.
(This used to be commit c0feff97eefdf5a70e5973e247b395dbdf5d2ef2)
---
source3/Makefile.in | 3 +-
source3/nsswitch/winbindd.c | 135 +++++++++++++++++++++++++-------------
source3/nsswitch/winbindd_cache.c | 16 ++++-
source3/nsswitch/winbindd_proto.h | 10 +++
4 files changed, 114 insertions(+), 50 deletions(-)
diff --git a/source3/Makefile.in b/source3/Makefile.in
index ae89778288..dee2daa6b9 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -442,7 +442,8 @@ WINBINDD_OBJ1 = \
nsswitch/winbindd_cm.o \
nsswitch/winbindd_wins.o \
nsswitch/winbindd_rpc.o \
- nsswitch/winbindd_ads.o
+ nsswitch/winbindd_ads.o \
+ nsswitch/winbindd_dual.o
WINBINDD_OBJ = \
$(WINBINDD_OBJ1) $(NOPROTO_OBJ) $(PASSDB_OBJ) \
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index 479be79574..b198b4a163 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -4,6 +4,7 @@
Winbind daemon for ntdom nss module
Copyright (C) by Tim Potter 2000, 2001
+ Copyright (C) Andrew Tridgell 2002
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
@@ -26,7 +27,8 @@
struct winbindd_cli_state *client_list;
static int num_clients;
-BOOL opt_nocache;
+BOOL opt_nocache = False;
+BOOL opt_dual_daemon = False;
/* Reload configuration */
@@ -365,9 +367,10 @@ static void remove_client(struct winbindd_cli_state *state)
}
}
+
/* Process a complete received packet from a client */
-static void process_packet(struct winbindd_cli_state *state)
+void winbind_process_packet(struct winbindd_cli_state *state)
{
/* Process request */
@@ -379,11 +382,16 @@ static void process_packet(struct winbindd_cli_state *state)
state->read_buf_len = 0;
state->write_buf_len = sizeof(struct winbindd_response);
+
+ /* we might need to send it to the dual daemon */
+ if (opt_dual_daemon) {
+ dual_send_request(state);
+ }
}
/* Read some data from a client connection */
-static void client_read(struct winbindd_cli_state *state)
+void winbind_client_read(struct winbindd_cli_state *state)
{
int n;
@@ -397,8 +405,11 @@ static void client_read(struct winbindd_cli_state *state)
} while (n == -1 && errno == EINTR);
+ DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n, sizeof(state->request) - n - state->read_buf_len ));
+
+ /* Read failed, kill client */
+
if (n == -1 || n == 0) {
- /* Read failed, kill client */
DEBUG(5,("read failed on sock %d, pid %d: %s\n",
state->sock, state->pid,
(n == -1) ? strerror(errno) : "EOF"));
@@ -407,8 +418,6 @@ static void client_read(struct winbindd_cli_state *state)
return;
}
- DEBUG(10,("client_read: read %d bytes. Need %d more for a full request.\n", n, sizeof(state->request) - n - state->read_buf_len ));
-
/* Update client state */
state->read_buf_len += n;
@@ -528,6 +537,10 @@ static void process_loop(int accept_sock)
timeout.tv_sec = WINBINDD_ESTABLISH_LOOP;
timeout.tv_usec = 0;
+ if (opt_dual_daemon) {
+ maxfd = dual_select_setup(&w_fds, maxfd);
+ }
+
/* Set up client readers and writers */
state = client_list;
@@ -582,6 +595,10 @@ static void process_loop(int accept_sock)
if (selret > 0) {
+ if (opt_dual_daemon) {
+ dual_select(&w_fds);
+ }
+
if (FD_ISSET(accept_sock, &r_fds))
new_connection(accept_sock);
@@ -595,7 +612,7 @@ static void process_loop(int accept_sock)
/* Read data */
- client_read(state);
+ winbind_client_read(state);
/*
* If we have the start of a
@@ -619,7 +636,7 @@ static void process_loop(int accept_sock)
if (state->read_buf_len ==
sizeof(state->request)) {
- process_packet(state);
+ winbind_process_packet(state);
}
}
@@ -655,6 +672,57 @@ static void process_loop(int accept_sock)
}
}
+
+/*
+ these are split out from the main winbindd for use by the background daemon
+ */
+int winbind_setup_common(void)
+{
+ load_interfaces();
+
+ secrets_init();
+
+ /* Get list of domains we look up requests for. This includes the
+ domain which we are a member of as well as any trusted
+ domains. */
+
+ init_domain_list();
+
+ ZERO_STRUCT(server_state);
+
+ /* Winbind daemon initialisation */
+
+ if (!winbindd_param_init())
+ return 1;
+
+ if (!winbindd_idmap_init())
+ return 1;
+
+ /* Unblock all signals we are interested in as they may have been
+ blocked by the parent process. */
+
+ BlockSignals(False, SIGINT);
+ BlockSignals(False, SIGQUIT);
+ BlockSignals(False, SIGTERM);
+ BlockSignals(False, SIGUSR1);
+ BlockSignals(False, SIGUSR2);
+ BlockSignals(False, SIGHUP);
+
+ /* Setup signal handlers */
+
+ CatchSignal(SIGINT, termination_handler); /* Exit on these sigs */
+ CatchSignal(SIGQUIT, termination_handler);
+ CatchSignal(SIGTERM, termination_handler);
+
+ CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
+
+ CatchSignal(SIGUSR2, sigusr2_handler); /* Debugging sigs */
+ CatchSignal(SIGHUP, sighup_handler);
+
+ return 0;
+}
+
+
/* Main function */
struct winbindd_state server_state; /* Server state information */
@@ -664,6 +732,7 @@ static void usage(void)
{
printf("Usage: winbindd [options]\n");
printf("\t-i interactive mode\n");
+ printf("\t-B dual daemon mode\n");
printf("\t-n disable cacheing\n");
printf("\t-d level set debug level\n");
printf("\t-s configfile choose smb.conf location\n");
@@ -708,7 +777,7 @@ int main(int argc, char **argv)
/* Initialise samba/rpc client stuff */
- while ((opt = getopt(argc, argv, "id:s:nh")) != EOF) {
+ while ((opt = getopt(argc, argv, "id:s:nhB")) != EOF) {
switch (opt) {
/* Don't become a daemon */
@@ -716,6 +785,11 @@ int main(int argc, char **argv)
interactive = True;
break;
+ /* dual daemon system */
+ case 'B':
+ opt_dual_daemon = True;
+ break;
+
/* disable cacheing */
case 'n':
opt_nocache = True;
@@ -782,46 +856,13 @@ int main(int argc, char **argv)
setpgid( (pid_t)0, (pid_t)0);
#endif
- load_interfaces();
-
- secrets_init();
-
- /* Get list of domains we look up requests for. This includes the
- domain which we are a member of as well as any trusted
- domains. */
-
- init_domain_list();
-
- ZERO_STRUCT(server_state);
-
- /* Winbind daemon initialisation */
-
- if (!winbindd_param_init())
- return 1;
+ if (opt_dual_daemon) {
+ do_dual_daemon();
+ }
- if (!winbindd_idmap_init())
+ if (winbind_setup_common() != 0) {
return 1;
-
- /* Unblock all signals we are interested in as they may have been
- blocked by the parent process. */
-
- BlockSignals(False, SIGINT);
- BlockSignals(False, SIGQUIT);
- BlockSignals(False, SIGTERM);
- BlockSignals(False, SIGUSR1);
- BlockSignals(False, SIGUSR2);
- BlockSignals(False, SIGHUP);
-
- /* Setup signal handlers */
-
- CatchSignal(SIGINT, termination_handler); /* Exit on these sigs */
- CatchSignal(SIGQUIT, termination_handler);
- CatchSignal(SIGTERM, termination_handler);
-
- CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
-
- CatchSignal(SIGUSR2, sigusr2_handler); /* Debugging sigs */
- CatchSignal(SIGHUP, sighup_handler);
+ }
/* Initialise messaging system */
diff --git a/source3/nsswitch/winbindd_cache.c b/source3/nsswitch/winbindd_cache.c
index 9bd95fdd86..f65705e0fb 100644
--- a/source3/nsswitch/winbindd_cache.c
+++ b/source3/nsswitch/winbindd_cache.c
@@ -51,7 +51,7 @@ void wcache_flush_cache(void)
if (opt_nocache) return;
wcache->tdb = tdb_open_log(lock_path("winbindd_cache.tdb"), 5000,
- TDB_DEFAULT, O_RDWR | O_CREAT | O_TRUNC, 0600);
+ TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0600);
if (!wcache->tdb) {
DEBUG(0,("Failed to open winbindd_cache.tdb!\n"));
@@ -205,11 +205,17 @@ static void refresh_sequence_number(struct winbindd_domain *domain, BOOL force)
{
NTSTATUS status;
unsigned time_diff;
+ unsigned cache_time = lp_winbind_cache_time();
+
+ /* trying to reconnect is expensive, don't do it too often */
+ if (domain->sequence_number == DOM_SEQUENCE_NONE) {
+ cache_time *= 8;
+ }
time_diff = time(NULL) - domain->last_seq_check;
/* see if we have to refetch the domain sequence number */
- if (!force && (time_diff < lp_winbind_cache_time())) {
+ if (!force && (time_diff < cache_time)) {
return;
}
@@ -289,9 +295,15 @@ static struct cache_entry *wcache_fetch(struct winbind_cache *cache,
centry->sequence_number = centry_uint32(centry);
if (centry_expired(domain, centry)) {
+ extern BOOL opt_dual_daemon;
+ if (opt_dual_daemon) {
+ extern BOOL backgroud_process;
+ backgroud_process = True;
+ } else {
centry_free(centry);
return NULL;
}
+ }
return centry;
}
diff --git a/source3/nsswitch/winbindd_proto.h b/source3/nsswitch/winbindd_proto.h
index f3830cd63c..8cac542b88 100644
--- a/source3/nsswitch/winbindd_proto.h
+++ b/source3/nsswitch/winbindd_proto.h
@@ -6,6 +6,9 @@
/* The following definitions come from nsswitch/winbindd.c */
+void winbind_process_packet(struct winbindd_cli_state *state);
+void winbind_client_read(struct winbindd_cli_state *state);
+int winbind_setup_common(void);
int main(int argc, char **argv);
/* The following definitions come from nsswitch/winbindd_ads.c */
@@ -39,6 +42,13 @@ NTSTATUS cm_get_netlogon_cli(char *domain, unsigned char *trust_passwd,
struct cli_state **cli);
void winbindd_cm_status(void);
+/* The following definitions come from nsswitch/winbindd_dual.c */
+
+int dual_select_setup(fd_set *fds, int maxfd);
+void dual_select(fd_set *fds);
+void dual_send_request(struct winbindd_cli_state *state);
+void do_dual_daemon(void);
+
/* The following definitions come from nsswitch/winbindd_group.c */
enum winbindd_result winbindd_getgrnam(struct winbindd_cli_state *state);
--
cgit
From f2843dec43a4f239a01e167dc322e9808c6e4163 Mon Sep 17 00:00:00 2001
From: Tim Potter
Date: Wed, 24 Apr 2002 05:36:40 +0000
Subject: Added constant and message for invalid security descriptor dos error.
(This used to be commit 0827bd4184256a87d6cf6c58bc314309503da7be)
---
source3/include/doserr.h | 1 +
source3/libsmb/doserr.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/source3/include/doserr.h b/source3/include/doserr.h
index 4945bc69d7..9750dd7489 100644
--- a/source3/include/doserr.h
+++ b/source3/include/doserr.h
@@ -164,6 +164,7 @@
#define WERR_OBJECT_PATH_INVALID W_ERROR(161)
#define WERR_NO_MORE_ITEMS W_ERROR(259)
#define WERR_MORE_DATA W_ERROR(234)
+#define WERR_INVALID_SECURITY_DESCRIPTOR W_ERROR(1338)
#define WERR_UNKNOWN_PRINTER_DRIVER W_ERROR(1797)
#define WERR_INVALID_PRINTER_NAME W_ERROR(1801)
#define WERR_PRINTER_ALREADY_EXISTS W_ERROR(1802)
diff --git a/source3/libsmb/doserr.c b/source3/libsmb/doserr.c
index adc001bf29..116a54e76f 100644
--- a/source3/libsmb/doserr.c
+++ b/source3/libsmb/doserr.c
@@ -65,6 +65,7 @@ werror_code_struct dos_errs[] =
{ "WERR_DFS_NO_SUCH_SERVER", WERR_DFS_NO_SUCH_SERVER },
{ "WERR_DFS_INTERNAL_ERROR", WERR_DFS_INTERNAL_ERROR },
{ "WERR_DFS_CANT_CREATE_JUNCT", WERR_DFS_CANT_CREATE_JUNCT },
+ { "WERR_INVALID_SECURITY_DESCRIPTOR", WERR_INVALID_SECURITY_DESCRIPTOR },
{ NULL, W_ERROR(0) }
};
--
cgit
From d4034d796fc48b3df471453b0971a65ef45f0148 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 09:00:29 +0000
Subject: made a couple of variables static (This used to be commit
fb6ce175d479e5bddc239595320f5dc245ac2ec6)
---
source3/smbd/mangle_hash2.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index 5b3c63ec55..a473de38d6 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -88,13 +88,14 @@ static char **prefix_cache;
static u32 *prefix_cache_hashes;
/* these are the characters we use in the 8.3 hash. Must be 36 chars long */
-const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static const char *basechars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static unsigned char base_reverse[256];
#define base_forward(v) basechars[v]
/* the list of reserved dos names - all of these are illegal */
-const char *reserved_names[] = { "AUX", "LOCK$", "CON", "COM1", "COM2", "COM3", "COM4",
- "LPT1", "LPT2", "LPT3", "NUL", "PRN", NULL };
+static const char *reserved_names[] =
+{ "AUX", "LOCK$", "CON", "COM1", "COM2", "COM3", "COM4",
+ "LPT1", "LPT2", "LPT3", "NUL", "PRN", NULL };
/*
hash a string of the specified length. The string does not need to be
--
cgit
From 6e1c478082b23551285ad28a0790a57536af2817 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 09:51:14 +0000
Subject: main() needs to be indented to make sure it doesn't generate a
prototype (This used to be commit fdfde9b84cf825d84316344fea5af43a9b8ebcc9)
---
source3/nsswitch/winbindd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index b198b4a163..2c88d11cae 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -739,7 +739,7 @@ static void usage(void)
printf("\t-h show this help message\n");
}
-int main(int argc, char **argv)
+ int main(int argc, char **argv)
{
extern BOOL AllowDebugChange;
extern pstring global_myname;
--
cgit
From a87a63a958a8ab820562cb0671be2130576d9c9a Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 09:59:48 +0000
Subject: damn! I forgot to commit winbindd_dual.c (This used to be commit
f3764ab2c602d6af9dce15f0d525a9f11c1723f1)
---
source3/nsswitch/winbindd_dual.c | 205 +++++++++++++++++++++++++++++++++++++++
1 file changed, 205 insertions(+)
create mode 100644 source3/nsswitch/winbindd_dual.c
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
new file mode 100644
index 0000000000..c91021adf8
--- /dev/null
+++ b/source3/nsswitch/winbindd_dual.c
@@ -0,0 +1,205 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Winbind background daemon
+
+ Copyright (C) Andrew Tridgell 2002
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+ the idea of the optional dual daemon mode is ot prevent slow domain
+ responses from clagging up the rest of the system. When in dual
+ daemon mode winbindd always responds to requests from cache if the
+ request is in cache, and if the cached answer is stale then it asks
+ the "dual daemon" to update the cache for that request
+
+ */
+
+#include "winbindd.h"
+
+extern BOOL opt_dual_daemon;
+BOOL backgroud_process = False;
+int dual_daemon_pipe = -1;
+
+
+/* a list of requests ready to be sent to the dual daemon */
+struct dual_list {
+ struct dual_list *next;
+ char *data;
+ int length;
+ int offset;
+};
+
+static struct dual_list *dual_list;
+static struct dual_list *dual_list_end;
+
+/*
+ setup a select() including the dual daemon pipe
+ */
+int dual_select_setup(fd_set *fds, int maxfd)
+{
+ if (dual_daemon_pipe == -1 ||
+ !dual_list) {
+ return maxfd;
+ }
+
+ FD_SET(dual_daemon_pipe, fds);
+ if (dual_daemon_pipe > maxfd) {
+ maxfd = dual_daemon_pipe;
+ }
+ return maxfd;
+}
+
+
+/*
+ a hook called from the main winbindd select() loop to handle writes
+ to the dual daemon pipe
+*/
+void dual_select(fd_set *fds)
+{
+ int n;
+
+ if (dual_daemon_pipe == -1 ||
+ !dual_list ||
+ !FD_ISSET(dual_daemon_pipe, fds)) {
+ return;
+ }
+
+ n = write(dual_daemon_pipe,
+ &dual_list->data[dual_list->offset],
+ dual_list->length - dual_list->offset);
+
+ if (n <= 0) {
+ /* the pipe is dead! fall back to normal operation */
+ dual_daemon_pipe = -1;
+ return;
+ }
+
+ dual_list->offset += n;
+
+ if (dual_list->offset == dual_list->length) {
+ struct dual_list *next;
+ next = dual_list->next;
+ free(dual_list->data);
+ free(dual_list);
+ dual_list = next;
+ if (!dual_list) {
+ dual_list_end = NULL;
+ }
+ }
+}
+
+/*
+ send a request to the background daemon
+ this is called for stale cached entries
+*/
+void dual_send_request(struct winbindd_cli_state *state)
+{
+ struct dual_list *list;
+
+ if (!backgroud_process) return;
+
+ list = malloc(sizeof(*list));
+ if (!list) return;
+
+ list->next = NULL;
+ list->data = memdup(&state->request, sizeof(state->request));
+ list->length = sizeof(state->request);
+ list->offset = 0;
+
+ if (!dual_list_end) {
+ dual_list = list;
+ dual_list_end = list;
+ } else {
+ dual_list_end->next = list;
+ dual_list_end = list;
+ }
+
+ backgroud_process = False;
+}
+
+
+/*
+the main dual daemon
+*/
+void do_dual_daemon(void)
+{
+ int fdpair[2];
+ struct winbindd_cli_state state;
+
+ if (pipe(fdpair) != 0) {
+ return;
+ }
+
+ ZERO_STRUCT(state);
+ state.pid = getpid();
+
+ dual_daemon_pipe = fdpair[1];
+ state.sock = fdpair[0];
+
+ if (fork() != 0) {
+ close(fdpair[0]);
+ return;
+ }
+ close(fdpair[1]);
+
+ if (winbind_setup_common() != 0) _exit(0);
+
+ dual_daemon_pipe = -1;
+ opt_dual_daemon = False;
+
+ while (1) {
+ /* free up any talloc memory */
+ lp_talloc_free();
+ main_loop_talloc_free();
+
+ /* fetch a request from the main daemon */
+ winbind_client_read(&state);
+
+ if (state.finished) {
+ /* we lost contact with our parent */
+ exit(0);
+ }
+
+ /* process full rquests */
+ if (state.read_buf_len == sizeof(state.request)) {
+ DEBUG(4,("dual daemon request %d\n", (int)state.request.cmd));
+
+ /* special handling for the stateful requests */
+ switch (state.request.cmd) {
+ case WINBINDD_GETPWENT:
+ winbindd_setpwent(&state);
+ break;
+
+ case WINBINDD_GETGRENT:
+ winbindd_setgrent(&state);
+ break;
+ default:
+ break;
+ }
+
+ winbind_process_packet(&state);
+ SAFE_FREE(state.response.extra_data);
+
+ free_getent_state(state.getpwent_state);
+ free_getent_state(state.getgrent_state);
+ state.getpwent_state = NULL;
+ state.getgrent_state = NULL;
+ }
+ }
+}
+
--
cgit
From ee8dad7b3de45fe0525a2b3a0d734469cd508084 Mon Sep 17 00:00:00 2001
From: Simo Sorce
Date: Wed, 24 Apr 2002 11:24:58 +0000
Subject: add collision/total indication to every collision report (This used
to be commit c4d6a49779e0e2bff86256b8b353e6c803e31ba9)
---
source3/torture/mangle_test.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/source3/torture/mangle_test.c b/source3/torture/mangle_test.c
index 2d5b3610d5..ced0185c95 100644
--- a/source3/torture/mangle_test.c
+++ b/source3/torture/mangle_test.c
@@ -88,8 +88,9 @@ static BOOL test_one(struct cli_state *cli, const char *name)
if (strcasecmp(name, data.dptr) != 0) {
/* we have a collision */
collisions++;
- printf("Collision between %s and %s -> %s\n",
- name, data.dptr, shortname);
+ printf("Collision between %s and %s -> %s "
+ " (coll/tot: %u/%u)\n",
+ name, data.dptr, shortname, collisions, total);
}
free(data.dptr);
} else {
--
cgit
From 193225dd424c72209b54d867fac64b7415cff529 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell
Date: Wed, 24 Apr 2002 11:43:02 +0000
Subject: patch from Alexander Bokovoy needed for dlopen on bsd systems (This
used to be commit 38fd99e84176106ed700f637e9292d2a4c1385b4)
---
source3/acconfig.h | 5 +-
source3/configure | 1284 ++++++++++++++++++++++--------------------
source3/configure.in | 12 +-
source3/include/config.h.in | 8 +-
source3/include/includes.h | 4 +-
source3/lib/system.c | 8 +-
source3/smbd/build_options.c | 13 +-
7 files changed, 707 insertions(+), 627 deletions(-)
diff --git a/source3/acconfig.h b/source3/acconfig.h
index 00c14ca97b..9f395a9947 100644
--- a/source3/acconfig.h
+++ b/source3/acconfig.h
@@ -124,7 +124,10 @@
#undef USE_SETRESUID
#undef USE_SETREUID
#undef USE_SETUIDX
-#undef HAVE_LIBDL
+#undef HAVE_DLOPEN
+#undef HAVE_DLCLOSE
+#undef HAVE_DLSYM
+#undef HAVE_DLERROR
#undef SYSCONF_SC_NGROUPS_MAX
#undef HAVE_UT_UT_NAME
#undef HAVE_UT_UT_USER
diff --git a/source3/configure b/source3/configure
index 3e13dc1b22..05decae4fa 100755
--- a/source3/configure
+++ b/source3/configure
@@ -2284,7 +2284,7 @@ else
fi
done
-for ac_hdr in security/pam_modules.h security/_pam_macros.h ldap.h lber.h
+for ac_hdr in security/pam_modules.h security/_pam_macros.h ldap.h lber.h dlfcn.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
@@ -3622,9 +3622,65 @@ EOF
fi
############################################
-# we need libdl for PAM, the password database plugins and the new VFS code
-echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:3628: checking for dlopen in -ldl" >&5
+# we need dlopen/dlclose/dlsym/dlerror for PAM, the password database plugins and the new VFS code
+for ac_func in dlopen
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3630: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <&6
+fi
+done
+
+if test x"$ac_cv_func_dlopen" = x"no"; then
+ echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:3684: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3632,7 +3688,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3660,24 +3716,26 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
LIBS="$LIBS -ldl";
cat >> confdefs.h <<\EOF
-#define HAVE_LIBDL 1
+#define HAVE_DLOPEN 1
EOF
else
echo "$ac_t""no" 1>&6
fi
+fi
+# dlopen/dlclose/dlsym/dlerror will be checked again later and defines will be set then
############################################
# check if the compiler can do immediate structures
echo $ac_n "checking for immediate structures""... $ac_c" 1>&6
-echo "configure:3675: checking for immediate structures" >&5
+echo "configure:3733: checking for immediate structures" >&5
if eval "test \"`echo '$''{'samba_cv_immediate_structures'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
@@ -3695,7 +3753,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_immediate_structures=yes
else
@@ -3718,13 +3776,13 @@ fi
############################################
# check for unix domain sockets
echo $ac_n "checking for unix domain sockets""... $ac_c" 1>&6
-echo "configure:3722: checking for unix domain sockets" >&5
+echo "configure:3780: checking for unix domain sockets" >&5
if eval "test \"`echo '$''{'samba_cv_unixsocket'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
@@ -3739,7 +3797,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_unixsocket=yes
else
@@ -3761,13 +3819,13 @@ fi
echo $ac_n "checking for socklen_t type""... $ac_c" 1>&6
-echo "configure:3765: checking for socklen_t type" >&5
+echo "configure:3823: checking for socklen_t type" >&5
if eval "test \"`echo '$''{'samba_cv_socklen_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
@@ -3780,7 +3838,7 @@ int main() {
socklen_t i = 0
; return 0; }
EOF
-if { (eval echo configure:3784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_socklen_t=yes
else
@@ -3801,13 +3859,13 @@ EOF
fi
echo $ac_n "checking for sig_atomic_t type""... $ac_c" 1>&6
-echo "configure:3805: checking for sig_atomic_t type" >&5
+echo "configure:3863: checking for sig_atomic_t type" >&5
if eval "test \"`echo '$''{'samba_cv_sig_atomic_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
@@ -3820,7 +3878,7 @@ int main() {
sig_atomic_t i = 0
; return 0; }
EOF
-if { (eval echo configure:3824: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_sig_atomic_t=yes
else
@@ -3843,20 +3901,20 @@ fi
# stupid headers have the functions but no declaration. grrrr.
echo $ac_n "checking for errno declaration""... $ac_c" 1>&6
-echo "configure:3847: checking for errno declaration" >&5
+echo "configure:3905: checking for errno declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_errno_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)errno
; return 0; }
EOF
-if { (eval echo configure:3860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3918: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_errno_decl=yes
else
@@ -3878,20 +3936,20 @@ EOF
echo $ac_n "checking for setresuid declaration""... $ac_c" 1>&6
-echo "configure:3882: checking for setresuid declaration" >&5
+echo "configure:3940: checking for setresuid declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_setresuid_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)setresuid
; return 0; }
EOF
-if { (eval echo configure:3895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_setresuid_decl=yes
else
@@ -3913,20 +3971,20 @@ EOF
echo $ac_n "checking for setresgid declaration""... $ac_c" 1>&6
-echo "configure:3917: checking for setresgid declaration" >&5
+echo "configure:3975: checking for setresgid declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_setresgid_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)setresgid
; return 0; }
EOF
-if { (eval echo configure:3930: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_setresgid_decl=yes
else
@@ -3948,20 +4006,20 @@ EOF
echo $ac_n "checking for asprintf declaration""... $ac_c" 1>&6
-echo "configure:3952: checking for asprintf declaration" >&5
+echo "configure:4010: checking for asprintf declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_asprintf_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)asprintf
; return 0; }
EOF
-if { (eval echo configure:3965: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4023: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_asprintf_decl=yes
else
@@ -3983,20 +4041,20 @@ EOF
echo $ac_n "checking for vasprintf declaration""... $ac_c" 1>&6
-echo "configure:3987: checking for vasprintf declaration" >&5
+echo "configure:4045: checking for vasprintf declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_vasprintf_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)vasprintf
; return 0; }
EOF
-if { (eval echo configure:4000: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_vasprintf_decl=yes
else
@@ -4018,20 +4076,20 @@ EOF
echo $ac_n "checking for vsnprintf declaration""... $ac_c" 1>&6
-echo "configure:4022: checking for vsnprintf declaration" >&5
+echo "configure:4080: checking for vsnprintf declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_vsnprintf_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)vsnprintf
; return 0; }
EOF
-if { (eval echo configure:4035: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_vsnprintf_decl=yes
else
@@ -4053,20 +4111,20 @@ EOF
echo $ac_n "checking for snprintf declaration""... $ac_c" 1>&6
-echo "configure:4057: checking for snprintf declaration" >&5
+echo "configure:4115: checking for snprintf declaration" >&5
if eval "test \"`echo '$''{'ac_cv_have_snprintf_decl'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
int i = (int)snprintf
; return 0; }
EOF
-if { (eval echo configure:4070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_have_snprintf_decl=yes
else
@@ -4090,7 +4148,7 @@ EOF
# and glibc has setresuid under linux but the function does
# nothing until kernel 2.1.44! very dumb.
echo $ac_n "checking for real setresuid""... $ac_c" 1>&6
-echo "configure:4094: checking for real setresuid" >&5
+echo "configure:4152: checking for real setresuid" >&5
if eval "test \"`echo '$''{'samba_cv_have_setresuid'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4099,12 +4157,12 @@ else
samba_cv_have_setresuid=cross
else
cat > conftest.$ac_ext <
main() { setresuid(1,1,1); setresuid(2,2,2); exit(errno==EPERM?0:1);}
EOF
-if { (eval echo configure:4108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_have_setresuid=yes
else
@@ -4129,7 +4187,7 @@ fi
# Do the same check for setresguid...
#
echo $ac_n "checking for real setresgid""... $ac_c" 1>&6
-echo "configure:4133: checking for real setresgid" >&5
+echo "configure:4191: checking for real setresgid" >&5
if eval "test \"`echo '$''{'samba_cv_have_setresgid'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4138,13 +4196,13 @@ else
samba_cv_have_setresgid=cross
else
cat > conftest.$ac_ext <
#include
main() { errno = 0; setresgid(1,1,1); exit(errno != 0 ? (errno==EPERM ? 0 : 1) : 0);}
EOF
-if { (eval echo configure:4148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_have_setresgid=yes
else
@@ -4167,7 +4225,7 @@ EOF
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:4171: checking for 8-bit clean memcmp" >&5
+echo "configure:4229: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4175,7 +4233,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
@@ -4208,12 +4266,12 @@ test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
for ac_func in crypt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4212: checking for $ac_func" >&5
+echo "configure:4270: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4262,7 +4320,7 @@ done
if test x"$ac_cv_func_crypt" = x"no"; then
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:4266: checking for crypt in -lcrypt" >&5
+echo "configure:4324: checking for crypt in -lcrypt" >&5
ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4270,7 +4328,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4314,7 +4372,7 @@ test "${with_readline+set}" != "set" && with_readline=yes
# test for where we get readline() from
echo $ac_n "checking whether to use readline""... $ac_c" 1>&6
-echo "configure:4318: checking whether to use readline" >&5
+echo "configure:4376: checking whether to use readline" >&5
# Check whether --with-readline or --without-readline was given.
if test "${with_readline+set}" = set; then
withval="$with_readline"
@@ -4326,17 +4384,17 @@ if test "${with_readline+set}" = set; then
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4330: checking for $ac_hdr" >&5
+echo "configure:4388: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4366,17 +4424,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4370: checking for $ac_hdr" >&5
+echo "configure:4428: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4380: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4407,17 +4465,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4411: checking for $ac_hdr" >&5
+echo "configure:4469: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4440,7 +4498,7 @@ EOF
for termlib in ncurses curses termcap terminfo termlib; do
echo $ac_n "checking for tgetent in -l${termlib}""... $ac_c" 1>&6
-echo "configure:4444: checking for tgetent in -l${termlib}" >&5
+echo "configure:4502: checking for tgetent in -l${termlib}" >&5
ac_lib_var=`echo ${termlib}'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4448,7 +4506,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l${termlib} $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4481,7 +4539,7 @@ fi
done
echo $ac_n "checking for rl_callback_handler_install in -lreadline""... $ac_c" 1>&6
-echo "configure:4485: checking for rl_callback_handler_install in -lreadline" >&5
+echo "configure:4543: checking for rl_callback_handler_install in -lreadline" >&5
ac_lib_var=`echo readline'_'rl_callback_handler_install | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4489,7 +4547,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lreadline $TERMLIBS $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4551,17 +4609,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4555: checking for $ac_hdr" >&5
+echo "configure:4613: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4591,17 +4649,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4595: checking for $ac_hdr" >&5
+echo "configure:4653: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4632,17 +4690,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4636: checking for $ac_hdr" >&5
+echo "configure:4694: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4665,7 +4723,7 @@ EOF
for termlib in ncurses curses termcap terminfo termlib; do
echo $ac_n "checking for tgetent in -l${termlib}""... $ac_c" 1>&6
-echo "configure:4669: checking for tgetent in -l${termlib}" >&5
+echo "configure:4727: checking for tgetent in -l${termlib}" >&5
ac_lib_var=`echo ${termlib}'_'tgetent | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4673,7 +4731,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-l${termlib} $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4706,7 +4764,7 @@ fi
done
echo $ac_n "checking for rl_callback_handler_install in -lreadline""... $ac_c" 1>&6
-echo "configure:4710: checking for rl_callback_handler_install in -lreadline" >&5
+echo "configure:4768: checking for rl_callback_handler_install in -lreadline" >&5
ac_lib_var=`echo readline'_'rl_callback_handler_install | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4714,7 +4772,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lreadline $TERMLIBS $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4775,7 +4833,7 @@ fi
# code will generate warnings on one of them unless we have a few
# special cases.
echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6
-echo "configure:4779: checking for rl_completion_matches in -lreadline" >&5
+echo "configure:4837: checking for rl_completion_matches in -lreadline" >&5
ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4783,7 +4841,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lreadline $TERMLIBS $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4827,12 +4885,12 @@ fi
for ac_func in connect
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4831: checking for $ac_func" >&5
+echo "configure:4889: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4883,7 +4941,7 @@ if test x"$ac_cv_func_connect" = x"no"; then
case "$LIBS" in
*-lnsl*) ;;
*) echo $ac_n "checking for printf in -lnsl_s""... $ac_c" 1>&6
-echo "configure:4887: checking for printf in -lnsl_s" >&5
+echo "configure:4945: checking for printf in -lnsl_s" >&5
ac_lib_var=`echo nsl_s'_'printf | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4891,7 +4949,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl_s $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4933,7 +4991,7 @@ fi
case "$LIBS" in
*-lnsl*) ;;
*) echo $ac_n "checking for printf in -lnsl""... $ac_c" 1>&6
-echo "configure:4937: checking for printf in -lnsl" >&5
+echo "configure:4995: checking for printf in -lnsl" >&5
ac_lib_var=`echo nsl'_'printf | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4941,7 +4999,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4983,7 +5041,7 @@ fi
case "$LIBS" in
*-lsocket*) ;;
*) echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:4987: checking for connect in -lsocket" >&5
+echo "configure:5045: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4991,7 +5049,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5033,7 +5091,7 @@ fi
case "$LIBS" in
*-linet*) ;;
*) echo $ac_n "checking for connect in -linet""... $ac_c" 1>&6
-echo "configure:5037: checking for connect in -linet" >&5
+echo "configure:5095: checking for connect in -linet" >&5
ac_lib_var=`echo inet'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5041,7 +5099,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-linet $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5096,12 +5154,12 @@ fi
for ac_func in yp_get_default_domain
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5100: checking for $ac_func" >&5
+echo "configure:5158: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5150,7 +5208,7 @@ done
if test x"$ac_cv_func_yp_get_default_domain" = x"no"; then
echo $ac_n "checking for yp_get_default_domain in -lnsl""... $ac_c" 1>&6
-echo "configure:5154: checking for yp_get_default_domain in -lnsl" >&5
+echo "configure:5212: checking for yp_get_default_domain in -lnsl" >&5
ac_lib_var=`echo nsl'_'yp_get_default_domain | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5158,7 +5216,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5199,12 +5257,12 @@ fi
for ac_func in execl
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5203: checking for $ac_func" >&5
+echo "configure:5261: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5260,12 +5318,12 @@ fi
for ac_func in dlopen dlclose dlsym dlerror waitpid getcwd strdup strndup strnlen strtoul strerror chown fchown chmod fchmod chroot link mknod mknod64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5264: checking for $ac_func" >&5
+echo "configure:5322: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5315,12 +5373,12 @@ done
for ac_func in fstat strchr utime utimes getrlimit fsync bzero memset strlcpy strlcat setpgid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5319: checking for $ac_func" >&5
+echo "configure:5377: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5370,12 +5428,12 @@ done
for ac_func in memmove vsnprintf snprintf asprintf vasprintf setsid glob strpbrk pipe crypt16 getauthuid
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5374: checking for $ac_func" >&5
+echo "configure:5432: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5425,12 +5483,12 @@ done
for ac_func in strftime sigprocmask sigblock sigaction sigset innetgr setnetgrent getnetgrent endnetgrent
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5429: checking for $ac_func" >&5
+echo "configure:5487: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5480,12 +5538,12 @@ done
for ac_func in initgroups select poll rdchk getgrnam getgrent pathconf realpath
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5484: checking for $ac_func" >&5
+echo "configure:5542: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5535,12 +5593,12 @@ done
for ac_func in setpriv setgidx setuidx setgroups sysconf mktime rename ftruncate stat64 fstat64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5539: checking for $ac_func" >&5
+echo "configure:5597: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5590,12 +5648,12 @@ done
for ac_func in lstat64 fopen64 atexit grantpt dup2 lseek64 ftruncate64 readdir64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5594: checking for $ac_func" >&5
+echo "configure:5652: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5645,12 +5703,12 @@ done
for ac_func in fseek64 fseeko64 ftell64 ftello64 setluid getpwanam setlinebuf
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5649: checking for $ac_func" >&5
+echo "configure:5707: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5700,12 +5758,12 @@ done
for ac_func in srandom random srand rand setenv usleep strcasecmp fcvt fcvtl symlink readlink
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5704: checking for $ac_func" >&5
+echo "configure:5762: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5755,12 +5813,12 @@ done
for ac_func in syslog vsyslog
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5759: checking for $ac_func" >&5
+echo "configure:5817: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5811,12 +5869,12 @@ done
for ac_func in setbuffer
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5815: checking for $ac_func" >&5
+echo "configure:5873: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5868,12 +5926,12 @@ done
for ac_func in syscall
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5872: checking for $ac_func" >&5
+echo "configure:5930: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5924,12 +5982,12 @@ done
for ac_func in _dup _dup2 _opendir _readdir _seekdir _telldir _closedir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5928: checking for $ac_func" >&5
+echo "configure:5986: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5979,12 +6037,12 @@ done
for ac_func in __dup __dup2 __opendir __readdir __seekdir __telldir __closedir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5983: checking for $ac_func" >&5
+echo "configure:6041: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6034,12 +6092,12 @@ done
for ac_func in __getcwd _getcwd
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6038: checking for $ac_func" >&5
+echo "configure:6096: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6089,12 +6147,12 @@ done
for ac_func in __xstat __fxstat __lxstat
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6093: checking for $ac_func" >&5
+echo "configure:6151: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6144,12 +6202,12 @@ done
for ac_func in _stat _lstat _fstat __stat __lstat __fstat
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6148: checking for $ac_func" >&5
+echo "configure:6206: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6234: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6199,12 +6257,12 @@ done
for ac_func in _acl __acl _facl __facl _open __open _chdir __chdir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6203: checking for $ac_func" >&5
+echo "configure:6261: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6254,12 +6312,12 @@ done
for ac_func in _close __close _fchdir __fchdir _fcntl __fcntl
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6258: checking for $ac_func" >&5
+echo "configure:6316: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6309,12 +6367,12 @@ done
for ac_func in getdents _getdents __getdents _lseek __lseek _read __read
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6313: checking for $ac_func" >&5
+echo "configure:6371: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6364,12 +6422,12 @@ done
for ac_func in _write __write _fork __fork
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6368: checking for $ac_func" >&5
+echo "configure:6426: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6419,12 +6477,12 @@ done
for ac_func in _stat64 __stat64 _fstat64 __fstat64 _lstat64 __lstat64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6423: checking for $ac_func" >&5
+echo "configure:6481: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6509: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6474,12 +6532,12 @@ done
for ac_func in __sys_llseek llseek _llseek __llseek readdir64 _readdir64 __readdir64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6478: checking for $ac_func" >&5
+echo "configure:6536: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6529,12 +6587,12 @@ done
for ac_func in pread _pread __pread pread64 _pread64 __pread64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6533: checking for $ac_func" >&5
+echo "configure:6591: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6619: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6584,12 +6642,12 @@ done
for ac_func in pwrite _pwrite __pwrite pwrite64 _pwrite64 __pwrite64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6588: checking for $ac_func" >&5
+echo "configure:6646: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6639,12 +6697,12 @@ done
for ac_func in open64 _open64 __open64 creat64
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6643: checking for $ac_func" >&5
+echo "configure:6701: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6698,9 +6756,9 @@ done
if test x$ac_cv_func_stat64 = xno ; then
echo $ac_n "checking for stat64 in ""... $ac_c" 1>&6
-echo "configure:6702: checking for stat64 in " >&5
+echo "configure:6760: checking for stat64 in " >&5
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6774: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_stat64=yes
else
@@ -6731,9 +6789,9 @@ fi
if test x$ac_cv_func_lstat64 = xno ; then
echo $ac_n "checking for lstat64 in ""... $ac_c" 1>&6
-echo "configure:6735: checking for lstat64 in " >&5
+echo "configure:6793: checking for lstat64 in " >&5
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_lstat64=yes
else
@@ -6764,9 +6822,9 @@ fi
if test x$ac_cv_func_fstat64 = xno ; then
echo $ac_n "checking for fstat64 in ""... $ac_c" 1>&6
-echo "configure:6768: checking for fstat64 in " >&5
+echo "configure:6826: checking for fstat64 in " >&5
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_cv_func_fstat64=yes
else
@@ -6798,7 +6856,7 @@ fi
#####################################
# we might need the resolv library on some systems
echo $ac_n "checking for dn_expand in -lresolv""... $ac_c" 1>&6
-echo "configure:6802: checking for dn_expand in -lresolv" >&5
+echo "configure:6860: checking for dn_expand in -lresolv" >&5
ac_lib_var=`echo resolv'_'dn_expand | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6806,7 +6864,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lresolv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6855,12 +6913,12 @@ case "$LIBS" in
*-lsecurity*) for ac_func in putprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6859: checking for $ac_func" >&5
+echo "configure:6917: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -6908,7 +6966,7 @@ fi
done
;;
*) echo $ac_n "checking for putprpwnam in -lsecurity""... $ac_c" 1>&6
-echo "configure:6912: checking for putprpwnam in -lsecurity" >&5
+echo "configure:6970: checking for putprpwnam in -lsecurity" >&5
ac_lib_var=`echo security'_'putprpwnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -6916,7 +6974,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsecurity $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -6957,12 +7015,12 @@ fi
for ac_func in putprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6961: checking for $ac_func" >&5
+echo "configure:7019: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7016,12 +7074,12 @@ case "$LIBS" in
*-lsec*) for ac_func in putprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7020: checking for $ac_func" >&5
+echo "configure:7078: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7069,7 +7127,7 @@ fi
done
;;
*) echo $ac_n "checking for putprpwnam in -lsec""... $ac_c" 1>&6
-echo "configure:7073: checking for putprpwnam in -lsec" >&5
+echo "configure:7131: checking for putprpwnam in -lsec" >&5
ac_lib_var=`echo sec'_'putprpwnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7077,7 +7135,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsec $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7118,12 +7176,12 @@ fi
for ac_func in putprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7122: checking for $ac_func" >&5
+echo "configure:7180: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7178,12 +7236,12 @@ case "$LIBS" in
*-lsecurity*) for ac_func in set_auth_parameters
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7182: checking for $ac_func" >&5
+echo "configure:7240: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7231,7 +7289,7 @@ fi
done
;;
*) echo $ac_n "checking for set_auth_parameters in -lsecurity""... $ac_c" 1>&6
-echo "configure:7235: checking for set_auth_parameters in -lsecurity" >&5
+echo "configure:7293: checking for set_auth_parameters in -lsecurity" >&5
ac_lib_var=`echo security'_'set_auth_parameters | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7239,7 +7297,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsecurity $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7280,12 +7338,12 @@ fi
for ac_func in set_auth_parameters
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7284: checking for $ac_func" >&5
+echo "configure:7342: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7339,12 +7397,12 @@ case "$LIBS" in
*-lsec*) for ac_func in set_auth_parameters
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7343: checking for $ac_func" >&5
+echo "configure:7401: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7392,7 +7450,7 @@ fi
done
;;
*) echo $ac_n "checking for set_auth_parameters in -lsec""... $ac_c" 1>&6
-echo "configure:7396: checking for set_auth_parameters in -lsec" >&5
+echo "configure:7454: checking for set_auth_parameters in -lsec" >&5
ac_lib_var=`echo sec'_'set_auth_parameters | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7400,7 +7458,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsec $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7441,12 +7499,12 @@ fi
for ac_func in set_auth_parameters
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7445: checking for $ac_func" >&5
+echo "configure:7503: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7502,12 +7560,12 @@ case "$LIBS" in
*-lgen*) for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7506: checking for $ac_func" >&5
+echo "configure:7564: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7555,7 +7613,7 @@ fi
done
;;
*) echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6
-echo "configure:7559: checking for getspnam in -lgen" >&5
+echo "configure:7617: checking for getspnam in -lgen" >&5
ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7563,7 +7621,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7604,12 +7662,12 @@ fi
for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7608: checking for $ac_func" >&5
+echo "configure:7666: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7664,12 +7722,12 @@ case "$LIBS" in
*-lsecurity*) for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7668: checking for $ac_func" >&5
+echo "configure:7726: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7717,7 +7775,7 @@ fi
done
;;
*) echo $ac_n "checking for getspnam in -lsecurity""... $ac_c" 1>&6
-echo "configure:7721: checking for getspnam in -lsecurity" >&5
+echo "configure:7779: checking for getspnam in -lsecurity" >&5
ac_lib_var=`echo security'_'getspnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7725,7 +7783,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsecurity $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7766,12 +7824,12 @@ fi
for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7770: checking for $ac_func" >&5
+echo "configure:7828: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7825,12 +7883,12 @@ case "$LIBS" in
*-lsec*) for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7829: checking for $ac_func" >&5
+echo "configure:7887: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7878,7 +7936,7 @@ fi
done
;;
*) echo $ac_n "checking for getspnam in -lsec""... $ac_c" 1>&6
-echo "configure:7882: checking for getspnam in -lsec" >&5
+echo "configure:7940: checking for getspnam in -lsec" >&5
ac_lib_var=`echo sec'_'getspnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -7886,7 +7944,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsec $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -7927,12 +7985,12 @@ fi
for ac_func in getspnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7931: checking for $ac_func" >&5
+echo "configure:7989: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -7987,12 +8045,12 @@ case "$LIBS" in
*-lsecurity*) for ac_func in bigcrypt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7991: checking for $ac_func" >&5
+echo "configure:8049: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8040,7 +8098,7 @@ fi
done
;;
*) echo $ac_n "checking for bigcrypt in -lsecurity""... $ac_c" 1>&6
-echo "configure:8044: checking for bigcrypt in -lsecurity" >&5
+echo "configure:8102: checking for bigcrypt in -lsecurity" >&5
ac_lib_var=`echo security'_'bigcrypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -8048,7 +8106,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsecurity $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -8089,12 +8147,12 @@ fi
for ac_func in bigcrypt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8093: checking for $ac_func" >&5
+echo "configure:8151: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8148,12 +8206,12 @@ case "$LIBS" in
*-lsec*) for ac_func in bigcrypt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8152: checking for $ac_func" >&5
+echo "configure:8210: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8201,7 +8259,7 @@ fi
done
;;
*) echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6
-echo "configure:8205: checking for bigcrypt in -lsec" >&5
+echo "configure:8263: checking for bigcrypt in -lsec" >&5
ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -8209,7 +8267,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsec $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -8250,12 +8308,12 @@ fi
for ac_func in bigcrypt
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8254: checking for $ac_func" >&5
+echo "configure:8312: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8310,12 +8368,12 @@ case "$LIBS" in
*-lsecurity*) for ac_func in getprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8314: checking for $ac_func" >&5
+echo "configure:8372: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8363,7 +8421,7 @@ fi
done
;;
*) echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6
-echo "configure:8367: checking for getprpwnam in -lsecurity" >&5
+echo "configure:8425: checking for getprpwnam in -lsecurity" >&5
ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -8371,7 +8429,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsecurity $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -8412,12 +8470,12 @@ fi
for ac_func in getprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8416: checking for $ac_func" >&5
+echo "configure:8474: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8471,12 +8529,12 @@ case "$LIBS" in
*-lsec*) for ac_func in getprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8475: checking for $ac_func" >&5
+echo "configure:8533: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8524,7 +8582,7 @@ fi
done
;;
*) echo $ac_n "checking for getprpwnam in -lsec""... $ac_c" 1>&6
-echo "configure:8528: checking for getprpwnam in -lsec" >&5
+echo "configure:8586: checking for getprpwnam in -lsec" >&5
ac_lib_var=`echo sec'_'getprpwnam | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -8532,7 +8590,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsec $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -8573,12 +8631,12 @@ fi
for ac_func in getprpwnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8577: checking for $ac_func" >&5
+echo "configure:8635: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:8663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -8644,7 +8702,7 @@ SHLIBEXT="so"
# Assume non-shared by default and override below
BLDSHARED="false"
echo $ac_n "checking ability to build shared libraries""... $ac_c" 1>&6
-echo "configure:8648: checking ability to build shared libraries" >&5
+echo "configure:8706: checking ability to build shared libraries" >&5
# and these are for particular systems
case "$host_os" in
@@ -8784,7 +8842,7 @@ EOF
*dgux*) # Extract the first word of "groff", so it can be a program name with args.
set dummy groff; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:8788: checking for $ac_word" >&5
+echo "configure:8846: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_ROFF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8844,17 +8902,17 @@ esac
echo "$ac_t""$BLDSHARED" 1>&6
echo $ac_n "checking linker flags for shared libraries""... $ac_c" 1>&6
-echo "configure:8848: checking linker flags for shared libraries" >&5
+echo "configure:8906: checking linker flags for shared libraries" >&5
echo "$ac_t""$LDSHFLAGS" 1>&6
echo $ac_n "checking compiler flags for position-independent code""... $ac_c" 1>&6
-echo "configure:8851: checking compiler flags for position-independent code" >&5
+echo "configure:8909: checking compiler flags for position-independent code" >&5
echo "$ac_t""$PICFLAGS" 1>&6
#######################################################
# test whether building a shared library actually works
if test $BLDSHARED = true; then
echo $ac_n "checking whether building shared libraries actually works""... $ac_c" 1>&6
-echo "configure:8858: checking whether building shared libraries actually works" >&5
+echo "configure:8916: checking whether building shared libraries actually works" >&5
if eval "test \"`echo '$''{'ac_cv_shlib_works'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8885,7 +8943,7 @@ fi
################
echo $ac_n "checking for long long""... $ac_c" 1>&6
-echo "configure:8889: checking for long long" >&5
+echo "configure:8947: checking for long long" >&5
if eval "test \"`echo '$''{'samba_cv_have_longlong'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8894,12 +8952,12 @@ if test "$cross_compiling" = yes; then
samba_cv_have_longlong=cross
else
cat > conftest.$ac_ext <
main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }
EOF
-if { (eval echo configure:8903: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:8961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_have_longlong=yes
else
@@ -8926,20 +8984,20 @@ fi
# AIX needs this.
echo $ac_n "checking for LL suffix on long long integers""... $ac_c" 1>&6
-echo "configure:8930: checking for LL suffix on long long integers" >&5
+echo "configure:8988: checking for LL suffix on long long integers" >&5
if eval "test \"`echo '$''{'samba_cv_compiler_supports_ll'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
long long i = 0x8000000000LL
; return 0; }
EOF
-if { (eval echo configure:8943: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9001: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_compiler_supports_ll=yes
else
@@ -8961,7 +9019,7 @@ fi
echo $ac_n "checking for 64 bit off_t""... $ac_c" 1>&6
-echo "configure:8965: checking for 64 bit off_t" >&5
+echo "configure:9023: checking for 64 bit off_t" >&5
if eval "test \"`echo '$''{'samba_cv_SIZEOF_OFF_T'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -8970,13 +9028,13 @@ if test "$cross_compiling" = yes; then
samba_cv_SIZEOF_OFF_T=cross
else
cat > conftest.$ac_ext <
#include
main() { exit((sizeof(off_t) == 8) ? 0 : 1); }
EOF
-if { (eval echo configure:8980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_SIZEOF_OFF_T=yes
else
@@ -8999,7 +9057,7 @@ EOF
fi
echo $ac_n "checking for off64_t""... $ac_c" 1>&6
-echo "configure:9003: checking for off64_t" >&5
+echo "configure:9061: checking for off64_t" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_OFF64_T'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9008,7 +9066,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_OFF64_T=cross
else
cat > conftest.$ac_ext <
main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
EOF
-if { (eval echo configure:9022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_OFF64_T=yes
else
@@ -9041,7 +9099,7 @@ EOF
fi
echo $ac_n "checking for 64 bit ino_t""... $ac_c" 1>&6
-echo "configure:9045: checking for 64 bit ino_t" >&5
+echo "configure:9103: checking for 64 bit ino_t" >&5
if eval "test \"`echo '$''{'samba_cv_SIZEOF_INO_T'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9050,13 +9108,13 @@ if test "$cross_compiling" = yes; then
samba_cv_SIZEOF_INO_T=cross
else
cat > conftest.$ac_ext <
#include
main() { exit((sizeof(ino_t) == 8) ? 0 : 1); }
EOF
-if { (eval echo configure:9060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_SIZEOF_INO_T=yes
else
@@ -9079,7 +9137,7 @@ EOF
fi
echo $ac_n "checking for ino64_t""... $ac_c" 1>&6
-echo "configure:9083: checking for ino64_t" >&5
+echo "configure:9141: checking for ino64_t" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_INO64_T'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9088,7 +9146,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_INO64_T=cross
else
cat > conftest.$ac_ext <
main() { struct stat64 st; ino64_t s; if (sizeof(ino_t) == sizeof(ino64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
EOF
-if { (eval echo configure:9102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_INO64_T=yes
else
@@ -9121,7 +9179,7 @@ EOF
fi
echo $ac_n "checking for dev64_t""... $ac_c" 1>&6
-echo "configure:9125: checking for dev64_t" >&5
+echo "configure:9183: checking for dev64_t" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_DEV64_T'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9130,7 +9188,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_DEV64_T=cross
else
cat > conftest.$ac_ext <
main() { struct stat64 st; dev64_t s; if (sizeof(dev_t) == sizeof(dev64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
EOF
-if { (eval echo configure:9144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_DEV64_T=yes
else
@@ -9163,13 +9221,13 @@ EOF
fi
echo $ac_n "checking for struct dirent64""... $ac_c" 1>&6
-echo "configure:9167: checking for struct dirent64" >&5
+echo "configure:9225: checking for struct dirent64" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_STRUCT_DIRENT64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_STRUCT_DIRENT64=yes
else
@@ -9202,7 +9260,7 @@ EOF
fi
echo $ac_n "checking for major macro""... $ac_c" 1>&6
-echo "configure:9206: checking for major macro" >&5
+echo "configure:9264: checking for major macro" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_DEVICE_MAJOR_FN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9211,7 +9269,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_DEVICE_MAJOR_FN=cross
else
cat > conftest.$ac_ext <
main() { dev_t dev; int i = major(dev); return 0; }
EOF
-if { (eval echo configure:9224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_DEVICE_MAJOR_FN=yes
else
@@ -9243,7 +9301,7 @@ EOF
fi
echo $ac_n "checking for minor macro""... $ac_c" 1>&6
-echo "configure:9247: checking for minor macro" >&5
+echo "configure:9305: checking for minor macro" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_DEVICE_MINOR_FN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9252,7 +9310,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_DEVICE_MINOR_FN=cross
else
cat > conftest.$ac_ext <
main() { dev_t dev; int i = minor(dev); return 0; }
EOF
-if { (eval echo configure:9265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_DEVICE_MINOR_FN=yes
else
@@ -9284,7 +9342,7 @@ EOF
fi
echo $ac_n "checking for unsigned char""... $ac_c" 1>&6
-echo "configure:9288: checking for unsigned char" >&5
+echo "configure:9346: checking for unsigned char" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UNSIGNED_CHAR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9293,12 +9351,12 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_UNSIGNED_CHAR=cross
else
cat > conftest.$ac_ext <
main() { char c; c=250; exit((c > 0)?0:1); }
EOF
-if { (eval echo configure:9302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_UNSIGNED_CHAR=yes
else
@@ -9321,13 +9379,13 @@ EOF
fi
echo $ac_n "checking for sin_len in sock""... $ac_c" 1>&6
-echo "configure:9325: checking for sin_len in sock" >&5
+echo "configure:9383: checking for sin_len in sock" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_SOCK_SIN_LEN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9336,7 +9394,7 @@ int main() {
struct sockaddr_in sock; sock.sin_len = sizeof(sock);
; return 0; }
EOF
-if { (eval echo configure:9340: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_SOCK_SIN_LEN=yes
else
@@ -9357,13 +9415,13 @@ EOF
fi
echo $ac_n "checking whether seekdir returns void""... $ac_c" 1>&6
-echo "configure:9361: checking whether seekdir returns void" >&5
+echo "configure:9419: checking whether seekdir returns void" >&5
if eval "test \"`echo '$''{'samba_cv_SEEKDIR_RETURNS_VOID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9372,7 +9430,7 @@ int main() {
return 0;
; return 0; }
EOF
-if { (eval echo configure:9376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_SEEKDIR_RETURNS_VOID=yes
else
@@ -9393,20 +9451,20 @@ EOF
fi
echo $ac_n "checking for __FILE__ macro""... $ac_c" 1>&6
-echo "configure:9397: checking for __FILE__ macro" >&5
+echo "configure:9455: checking for __FILE__ macro" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_FILE_MACRO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
printf("%s\n", __FILE__);
; return 0; }
EOF
-if { (eval echo configure:9410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_FILE_MACRO=yes
else
@@ -9427,20 +9485,20 @@ EOF
fi
echo $ac_n "checking for __FUNCTION__ macro""... $ac_c" 1>&6
-echo "configure:9431: checking for __FUNCTION__ macro" >&5
+echo "configure:9489: checking for __FUNCTION__ macro" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_FUNCTION_MACRO'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
int main() {
printf("%s\n", __FUNCTION__);
; return 0; }
EOF
-if { (eval echo configure:9444: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9502: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_FUNCTION_MACRO=yes
else
@@ -9461,7 +9519,7 @@ EOF
fi
echo $ac_n "checking if gettimeofday takes tz argument""... $ac_c" 1>&6
-echo "configure:9465: checking if gettimeofday takes tz argument" >&5
+echo "configure:9523: checking if gettimeofday takes tz argument" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_GETTIMEOFDAY_TZ'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9470,14 +9528,14 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_GETTIMEOFDAY_TZ=cross
else
cat > conftest.$ac_ext <
#include
main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}
EOF
-if { (eval echo configure:9481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_GETTIMEOFDAY_TZ=yes
else
@@ -9500,7 +9558,7 @@ EOF
fi
echo $ac_n "checking for C99 vsnprintf""... $ac_c" 1>&6
-echo "configure:9504: checking for C99 vsnprintf" >&5
+echo "configure:9562: checking for C99 vsnprintf" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_C99_VSNPRINTF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9509,7 +9567,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_C99_VSNPRINTF=cross
else
cat > conftest.$ac_ext <
@@ -9536,7 +9594,7 @@ void foo(const char *format, ...) {
main() { foo("hello"); }
EOF
-if { (eval echo configure:9540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9598: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_C99_VSNPRINTF=yes
else
@@ -9559,7 +9617,7 @@ EOF
fi
echo $ac_n "checking for broken readdir""... $ac_c" 1>&6
-echo "configure:9563: checking for broken readdir" >&5
+echo "configure:9621: checking for broken readdir" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_BROKEN_READDIR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -9568,7 +9626,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_BROKEN_READDIR=cross
else
cat > conftest.$ac_ext <
#include
@@ -9576,7 +9634,7 @@ main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
di->d_name[0] == 0) exit(0); exit(1);}
EOF
-if { (eval echo configure:9580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:9638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_BROKEN_READDIR=yes
else
@@ -9599,13 +9657,13 @@ EOF
fi
echo $ac_n "checking for utimbuf""... $ac_c" 1>&6
-echo "configure:9603: checking for utimbuf" >&5
+echo "configure:9661: checking for utimbuf" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UTIMBUF'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9613,7 +9671,7 @@ int main() {
struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));
; return 0; }
EOF
-if { (eval echo configure:9617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9675: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UTIMBUF=yes
else
@@ -9637,12 +9695,12 @@ fi
for ac_func in pututline pututxline updwtmp updwtmpx getutmpx
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9641: checking for $ac_func" >&5
+echo "configure:9699: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:9727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -9691,13 +9749,13 @@ done
echo $ac_n "checking for ut_name in utmp""... $ac_c" 1>&6
-echo "configure:9695: checking for ut_name in utmp" >&5
+echo "configure:9753: checking for ut_name in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_NAME'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9705,7 +9763,7 @@ int main() {
struct utmp ut; ut.ut_name[0] = 'a';
; return 0; }
EOF
-if { (eval echo configure:9709: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_NAME=yes
else
@@ -9726,13 +9784,13 @@ EOF
fi
echo $ac_n "checking for ut_user in utmp""... $ac_c" 1>&6
-echo "configure:9730: checking for ut_user in utmp" >&5
+echo "configure:9788: checking for ut_user in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_USER'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9740,7 +9798,7 @@ int main() {
struct utmp ut; ut.ut_user[0] = 'a';
; return 0; }
EOF
-if { (eval echo configure:9744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9802: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_USER=yes
else
@@ -9761,13 +9819,13 @@ EOF
fi
echo $ac_n "checking for ut_id in utmp""... $ac_c" 1>&6
-echo "configure:9765: checking for ut_id in utmp" >&5
+echo "configure:9823: checking for ut_id in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_ID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9775,7 +9833,7 @@ int main() {
struct utmp ut; ut.ut_id[0] = 'a';
; return 0; }
EOF
-if { (eval echo configure:9779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9837: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_ID=yes
else
@@ -9796,13 +9854,13 @@ EOF
fi
echo $ac_n "checking for ut_host in utmp""... $ac_c" 1>&6
-echo "configure:9800: checking for ut_host in utmp" >&5
+echo "configure:9858: checking for ut_host in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_HOST'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9810,7 +9868,7 @@ int main() {
struct utmp ut; ut.ut_host[0] = 'a';
; return 0; }
EOF
-if { (eval echo configure:9814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_HOST=yes
else
@@ -9831,13 +9889,13 @@ EOF
fi
echo $ac_n "checking for ut_time in utmp""... $ac_c" 1>&6
-echo "configure:9835: checking for ut_time in utmp" >&5
+echo "configure:9893: checking for ut_time in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TIME'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9845,7 +9903,7 @@ int main() {
struct utmp ut; time_t t; ut.ut_time = t;
; return 0; }
EOF
-if { (eval echo configure:9849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9907: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_TIME=yes
else
@@ -9866,13 +9924,13 @@ EOF
fi
echo $ac_n "checking for ut_tv in utmp""... $ac_c" 1>&6
-echo "configure:9870: checking for ut_tv in utmp" >&5
+echo "configure:9928: checking for ut_tv in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TV'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9880,7 +9938,7 @@ int main() {
struct utmp ut; struct timeval tv; ut.ut_tv = tv;
; return 0; }
EOF
-if { (eval echo configure:9884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9942: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_TV=yes
else
@@ -9901,13 +9959,13 @@ EOF
fi
echo $ac_n "checking for ut_type in utmp""... $ac_c" 1>&6
-echo "configure:9905: checking for ut_type in utmp" >&5
+echo "configure:9963: checking for ut_type in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_TYPE'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9915,7 +9973,7 @@ int main() {
struct utmp ut; ut.ut_type = 0;
; return 0; }
EOF
-if { (eval echo configure:9919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_TYPE=yes
else
@@ -9936,13 +9994,13 @@ EOF
fi
echo $ac_n "checking for ut_pid in utmp""... $ac_c" 1>&6
-echo "configure:9940: checking for ut_pid in utmp" >&5
+echo "configure:9998: checking for ut_pid in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_PID'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9950,7 +10008,7 @@ int main() {
struct utmp ut; ut.ut_pid = 0;
; return 0; }
EOF
-if { (eval echo configure:9954: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_PID=yes
else
@@ -9971,13 +10029,13 @@ EOF
fi
echo $ac_n "checking for ut_exit in utmp""... $ac_c" 1>&6
-echo "configure:9975: checking for ut_exit in utmp" >&5
+echo "configure:10033: checking for ut_exit in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_EXIT'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -9985,7 +10043,7 @@ int main() {
struct utmp ut; ut.ut_exit.e_exit = 0;
; return 0; }
EOF
-if { (eval echo configure:9989: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10047: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_EXIT=yes
else
@@ -10006,13 +10064,13 @@ EOF
fi
echo $ac_n "checking for ut_addr in utmp""... $ac_c" 1>&6
-echo "configure:10010: checking for ut_addr in utmp" >&5
+echo "configure:10068: checking for ut_addr in utmp" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UT_UT_ADDR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -10020,7 +10078,7 @@ int main() {
struct utmp ut; ut.ut_addr = 0;
; return 0; }
EOF
-if { (eval echo configure:10024: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UT_UT_ADDR=yes
else
@@ -10042,13 +10100,13 @@ fi
if test x$ac_cv_func_pututline = xyes ; then
echo $ac_n "checking whether pututline returns pointer""... $ac_c" 1>&6
-echo "configure:10046: checking whether pututline returns pointer" >&5
+echo "configure:10104: checking whether pututline returns pointer" >&5
if eval "test \"`echo '$''{'samba_cv_PUTUTLINE_RETURNS_UTMP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -10056,7 +10114,7 @@ int main() {
struct utmp utarg; struct utmp *utreturn; utreturn = pututline(&utarg);
; return 0; }
EOF
-if { (eval echo configure:10060: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_PUTUTLINE_RETURNS_UTMP=yes
else
@@ -10078,13 +10136,13 @@ EOF
fi
echo $ac_n "checking for ut_syslen in utmpx""... $ac_c" 1>&6
-echo "configure:10082: checking for ut_syslen in utmpx" >&5
+echo "configure:10140: checking for ut_syslen in utmpx" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_UX_UT_SYSLEN'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <
#include
@@ -10092,7 +10150,7 @@ int main() {
struct utmpx ux; ux.ut_syslen = 0;
; return 0; }
EOF
-if { (eval echo configure:10096: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
samba_cv_HAVE_UX_UT_SYSLEN=yes
else
@@ -10116,7 +10174,7 @@ fi
#################################################
# check for libiconv support
echo $ac_n "checking whether to use libiconv""... $ac_c" 1>&6
-echo "configure:10120: checking whether to use libiconv" >&5
+echo "configure:10178: checking whether to use libiconv" >&5
# Check whether --with-libiconv or --without-libiconv was given.
if test "${with_libiconv+set}" = set; then
withval="$with_libiconv"
@@ -10129,7 +10187,7 @@ if test "${with_libiconv+set}" = set; then
CFLAGS="$CFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
echo $ac_n "checking for iconv_open in -liconv""... $ac_c" 1>&6
-echo "configure:10133: checking for iconv_open in -liconv" >&5
+echo "configure:10191: checking for iconv_open in -liconv" >&5
ac_lib_var=`echo iconv'_'iconv_open | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -10137,7 +10195,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-liconv $LIBS"
cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:10210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -10191,7 +10249,7 @@ fi
############
# check for iconv in libc
echo $ac_n "checking for working iconv""... $ac_c" 1>&6
-echo "configure:10195: checking for working iconv" >&5
+echo "configure:10253: checking for working iconv" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_NATIVE_ICONV'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10200,7 +10258,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_NATIVE_ICONV=cross
else
cat > conftest.$ac_ext <
@@ -10211,7 +10269,7 @@ main() {
}
EOF
-if { (eval echo configure:10215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_NATIVE_ICONV=yes
else
@@ -10235,7 +10293,7 @@ fi
echo $ac_n "checking for Linux kernel oplocks""... $ac_c" 1>&6
-echo "configure:10239: checking for Linux kernel oplocks" >&5
+echo "configure:10297: checking for Linux kernel oplocks" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_OPLOCKS_LINUX'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10244,7 +10302,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=cross
else
cat > conftest.$ac_ext <
@@ -10258,7 +10316,7 @@ main() {
}
EOF
-if { (eval echo configure:10262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_KERNEL_OPLOCKS_LINUX=yes
else
@@ -10281,7 +10339,7 @@ EOF
fi
echo $ac_n "checking for kernel change notify support""... $ac_c" 1>&6
-echo "configure:10285: checking for kernel change notify support" >&5
+echo "configure:10343: checking for kernel change notify support" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_CHANGE_NOTIFY'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10290,7 +10348,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=cross
else
cat > conftest.$ac_ext <
@@ -10304,7 +10362,7 @@ main() {
}
EOF
-if { (eval echo configure:10308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:10366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
samba_cv_HAVE_KERNEL_CHANGE_NOTIFY=yes
else
@@ -10327,7 +10385,7 @@ EOF
fi
echo $ac_n "checking for kernel share modes""... $ac_c" 1>&6
-echo "configure:10331: checking for kernel share modes" >&5
+echo "configure:10389: checking for kernel share modes" >&5
if eval "test \"`echo '$''{'samba_cv_HAVE_KERNEL_SHARE_MODES'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -10336,7 +10394,7 @@ if test "$cross_compiling" = yes; then
samba_cv_HAVE_KERNEL_SHARE_MODES=cross
else
cat > conftest.$ac_ext <