summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/include/structs.h1
-rw-r--r--source4/lib/samba3/config.mk3
-rw-r--r--source4/lib/samba3/ldb_samba3.c60
-rw-r--r--source4/lib/samba3/samba3.c69
-rw-r--r--source4/lib/samba3/samba3.h16
-rw-r--r--source4/lib/samba3/share_info.c85
-rw-r--r--source4/param/loadparm.c330
-rw-r--r--source4/param/params.c26
8 files changed, 411 insertions, 179 deletions
diff --git a/source4/include/structs.h b/source4/include/structs.h
index 047e32e739..4f79ccb657 100644
--- a/source4/include/structs.h
+++ b/source4/include/structs.h
@@ -279,6 +279,7 @@ struct samba3_winsdb_entry;
struct samba3_policy;
struct samba3_regdb;
struct samba3_secrets;
+struct samba3_share_info;
struct samba3;
struct ldb_map_mappings;
diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk
index b5bf3fadb9..79142e4f67 100644
--- a/source4/lib/samba3/config.mk
+++ b/source4/lib/samba3/config.mk
@@ -11,7 +11,8 @@ ADD_OBJ_FILES = \
lib/samba3/group.o \
lib/samba3/registry.o \
lib/samba3/secrets.o \
- lib/samba3/ldb_samba3.o
+ lib/samba3/ldb_samba3.o \
+ lib/samba3/share_info.o
# End SUBSYSTEM LIBSAMBA3
################################################
diff --git a/source4/lib/samba3/ldb_samba3.c b/source4/lib/samba3/ldb_samba3.c
index fa13daa611..030b051938 100644
--- a/source4/lib/samba3/ldb_samba3.c
+++ b/source4/lib/samba3/ldb_samba3.c
@@ -34,9 +34,67 @@
* sambaGroupType -> groupType
* displayName -> name
* description -> description
- * sambaSIDList -> member
+ * sambaSIDList -> member (special!)
*/
+/*
+ * sambaTrustPassword
+ */
+
+/* sambaDomain
+ * sambaDomainName
+ * sambaSID
+ * sambaNextRid
+ * sambaNextGroupRid
+ * sambaNextUserRid
+ * sambaAlgorithmicRidBase
+ */
+
+/* sambaUnixIdPool
+ */
+
+/* sambaIdmapEntry */
+
+/* sambaAccountPolicy */
+
+/* sambaSidEntry: FIXME */
+
+/* sambaSamAccount -> user:
+ * uid -> unixName (magic!)
+ * sambaSID -> objectSid
+ * cn -> cn
+ * sambaLMPassword -> lmPwdHash
+ * sambaNTPassword -> ntPwdHash
+ * sambaPwdLastSet -> pwdLastSet
+ * sambaLogonTime -> lastLogon
+ * sambaLogoffTime -> lastLogoff
+ * sambaKickoffTime -> ???
+ * sambaPwdCanChange -> ???
+ * sambaPwdMustChange -> ???
+ * sambaAcctFlags -> systemFlags ?
+ * displayName -> name
+ * sambaHomePath -> ???
+ * sambaHomeDrive -> ???
+ * sambaLogonScript -> ???
+ * sambaProfilePath -> ???
+ * description -> description
+ * sambaUserWorkstations -> ???
+ * sambaPrimaryGroupSID -> primaryGroupID
+ * sambaDomainName -> ???
+ * sambaMungedDial -> ???
+ * sambaBadPasswordCount -> badPwdcount
+ * sambaBadPasswordTime -> badPasswordtime
+ * sambaPasswordHistory -> ntPwdHistory
+ * sambaLogonHours -> ???
+ */
+
+/* Not necessary:
+ * sambaConfig
+ * sambaShare
+ * sambaConfigOption
+ */
+
+
struct ldb_map_mappings samba3_mappings;
/* the init function */
diff --git a/source4/lib/samba3/samba3.c b/source4/lib/samba3/samba3.c
index bfd41d6554..4eda3bd154 100644
--- a/source4/lib/samba3/samba3.c
+++ b/source4/lib/samba3/samba3.c
@@ -20,6 +20,71 @@
#include "includes.h"
#include "lib/samba3/samba3.h"
+struct smbconf_data {
+ TALLOC_CTX *ctx;
+ struct samba3 *db;
+ struct samba3_share_info *current_share;
+};
+
+struct samba3_share_info *samba3_find_share(struct samba3 *db, TALLOC_CTX* ctx, const char *name)
+{
+ int i;
+ for (i = 0; i < db->share_count; i++) {
+ if (!StrCaseCmp(db->shares[i].name, name))
+ return &db->shares[i];
+ }
+
+ db->shares = talloc_realloc(ctx, db->shares, struct samba3_share_info, db->share_count+1);
+ ZERO_STRUCT(db->shares[i]);
+ db->shares[i].name = talloc_strdup(ctx, name);
+ db->share_count++;
+
+ return &db->shares[i];
+}
+
+static BOOL samba3_sfunc (const char *name, void *_db)
+{
+ struct smbconf_data *privdat = _db;
+
+ privdat->current_share = samba3_find_share(privdat->db, privdat->ctx, name);
+
+ return True;
+}
+
+static BOOL samba3_pfunc (const char *name, const char *value, void *_db)
+{
+ struct smbconf_data *privdat = _db;
+ struct samba3_parameter *p;
+
+ privdat->current_share->parameters =
+ talloc_realloc(privdat->ctx, privdat->current_share->parameters,
+ struct samba3_parameter,
+ privdat->current_share->parameter_count+1);
+
+ p = &privdat->current_share->parameters[privdat->current_share->parameter_count];
+ p->name = talloc_strdup(privdat->ctx, name);
+ p->value = talloc_strdup(privdat->ctx, value);
+
+ privdat->current_share->parameter_count++;
+
+ return True;
+}
+
+NTSTATUS samba3_read_smbconf(const char *fn, TALLOC_CTX *ctx, struct samba3 *db)
+{
+ struct smbconf_data privdat;
+
+ privdat.ctx = ctx;
+ privdat.db = db;
+ privdat.current_share = samba3_find_share(db, ctx, "global");
+
+ if (!pm_process( fn, samba3_sfunc, samba3_pfunc, &privdat )) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ return NT_STATUS_OK;
+}
+
struct samba3 *samba3_read(const char *libdir, TALLOC_CTX *ctx)
{
struct samba3 *ret;
@@ -55,5 +120,9 @@ struct samba3 *samba3_read(const char *libdir, TALLOC_CTX *ctx)
samba3_read_secrets(dbfile, ctx, &ret->secrets);
SAFE_FREE(dbfile);
+ asprintf(&dbfile, "%s/share_info.tdb", libdir);
+ samba3_read_share_info(dbfile, ctx, ret);
+ SAFE_FREE(dbfile);
+
return ret;
}
diff --git a/source4/lib/samba3/samba3.h b/source4/lib/samba3/samba3.h
index 575ee83825..fe4db560a8 100644
--- a/source4/lib/samba3/samba3.h
+++ b/source4/lib/samba3/samba3.h
@@ -184,6 +184,19 @@ struct samba3_secrets
} *afs_keyfiles;
};
+struct samba3_parameter {
+ char *name;
+ char *value;
+};
+
+struct samba3_share_info {
+ char *name;
+ struct security_descriptor secdesc;
+
+ uint32_t parameter_count;
+ struct samba3_parameter *parameters;
+};
+
struct samba3
{
uint32_t winsdb_count;
@@ -192,6 +205,9 @@ struct samba3
uint32_t samaccount_count;
struct samba3_samaccount *samaccounts;
+ uint32_t share_count;
+ struct samba3_share_info *shares;
+
struct samba3_secrets secrets;
struct samba3_groupdb group;
struct samba3_idmapdb idmap;
diff --git a/source4/lib/samba3/share_info.c b/source4/lib/samba3/share_info.c
new file mode 100644
index 0000000000..098d6c552e
--- /dev/null
+++ b/source4/lib/samba3/share_info.c
@@ -0,0 +1,85 @@
+/*
+ * Unix SMB/CIFS implementation.
+ * Share Info parsing
+ * Copyright (C) Andrew Tridgell 1992-1997,
+ * Copyright (C) Jeremy Allison 2001.
+ * Copyright (C) Nigel Williams 2001.
+ * Copyright (C) Jelmer Vernooij 2005.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 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 "librpc/gen_ndr/ndr_security.h"
+#include "lib/tdb/include/tdbutil.h"
+#include "lib/samba3/samba3.h"
+#include "system/filesys.h"
+
+#define SHARE_DATABASE_VERSION_V1 1
+#define SHARE_DATABASE_VERSION_V2 2 /* version id in little endian. */
+
+NTSTATUS samba3_read_share_info(const char *fn, TALLOC_CTX *ctx, struct samba3 *db)
+{
+ int32_t vers_id;
+ TDB_CONTEXT *tdb;
+ TDB_DATA kbuf, vbuf;
+ DATA_BLOB blob;
+
+ tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0600);
+ if (!tdb) {
+ DEBUG(0,("Failed to open share info database %s (%s)\n",
+ fn, strerror(errno) ));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ /* Cope with byte-reversed older versions of the db. */
+ vers_id = tdb_fetch_int32(tdb, "INFO/version");
+ if ((vers_id == SHARE_DATABASE_VERSION_V1) || (IREV(vers_id) == SHARE_DATABASE_VERSION_V1)) {
+ /* Written on a bigendian machine with old fetch_int code. Save as le. */
+ vers_id = SHARE_DATABASE_VERSION_V2;
+ }
+
+ if (vers_id != SHARE_DATABASE_VERSION_V2) {
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ for (kbuf = tdb_firstkey(tdb); kbuf.dptr; kbuf = tdb_nextkey(tdb, kbuf))
+ {
+ struct ndr_pull *pull;
+ struct samba3_share_info *share;
+ char *name;
+
+ if (strncmp(kbuf.dptr, "SECDESC/", strlen("SECDESC/")) != 0)
+ continue;
+
+ name = talloc_strndup(ctx, kbuf.dptr+strlen("SECDESC/"), kbuf.dsize-strlen("SECDESC/"));
+
+ share = samba3_find_share(db, ctx, name);
+
+ vbuf = tdb_fetch(tdb, kbuf);
+ blob.data = (uint8_t *)vbuf.dptr;
+ blob.length = vbuf.dsize;
+
+ pull = ndr_pull_init_blob(&blob, ctx);
+
+ ndr_pull_security_descriptor(pull, NDR_SCALARS|NDR_BUFFERS, &share->secdesc);
+
+ talloc_free(pull);
+ }
+
+ tdb_close(tdb);
+
+ return NT_STATUS_OK;
+}
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 3320fd824f..5191d10825 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -83,7 +83,7 @@ static BOOL bLoaded = False;
#define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
#define VALID(i) ServicePtrs[i]->valid
-static BOOL do_parameter(const char *, const char *);
+static BOOL do_parameter(const char *, const char *, void *);
static BOOL do_parameter_var(const char *pszParmName, const char *fmt, ...);
static BOOL defaults_saved = False;
@@ -783,103 +783,103 @@ static void init_printer_values(void)
case PRINT_AIX:
case PRINT_LPRNT:
case PRINT_LPROS2:
- do_parameter("Lpqcommand", "lpq -P'%p'");
- do_parameter("Lprmcommand", "lprm -P'%p' %j");
+ do_parameter("Lpqcommand", "lpq -P'%p'", NULL);
+ do_parameter("Lprmcommand", "lprm -P'%p' %j", NULL);
do_parameter("Printcommand",
- "lpr -r -P'%p' %s");
+ "lpr -r -P'%p' %s", NULL);
break;
case PRINT_LPRNG:
case PRINT_PLP:
- do_parameter("Lpqcommand", "lpq -P'%p'");
- do_parameter("Lprmcommand", "lprm -P'%p' %j");
+ do_parameter("Lpqcommand", "lpq -P'%p'", NULL);
+ do_parameter("Lprmcommand", "lprm -P'%p' %j", NULL);
do_parameter("Printcommand",
- "lpr -r -P'%p' %s");
+ "lpr -r -P'%p' %s", NULL);
do_parameter("Queuepausecommand",
- "lpc stop '%p'");
+ "lpc stop '%p'", NULL);
do_parameter("Queueresumecommand",
- "lpc start '%p'");
+ "lpc start '%p'", NULL);
do_parameter("Lppausecommand",
- "lpc hold '%p' %j");
+ "lpc hold '%p' %j", NULL);
do_parameter("Lpresumecommand",
- "lpc release '%p' %j");
+ "lpc release '%p' %j", NULL);
break;
case PRINT_CUPS:
#ifdef HAVE_CUPS
- do_parameter("Lpqcommand", "");
- do_parameter("Lprmcommand", "");
- do_parameter("Printcommand", "");
- do_parameter("Lppausecommand", "");
- do_parameter("Lpresumecommand", "");
- do_parameter("Queuepausecommand", "");
- do_parameter("Queueresumecommand", "");
-
- do_parameter("Printcapname", "cups");
+ do_parameter("Lpqcommand", "", NULL);
+ do_parameter("Lprmcommand", "", NULL);
+ do_parameter("Printcommand", "", NULL);
+ do_parameter("Lppausecommand", "", NULL);
+ do_parameter("Lpresumecommand", "", NULL);
+ do_parameter("Queuepausecommand", "", NULL);
+ do_parameter("Queueresumecommand", "", NULL);
+
+ do_parameter("Printcapname", "cups", NULL);
#else
do_parameter("Lpqcommand",
- "/usr/bin/lpstat -o '%p'");
+ "/usr/bin/lpstat -o '%p'", NULL);
do_parameter("Lprmcommand",
- "/usr/bin/cancel '%p-%j'");
+ "/usr/bin/cancel '%p-%j'", NULL);
do_parameter("Printcommand",
- "/usr/bin/lp -d '%p' %s; rm %s");
+ "/usr/bin/lp -d '%p' %s; rm %s", NULL);
do_parameter("Lppausecommand",
- "lp -i '%p-%j' -H hold");
+ "lp -i '%p-%j' -H hold", NULL);
do_parameter("Lpresumecommand",
- "lp -i '%p-%j' -H resume");
+ "lp -i '%p-%j' -H resume", NULL);
do_parameter("Queuepausecommand",
- "/usr/bin/disable '%p'");
+ "/usr/bin/disable '%p'", NULL);
do_parameter("Queueresumecommand",
- "/usr/bin/enable '%p'");
- do_parameter("Printcapname", "lpstat");
+ "/usr/bin/enable '%p'", NULL);
+ do_parameter("Printcapname", "lpstat", NULL);
#endif /* HAVE_CUPS */
break;
case PRINT_SYSV:
case PRINT_HPUX:
- do_parameter("Lpqcommand", "lpstat -o%p");
- do_parameter("Lprmcommand", "cancel %p-%j");
+ do_parameter("Lpqcommand", "lpstat -o%p", NULL);
+ do_parameter("Lprmcommand", "cancel %p-%j", NULL);
do_parameter("Printcommand",
- "lp -c -d%p %s; rm %s");
+ "lp -c -d%p %s; rm %s", NULL);
do_parameter("Queuepausecommand",
- "disable %p");
+ "disable %p", NULL);
do_parameter("Queueresumecommand",
- "enable %p");
+ "enable %p", NULL);
#ifndef HPUX
do_parameter("Lppausecommand",
- "lp -i %p-%j -H hold");
+ "lp -i %p-%j -H hold", NULL);
do_parameter("Lpresumecommand",
- "lp -i %p-%j -H resume");
+ "lp -i %p-%j -H resume", NULL);
#endif /* HPUX */
break;
case PRINT_QNX:
- do_parameter("Lpqcommand", "lpq -P%p");
- do_parameter("Lprmcommand", "lprm -P%p %j");
- do_parameter("Printcommand", "lp -r -P%p %s");
+ do_parameter("Lpqcommand", "lpq -P%p", NULL);
+ do_parameter("Lprmcommand", "lprm -P%p %j", NULL);
+ do_parameter("Printcommand", "lp -r -P%p %s", NULL);
break;
case PRINT_SOFTQ:
- do_parameter("Lpqcommand", "qstat -l -d%p");
+ do_parameter("Lpqcommand", "qstat -l -d%p", NULL);
do_parameter("Lprmcommand",
- "qstat -s -j%j -c");
+ "qstat -s -j%j -c", NULL);
do_parameter("Printcommand",
- "lp -d%p -s %s; rm %s");
+ "lp -d%p -s %s; rm %s", NULL);
do_parameter("Lppausecommand",
- "qstat -s -j%j -h");
+ "qstat -s -j%j -h", NULL);
do_parameter("Lpresumecommand",
- "qstat -s -j%j -r");
+ "qstat -s -j%j -r", NULL);
break;
#ifdef DEVELOPER
case PRINT_TEST:
case PRINT_VLP:
- do_parameter("Printcommand", "vlp print %p %s");
- do_parameter("Lpqcommand", "vlp lpq %p");
- do_parameter("Lprmcommand", "vlp lprm %p %j");
- do_parameter("Lppausecommand", "vlp lppause %p %j");
- do_parameter("Lpresumecommand", "vlp lpresum %p %j");
- do_parameter("Queuepausecommand", "vlp queuepause %p");
- do_parameter("Queueresumecommand", "vlp queueresume %p");
+ do_parameter("Printcommand", "vlp print %p %s", NULL);
+ do_parameter("Lpqcommand", "vlp lpq %p", NULL);
+ do_parameter("Lprmcommand", "vlp lprm %p %j", NULL);
+ do_parameter("Lppausecommand", "vlp lppause %p %j", NULL);
+ do_parameter("Lpresumecommand", "vlp lpresum %p %j", NULL);
+ do_parameter("Queuepausecommand", "vlp queuepause %p", NULL);
+ do_parameter("Queueresumecommand", "vlp queueresume %p", NULL);
break;
#endif /* DEVELOPER */
@@ -906,166 +906,166 @@ static void init_globals(void)
}
}
- do_parameter("config file", dyn_CONFIGFILE);
+ do_parameter("config file", dyn_CONFIGFILE, NULL);
/* options that can be set on the command line must be initialised via
the slower do_parameter() to ensure that FLAG_CMDLINE is obeyed */
#ifdef TCP_NODELAY
- do_parameter("socket options", "TCP_NODELAY");
+ do_parameter("socket options", "TCP_NODELAY", NULL);
#endif
- do_parameter("workgroup", DEFAULT_WORKGROUP);
+ do_parameter("workgroup", DEFAULT_WORKGROUP, NULL);
myname = get_myname();
- do_parameter("netbios name", myname);
+ do_parameter("netbios name", myname, NULL);
SAFE_FREE(myname);
- do_parameter("max protocol", "NT1");
- do_parameter("name resolve order", "lmhosts wins host bcast");
+ do_parameter("max protocol", "NT1", NULL);
+ do_parameter("name resolve order", "lmhosts wins host bcast", NULL);
init_printer_values();
- do_parameter("fstype", FSTYPE_STRING);
- do_parameter("ntvfs handler", "unixuid default");
- do_parameter("max connections", "-1");
-
- do_parameter("dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup");
- do_parameter("server services", "smb rpc nbt ldap cldap web kdc");
- do_parameter("ntptr providor", "simple_ldb");
- do_parameter("auth methods", "anonymous sam_ignoredomain");
- do_parameter("smb passwd file", dyn_SMB_PASSWD_FILE);
- do_parameter("private dir", dyn_PRIVATE_DIR);
- do_parameter("sam database", "sam.ldb");
- do_parameter("spoolss database", "spoolss.ldb");
- do_parameter("wins database", "wins.ldb");
- do_parameter("registry:HKEY_LOCAL_MACHINE", "hklm.ldb");
+ do_parameter("fstype", FSTYPE_STRING, NULL);
+ do_parameter("ntvfs handler", "unixuid default", NULL);
+ do_parameter("max connections", "-1", NULL);
+
+ do_parameter("dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup", NULL);
+ do_parameter("server services", "smb rpc nbt ldap cldap web kdc", NULL);
+ do_parameter("ntptr providor", "simple_ldb", NULL);
+ do_parameter("auth methods", "anonymous sam_ignoredomain", NULL);
+ do_parameter("smb passwd file", dyn_SMB_PASSWD_FILE, NULL);
+ do_parameter("private dir", dyn_PRIVATE_DIR, NULL);
+ do_parameter("sam database", "sam.ldb", NULL);
+ do_parameter("spoolss database", "spoolss.ldb", NULL);
+ do_parameter("wins database", "wins.ldb", NULL);
+ do_parameter("registry:HKEY_LOCAL_MACHINE", "hklm.ldb", NULL);
/* This hive should be dynamically generated by Samba using
data from the sam, but for the moment leave it in a tdb to
keep regedt32 from popping up an annoying dialog. */
- do_parameter("registry:HKEY_USERS", "hku.ldb");
+ do_parameter("registry:HKEY_USERS", "hku.ldb", NULL);
- do_parameter("guest account", GUEST_ACCOUNT);
+ do_parameter("guest account", GUEST_ACCOUNT, NULL);
/* using UTF8 by default allows us to support all chars */
- do_parameter("unix charset", "UTF8");
+ do_parameter("unix charset", "UTF8", NULL);
/* Use codepage 850 as a default for the dos character set */
- do_parameter("dos charset", "CP850");
+ do_parameter("dos charset", "CP850", NULL);
/*
* Allow the default PASSWD_CHAT to be overridden in local.h.
*/
- do_parameter("passwd chat", DEFAULT_PASSWD_CHAT);
+ do_parameter("passwd chat", DEFAULT_PASSWD_CHAT, NULL);
- do_parameter("passwd program", "");
- do_parameter("printcap name", PRINTCAP_NAME);
+ do_parameter("passwd program", "", NULL);
+ do_parameter("printcap name", PRINTCAP_NAME, NULL);
- do_parameter("pid directory", dyn_PIDDIR);
- do_parameter("lock dir", dyn_LOCKDIR);
- do_parameter("ncalrpc dir", dyn_NCALRPCDIR);
+ do_parameter("pid directory", dyn_PIDDIR, NULL);
+ do_parameter("lock dir", dyn_LOCKDIR, NULL);
+ do_parameter("ncalrpc dir", dyn_NCALRPCDIR, NULL);
- do_parameter("socket address", "0.0.0.0");
+ do_parameter("socket address", "0.0.0.0", NULL);
do_parameter_var("server string", "Samba %s", SAMBA_VERSION_STRING);
do_parameter_var("announce version", "%d.%d",
DEFAULT_MAJOR_VERSION,
DEFAULT_MINOR_VERSION);
- do_parameter("logon drive", "");
-
- do_parameter("logon home", "\\\\%N\\%U");
- do_parameter("logon path", "\\\\%N\\%U\\profile");
- do_parameter("password server", "*");
-
- do_parameter("load printers", "True");
-
- do_parameter("max mux", "50");
- do_parameter("max xmit", "12288");
- do_parameter("lpqcachetime", "10");
- do_parameter("DisableSpoolss", "False");
- do_parameter("password level", "0");
- do_parameter("username level", "0");
- do_parameter("LargeReadwrite", "True");
- do_parameter("minprotocol", "CORE");
- do_parameter("security", "USER");
- do_parameter("paranoid server security", "True");
- do_parameter("EncryptPasswords", "True");
- do_parameter("ReadRaw", "True");
- do_parameter("WriteRaw", "True");
- do_parameter("NullPasswords", "False");
- do_parameter("ObeyPamRestrictions", "False");
- do_parameter("lm announce", "Auto");
- do_parameter("lm interval", "60");
- do_parameter("announce as", "NT SERVER");
-
- do_parameter("TimeServer", "False");
- do_parameter("BindInterfacesOnly", "False");
- do_parameter("PamPasswordChange", "False");
- do_parameter("Unicode", "True");
- do_parameter("restrict anonymous", "0");
- do_parameter("ClientLanManAuth", "True");
- do_parameter("LanmanAuth", "True");
- do_parameter("NTLMAuth", "True");
+ do_parameter("logon drive", "", NULL);
+
+ do_parameter("logon home", "\\\\%N\\%U", NULL);
+ do_parameter("logon path", "\\\\%N\\%U\\profile", NULL);
+ do_parameter("password server", "*", NULL);
+
+ do_parameter("load printers", "True", NULL);
+
+ do_parameter("max mux", "50", NULL);
+ do_parameter("max xmit", "12288", NULL);
+ do_parameter("lpqcachetime", "10", NULL);
+ do_parameter("DisableSpoolss", "False", NULL);
+ do_parameter("password level", "0", NULL);
+ do_parameter("username level", "0", NULL);
+ do_parameter("LargeReadwrite", "True", NULL);
+ do_parameter("minprotocol", "CORE", NULL);
+ do_parameter("security", "USER", NULL);
+ do_parameter("paranoid server security", "True", NULL);
+ do_parameter("EncryptPasswords", "True", NULL);
+ do_parameter("ReadRaw", "True", NULL);
+ do_parameter("WriteRaw", "True", NULL);
+ do_parameter("NullPasswords", "False", NULL);
+ do_parameter("ObeyPamRestrictions", "False", NULL);
+ do_parameter("lm announce", "Auto", NULL);
+ do_parameter("lm interval", "60", NULL);
+ do_parameter("announce as", "NT SERVER", NULL);
+
+ do_parameter("TimeServer", "False", NULL);
+ do_parameter("BindInterfacesOnly", "False", NULL);
+ do_parameter("PamPasswordChange", "False", NULL);
+ do_parameter("Unicode", "True", NULL);
+ do_parameter("restrict anonymous", "0", NULL);
+ do_parameter("ClientLanManAuth", "True", NULL);
+ do_parameter("LanmanAuth", "True", NULL);
+ do_parameter("NTLMAuth", "True", NULL);
- do_parameter("enhanced browsing", "True");
- do_parameter("LockSpinCount", "3");
- do_parameter("LockSpinTime", "10");
+ do_parameter("enhanced browsing", "True", NULL);
+ do_parameter("LockSpinCount", "3", NULL);
+ do_parameter("LockSpinTime", "10", NULL);
#ifdef MMAP_BLACKLIST
- do_parameter("UseMmap", "False");
+ do_parameter("UseMmap", "False", NULL);
#else
- do_parameter("UseMmap", "True");
+ do_parameter("UseMmap", "True", NULL);
#endif
- do_parameter("UnixExtensions", "False");
+ do_parameter("UnixExtensions", "False", NULL);
/* hostname lookups can be very expensive and are broken on
a large number of sites (tridge) */
- do_parameter("HostnameLookups", "False");
+ do_parameter("HostnameLookups", "False", NULL);
- do_parameter("PreferredMaster", "Auto");
- do_parameter("os level", "20");
- do_parameter("LocalMaster", "True");
- do_parameter("DomainMaster", "Auto"); /* depending on bDomainLogons */
- do_parameter("DomainLogons", "False");
- do_parameter("WINSsupport", "False");
- do_parameter("WINSproxy", "False");
+ do_parameter("PreferredMaster", "Auto", NULL);
+ do_parameter("os level", "20", NULL);
+ do_parameter("LocalMaster", "True", NULL);
+ do_parameter("DomainMaster", "Auto", NULL); /* depending on bDomainLogons */
+ do_parameter("DomainLogons", "False", NULL);
+ do_parameter("WINSsupport", "False", NULL);
+ do_parameter("WINSproxy", "False", NULL);
- do_parameter("DNSproxy", "True");
+ do_parameter("DNSproxy", "True", NULL);
- do_parameter("AllowTrustedDomains", "True");
+ do_parameter("AllowTrustedDomains", "True", NULL);
- do_parameter("TemplateShell", "/bin/false");
- do_parameter("TemplateHomedir", "/home/%D/%U");
- do_parameter("WinbindSeparator", "\\");
+ do_parameter("TemplateShell", "/bin/false", NULL);
+ do_parameter("TemplateHomedir", "/home/%D/%U", NULL);
+ do_parameter("WinbindSeparator", "\\", NULL);
- do_parameter("winbind cache time", "15");
- do_parameter("WinbindEnumUsers", "True");
- do_parameter("WinbindEnumGroups", "True");
- do_parameter("WinbindUseDefaultDomain", "False");
+ do_parameter("winbind cache time", "15", NULL);
+ do_parameter("WinbindEnumUsers", "True", NULL);
+ do_parameter("WinbindEnumGroups", "True", NULL);
+ do_parameter("WinbindUseDefaultDomain", "False", NULL);
- do_parameter("IDMapBackend", "tdb");
+ do_parameter("IDMapBackend", "tdb", NULL);
- do_parameter("name cache timeout", "660"); /* In seconds */
+ do_parameter("name cache timeout", "660", NULL); /* In seconds */
- do_parameter("client signing", "Yes");
- do_parameter("server signing", "auto");
+ do_parameter("client signing", "Yes", NULL);
+ do_parameter("server signing", "auto", NULL);
- do_parameter("use spnego", "True");
+ do_parameter("use spnego", "True", NULL);
- do_parameter("smb ports", SMB_PORTS);
- do_parameter("nbt port", "137");
- do_parameter("dgram port", "138");
- do_parameter("cldap port", "389");
- do_parameter("krb5 port", "88");
- do_parameter("web port", "901");
- do_parameter("swat directory", dyn_SWATDIR);
+ do_parameter("smb ports", SMB_PORTS, NULL);
+ do_parameter("nbt port", "137", NULL);
+ do_parameter("dgram port", "138", NULL);
+ do_parameter("cldap port", "389", NULL);
+ do_parameter("krb5 port", "88", NULL);
+ do_parameter("web port", "901", NULL);
+ do_parameter("swat directory", dyn_SWATDIR, NULL);
- do_parameter("nt status support", "True");
+ do_parameter("nt status support", "True", NULL);
- do_parameter("max wins ttl", "432000");
- do_parameter("min wins ttl", "10");
+ do_parameter("max wins ttl", "432000", NULL);
+ do_parameter("min wins ttl", "10", NULL);
- do_parameter("tls enabled", "True");
- do_parameter("tls keyfile", "tls/key.pem");
- do_parameter("tls certfile", "tls/cert.pem");
- do_parameter("tls cafile", "tls/ca.pem");
+ do_parameter("tls enabled", "True", NULL);
+ do_parameter("tls keyfile", "tls/key.pem", NULL);
+ do_parameter("tls certfile", "tls/cert.pem", NULL);
+ do_parameter("tls cafile", "tls/ca.pem", NULL);
do_parameter_var("js include", "%s/js", dyn_LIBDIR);
do_parameter_var("setup directory", "%s/setup", dyn_LIBDIR);
}
@@ -1354,7 +1354,7 @@ static int getservicebyname(const char *pszServiceName,
static void copy_service(service * pserviceDest,
service * pserviceSource, BOOL *pcopymapDest);
static BOOL service_ok(int iService);
-static BOOL do_section(const char *pszSectionName);
+static BOOL do_section(const char *pszSectionName, void *);
static void init_copymap(service * pservice);
/* This is a helper function for parametrical options support. */
@@ -2083,7 +2083,7 @@ static BOOL handle_include(const char *pszParmValue, char **ptr)
string_set(ptr, fname);
if (file_exist(fname))
- return (pm_process(fname, do_section, do_parameter));
+ return (pm_process(fname, do_section, do_parameter, NULL));
DEBUG(2, ("Can't find include file %s\n", fname));
@@ -2449,7 +2449,7 @@ BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
Process a parameter.
***************************************************************************/
-static BOOL do_parameter(const char *pszParmName, const char *pszParmValue)
+static BOOL do_parameter(const char *pszParmName, const char *pszParmValue, void *userdata)
{
return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
pszParmName, pszParmValue));
@@ -2469,7 +2469,7 @@ static BOOL do_parameter_var(const char *pszParmName, const char *fmt, ...)
va_start(ap, fmt);
s = talloc_vasprintf(NULL, fmt, ap);
va_end(ap);
- ret = do_parameter(pszParmName, s);
+ ret = do_parameter(pszParmName, s, NULL);
talloc_free(s);
return ret;
}
@@ -2635,7 +2635,7 @@ static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
Returns True on success, False on failure.
***************************************************************************/
-static BOOL do_section(const char *pszSectionName)
+static BOOL do_section(const char *pszSectionName, void *userdata)
{
BOOL bRetval;
BOOL isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
@@ -3017,7 +3017,7 @@ BOOL lp_load(void)
/* We get sections first, so have to start 'behind' to make up */
iServiceIndex = -1;
- bRetval = pm_process(n2, do_section, do_parameter);
+ bRetval = pm_process(n2, do_section, do_parameter, NULL);
/* finish up the last section */
DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
@@ -3241,7 +3241,7 @@ void lp_remove_service(int snum)
void lp_copy_service(int snum, const char *new_name)
{
const char *oldname = lp_servicename(snum);
- do_section(new_name);
+ do_section(new_name, NULL);
if (snum >= 0) {
snum = lp_servicenumber(new_name);
if (snum >= 0)
diff --git a/source4/param/params.c b/source4/param/params.c
index d59e11a895..0ce416c00a 100644
--- a/source4/param/params.c
+++ b/source4/param/params.c
@@ -189,7 +189,7 @@ static int Continuation(char *line, int pos )
}
-static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
+static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *, void *), void *userdata )
/* ------------------------------------------------------------------------ **
* Scan a section name, and pass the name to function sfunc().
*
@@ -246,7 +246,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
DEBUG(0, ("%s Empty section name in configuration file.\n", func ));
return( False );
}
- if( !sfunc(InFile->bufr) ) /* Got a valid name. Deal with it. */
+ if( !sfunc(InFile->bufr,userdata) ) /* Got a valid name. Deal with it. */
return( False );
(void)EatComment( InFile ); /* Finish off the line. */
return( True );
@@ -285,7 +285,7 @@ static BOOL Section( myFILE *InFile, BOOL (*sfunc)(const char *) )
return( False );
} /* Section */
-static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *), int c )
+static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *, void *), int c, void *userdata )
/* ------------------------------------------------------------------------ **
* Scan a parameter name and value, and pass these two fields to pfunc().
*
@@ -429,12 +429,13 @@ static BOOL Parameter( myFILE *InFile, BOOL (*pfunc)(const char *, const char *)
}
InFile->bufr[end] = '\0'; /* End of value. */
- return( pfunc( InFile->bufr, &InFile->bufr[vstart] ) ); /* Pass name & value to pfunc(). */
+ return( pfunc( InFile->bufr, &InFile->bufr[vstart], userdata ) ); /* Pass name & value to pfunc(). */
} /* Parameter */
static BOOL Parse( myFILE *InFile,
- BOOL (*sfunc)(const char *),
- BOOL (*pfunc)(const char *, const char *) )
+ BOOL (*sfunc)(const char *, void *),
+ BOOL (*pfunc)(const char *, const char *, void *),
+ void *userdata )
/* ------------------------------------------------------------------------ **
* Scan & parse the input.
*
@@ -474,7 +475,7 @@ static BOOL Parse( myFILE *InFile,
break;
case '[': /* Section Header. */
- if( !Section( InFile, sfunc ) )
+ if( !Section( InFile, sfunc, userdata ) )
return( False );
c = EatWhitespace( InFile );
break;
@@ -484,7 +485,7 @@ static BOOL Parse( myFILE *InFile,
break;
default: /* Parameter line. */
- if( !Parameter( InFile, pfunc, c ) )
+ if( !Parameter( InFile, pfunc, c, userdata ) )
return( False );
c = EatWhitespace( InFile );
break;
@@ -527,8 +528,9 @@ static myFILE *OpenConfFile( const char *FileName )
} /* OpenConfFile */
BOOL pm_process( const char *FileName,
- BOOL (*sfunc)(const char *),
- BOOL (*pfunc)(const char *, const char *) )
+ BOOL (*sfunc)(const char *, void *),
+ BOOL (*pfunc)(const char *, const char *, void *),
+ void *userdata)
/* ------------------------------------------------------------------------ **
* Process the named parameter file.
*
@@ -554,7 +556,7 @@ BOOL pm_process( const char *FileName,
DEBUG( 3, ("%s Processing configuration file \"%s\"\n", func, FileName) );
if( NULL != InFile->bufr ) /* If we already have a buffer */
- result = Parse( InFile, sfunc, pfunc ); /* (recursive call), then just */
+ result = Parse( InFile, sfunc, pfunc, userdata ); /* (recursive call), then just */
/* use it. */
else /* If we don't have a buffer */
@@ -567,7 +569,7 @@ BOOL pm_process( const char *FileName,
myfile_close(InFile);
return( False );
}
- result = Parse( InFile, sfunc, pfunc );
+ result = Parse( InFile, sfunc, pfunc, userdata );
InFile->bufr = NULL;
InFile->bSize = 0;
}