[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Thu Aug 14 15:53:04 MDT 2014
The branch, master has been updated
via c134f02 Remove iniparser.
via dd383d4 Remove popt/iniparser from .clang_complete
via a4fa658 Don't build iniparser anymore.
via 8bbf901 Replace all uses of iniparser with tiniparser.
via 51bea0b Add tiniparser - tiny version of iniparser that only implements what Samba uses.
via ed66a98 Use tini in preference.
via 63acc8e Add tini parser.
from c6d0e8d ctdb-readonly: Do not abort if revoke of readonly record fails on a node
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c134f02d4c4d5af9c54fc2b8ac6bea2809d1d3a4
Author: Jeremy Allison <jra at samba.org>
Date: Wed Aug 13 16:41:33 2014 -0700
Remove iniparser.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Thu Aug 14 23:52:07 CEST 2014 on sn-devel-104
commit dd383d4106e70d8015db1ac2a7ca5ce1309ffaae
Author: Jeremy Allison <jra at samba.org>
Date: Thu Aug 14 18:12:30 2014 +0000
Remove popt/iniparser from .clang_complete
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit a4fa65811d3a3c4626655b1c14313e43fe6c5768
Author: Jeremy Allison <jra at samba.org>
Date: Wed Aug 13 16:40:40 2014 -0700
Don't build iniparser anymore.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 8bbf901f9349e9b33caa24fd2a2333c060952646
Author: Jeremy Allison <jra at samba.org>
Date: Wed Aug 13 16:36:28 2014 -0700
Replace all uses of iniparser with tiniparser.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 51bea0b767b4f1e76a7008604f4dd0788a5edeb2
Author: Jeremy Allison <jra at samba.org>
Date: Wed Aug 13 16:00:00 2014 -0700
Add tiniparser - tiny version of iniparser that only implements what Samba uses.
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit ed66a984bf57d2f8a5bab86cd3c73e2430e301ef
Author: Volker Lendecke <vl at samba.org>
Date: Wed Aug 13 07:24:21 2014 +0200
Use tini in preference.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 63acc8e81082e7c90e84af3264a0a89e338b58a2
Author: Volker Lendecke <vl at samba.org>
Date: Tue Aug 12 13:02:35 2014 +0200
Add tini parser.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
buildtools/wafsamba/samba3.py | 6 -
buildtools/wafsamba/samba_third_party.py | 6 -
lib/util/params.c | 28 +
lib/util/tini.c | 298 +++++++++++
lib/util/tini.h | 44 ++
lib/util/tiniparser.c | 380 ++++++++++++++
lib/util/tiniparser.h | 55 ++
lib/util/wscript_build | 12 +-
nsswitch/pam_winbind.c | 44 +-
nsswitch/pam_winbind.h | 5 +-
nsswitch/wscript_build | 2 +-
source3/.clang_complete | 2 -
source3/utils/ntlm_auth.c | 10 +-
source3/wscript_build | 2 +-
third_party/iniparser/AUTHORS | 5 -
third_party/iniparser/INSTALL | 12 -
third_party/iniparser/LICENSE | 21 -
third_party/iniparser/Makefile | 63 ---
third_party/iniparser/README | 11 -
third_party/iniparser/html/doxygen.css | 358 -------------
third_party/iniparser/html/doxygen.png | Bin 1281 -> 0 bytes
third_party/iniparser/html/globals_func.html | 54 --
third_party/iniparser/html/index.html | 156 ------
third_party/iniparser/html/iniparser_8h.html | 629 -----------------------
third_party/iniparser/html/iniparser_8main.html | 19 -
third_party/iniparser/html/tab_b.gif | Bin 35 -> 0 bytes
third_party/iniparser/html/tab_l.gif | Bin 706 -> 0 bytes
third_party/iniparser/html/tab_r.gif | Bin 2585 -> 0 bytes
third_party/iniparser/html/tabs.css | 102 ----
third_party/iniparser/src/dictionary.c | 514 ------------------
third_party/iniparser/src/dictionary.h | 244 ---------
third_party/iniparser/src/iniparser.c | 538 -------------------
third_party/iniparser/src/iniparser.h | 296 -----------
third_party/iniparser/src/strlib.c | 211 --------
third_party/iniparser/src/strlib.h | 108 ----
third_party/iniparser/src/wscript | 21 -
third_party/iniparser/test/Makefile | 24 -
third_party/iniparser/test/iniexample.c | 117 -----
third_party/iniparser_build/dictionary.c | 7 -
third_party/iniparser_build/iniparser.c | 7 -
third_party/iniparser_build/strlib.c | 7 -
wscript | 6 -
wscript_build | 1 -
43 files changed, 849 insertions(+), 3576 deletions(-)
create mode 100644 lib/util/tini.c
create mode 100644 lib/util/tini.h
create mode 100644 lib/util/tiniparser.c
create mode 100644 lib/util/tiniparser.h
delete mode 100644 third_party/iniparser/AUTHORS
delete mode 100644 third_party/iniparser/INSTALL
delete mode 100644 third_party/iniparser/LICENSE
delete mode 100644 third_party/iniparser/Makefile
delete mode 100644 third_party/iniparser/README
delete mode 100644 third_party/iniparser/html/doxygen.css
delete mode 100644 third_party/iniparser/html/doxygen.png
delete mode 100644 third_party/iniparser/html/globals_func.html
delete mode 100644 third_party/iniparser/html/index.html
delete mode 100644 third_party/iniparser/html/iniparser_8h.html
delete mode 100644 third_party/iniparser/html/iniparser_8main.html
delete mode 100644 third_party/iniparser/html/tab_b.gif
delete mode 100644 third_party/iniparser/html/tab_l.gif
delete mode 100644 third_party/iniparser/html/tab_r.gif
delete mode 100644 third_party/iniparser/html/tabs.css
delete mode 100644 third_party/iniparser/src/dictionary.c
delete mode 100644 third_party/iniparser/src/dictionary.h
delete mode 100644 third_party/iniparser/src/iniparser.c
delete mode 100644 third_party/iniparser/src/iniparser.h
delete mode 100644 third_party/iniparser/src/strlib.c
delete mode 100644 third_party/iniparser/src/strlib.h
delete mode 100644 third_party/iniparser/src/wscript
delete mode 100644 third_party/iniparser/test/Makefile
delete mode 100644 third_party/iniparser/test/iniexample.c
delete mode 100644 third_party/iniparser_build/dictionary.c
delete mode 100644 third_party/iniparser_build/iniparser.c
delete mode 100644 third_party/iniparser_build/strlib.c
Changeset truncated at 500 lines:
diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index fd063ad..64cd8c7 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -94,12 +94,6 @@ def s3_fix_kwargs(bld, kwargs):
else:
extra_includes += [ '../lib/popt' ]
- if bld.CONFIG_SET('USING_SYSTEM_INIPARSER'):
- (iniparser_includes, iniparser_ldflags, iniparser_cpppath) = library_flags(bld, 'iniparser')
- extra_includes += iniparser_cpppath
- else:
- extra_includes += [ '../lib/iniparser' ]
-
# s3 builds assume that they will have a bunch of extra include paths
includes = []
for d in extra_includes:
diff --git a/buildtools/wafsamba/samba_third_party.py b/buildtools/wafsamba/samba_third_party.py
index 408d557..36b98cb 100644
--- a/buildtools/wafsamba/samba_third_party.py
+++ b/buildtools/wafsamba/samba_third_party.py
@@ -11,12 +11,6 @@ def CHECK_FOR_THIRD_PARTY(conf):
Build.BuildContext.CHECK_FOR_THIRD_PARTY = CHECK_FOR_THIRD_PARTY
@conf
-def CHECK_INIPARSER(conf):
- return conf.CHECK_BUNDLED_SYSTEM('iniparser', checkfunctions='iniparser_load', headers='iniparser.h')
-
-Build.BuildContext.CHECK_INIPARSER = CHECK_INIPARSER
-
- at conf
def CHECK_ZLIB(conf):
version_check='''
#if (ZLIB_VERNUM >= 0x1230)
diff --git a/lib/util/params.c b/lib/util/params.c
index 3f1d535..82c6e89 100644
--- a/lib/util/params.c
+++ b/lib/util/params.c
@@ -80,6 +80,7 @@
#include "includes.h"
#include "system/locale.h"
+#include "tini.h"
/* -------------------------------------------------------------------------- **
* Constants...
@@ -521,6 +522,8 @@ static myFILE *OpenConfFile(TALLOC_CTX *mem_ctx, const char *FileName )
return( ret );
} /* OpenConfFile */
+#if 0
+
bool pm_process( const char *FileName,
bool (*sfunc)(const char *, void *),
bool (*pfunc)(const char *, const char *, void *),
@@ -579,4 +582,29 @@ bool pm_process( const char *FileName,
return( true ); /* Generic success. */
} /* pm_process */
+#else
+
/* -------------------------------------------------------------------------- */
+
+bool pm_process(const char *filename,
+ bool (*sfunc)(const char *section, void *private_data),
+ bool (*pfunc)(const char *name, const char *value,
+ void *private_data),
+ void *private_data)
+{
+ FILE *f;
+ bool ret;
+
+ f = fopen(filename, "r");
+ if (f == NULL) {
+ return false;
+ }
+
+ ret = tini_parse(f, sfunc, pfunc, private_data);
+
+ fclose(f);
+
+ return ret;
+}
+
+#endif
diff --git a/lib/util/tini.c b/lib/util/tini.c
new file mode 100644
index 0000000..6cd301a
--- /dev/null
+++ b/lib/util/tini.c
@@ -0,0 +1,298 @@
+/*
+ * Trivial smb.conf parsing code
+ *
+ * Copyright Volker Lendecke <vl at samba.org> 2014
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, and the entire permission notice in its entirety,
+ * including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License Version 3 or later, in which case the
+ * provisions of the GPL are required INSTEAD OF the above restrictions.
+ * (This clause is necessary due to a potential bad interaction between the
+ * GPL and the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include "tini.h"
+
+static int next_content(FILE *f)
+{
+ int c;
+
+ for (c = fgetc(f); c != EOF; c = fgetc(f)) {
+ if (!isspace(c)) {
+ break;
+ }
+ if (c == '\n') {
+ break;
+ }
+ }
+
+ return c;
+}
+
+static int next_end_of_line(FILE *f)
+{
+ int c;
+
+ for (c = fgetc(f); c != EOF; c = fgetc(f)) {
+ if (c == '\n') {
+ break;
+ }
+ }
+ return c;
+}
+
+static bool make_space(char **buf, size_t *buflen, size_t position)
+{
+ char *tmp;
+
+ if (position < *buflen) {
+ return true;
+ }
+ tmp = realloc(*buf, (*buflen) * 2);
+ if (tmp == NULL) {
+ return false;
+ }
+ *buf = tmp;
+ *buflen *= 2;
+ return true;
+}
+
+/*
+ * Get a conf line into *pbuf (which must be a malloc'ed buffer already).
+ *
+ * Ignores leading spaces
+ * Ignores comment lines
+ * Ignores empty lines
+ * Takes care of continuation lines
+ * Zaps multiple spaces into one
+ */
+
+static int get_line(FILE *f, char **pbuf, size_t *pbuflen)
+{
+ int c;
+ char *buf;
+ size_t buflen, pos;
+
+ buf = *pbuf;
+ buflen = *pbuflen;
+ pos = 0;
+
+next_line:
+
+ c = next_content(f);
+ if (c == EOF) {
+ return ENOENT;
+ }
+
+ if ((c == '#') || (c == ';')) {
+ /*
+ * Line starting with a comment, skip
+ */
+ c = next_end_of_line(f);
+ if (c == EOF) {
+ return ENOENT;
+ }
+ goto next_line;
+ }
+
+ if (c == '\n') {
+ /*
+ * Blank line, skip
+ */
+ goto next_line;
+ }
+
+ for ( ; c != EOF ; c = fgetc(f)) {
+
+ if (c == '\n') {
+
+ if ((pos > 0) && (buf[pos-1] == '\\')) {
+ /*
+ * Line ends in "\". Continuation.
+ */
+ pos -= 1;
+ continue;
+ }
+
+ if ((pos > 1) && (buf[pos-2] == '\\') &&
+ isspace(buf[pos-1])) {
+ /*
+ * Line ends in "\ ". Mind that we zap
+ * multiple spaces into one. Continuation.
+ */
+ pos -= 2;
+ continue;
+ }
+
+ /*
+ * No continuation, done with the line
+ */
+ break;
+ }
+
+ if ((pos > 0) && isspace(buf[pos-1]) && isspace(c)) {
+ /*
+ * Zap multiple spaces to one
+ */
+ continue;
+ }
+
+ if (!make_space(&buf, &buflen, pos)) {
+ return ENOMEM;
+ }
+ buf[pos++] = c;
+ }
+
+ if (!make_space(&buf, &buflen, pos)) {
+ return ENOMEM;
+ }
+ buf[pos++] = '\0';
+
+ *pbuf = buf;
+ return 0;
+}
+
+static bool parse_section(
+ char *buf, bool (*sfunc)(const char *section, void *private_data),
+ void *private_data)
+{
+ char *p, *q;
+
+ p = buf+1; /* skip [ */
+
+ q = strchr(p, ']');
+ if (q == NULL) {
+ return false;
+ }
+ *q = '\0';
+
+ return sfunc(p, private_data);
+}
+
+static char *trim_one_space(char *buf)
+{
+ size_t len;
+
+ if (isspace(buf[0])) {
+ buf += 1;
+ }
+ len = strlen(buf);
+ if (len == 0) {
+ return buf;
+ }
+ if (isspace(buf[len-1])) {
+ buf[len-1] = '\0';
+ }
+
+ return buf;
+}
+
+static bool parse_param(char *buf,
+ bool (*pfunc)(const char *name, const char *value,
+ void *private_data),
+ void *private_data)
+{
+ char *equals;
+ char *name, *value;
+ size_t len;
+
+ equals = strchr(buf, '=');
+ if (equals == NULL) {
+ return true;
+ }
+ *equals = '\0';
+
+ name = trim_one_space(buf);
+ len = strlen(buf);
+ if (len == 0) {
+ return false;
+ }
+
+ value = trim_one_space(equals+1);
+
+ return pfunc(name, value, private_data);
+}
+
+bool tini_parse(FILE *f,
+ bool (*sfunc)(const char *section, void *private_data),
+ bool (*pfunc)(const char *name, const char *value,
+ void *private_data),
+ void *private_data)
+{
+ char *buf;
+ size_t buflen;
+
+ buflen = 256;
+
+ buf = malloc(buflen);
+ if (buf == NULL) {
+ return false;
+ }
+
+ while (true) {
+ int ret;
+ bool ok;
+
+ ret = get_line(f, &buf, &buflen);
+
+ if (ret == ENOENT) {
+ /* No lines anymore */
+ break;
+ }
+
+ if (ret != 0) {
+ /* Real error */
+ free(buf);
+ return false;
+ }
+
+ switch(buf[0]) {
+ case 0:
+ continue;
+ break;
+ case '[':
+ ok = parse_section(buf, sfunc, private_data);
+ break;
+ default:
+ ok = parse_param(buf, pfunc, private_data);
+ break;
+ }
+
+ if (!ok) {
+ free(buf);
+ return false;
+ }
+ }
+ free(buf);
+ return true;
+}
diff --git a/lib/util/tini.h b/lib/util/tini.h
new file mode 100644
index 0000000..02cc1ac
--- /dev/null
+++ b/lib/util/tini.h
@@ -0,0 +1,44 @@
+/*
+ * Trivial smb.conf parsing code
+ *
+ * Copyright Volker Lendecke <vl at samba.org> 2014
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, and the entire permission notice in its entirety,
+ * including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License, in which case the provisions of the GPL are
+ * required INSTEAD OF the above restrictions. (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+
+bool tini_parse(FILE *f,
+ bool (*sfunc)(const char *section, void *private_data),
+ bool (*pfunc)(const char *name, const char *value,
+ void *private_data),
+ void *private_data);
diff --git a/lib/util/tiniparser.c b/lib/util/tiniparser.c
new file mode 100644
index 0000000..7c10616
--- /dev/null
+++ b/lib/util/tiniparser.c
@@ -0,0 +1,380 @@
+/*
+ * Trivial smb.conf parsing code
+ * iniparser compatibility layer.
+ *
+ * Copyright Jeremy Allison <jra at samba.org> 2014
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, and the entire permission notice in its entirety,
+ * including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * ALTERNATIVELY, this product may be distributed under the terms of
+ * the GNU Public License Version 3 or later, in which case the provisions
+ * of the GPL are required INSTEAD OF the above restrictions. (This clause is
+ * necessary due to a potential bad interaction between the GPL and
+ * the restrictions contained in a BSD-style copyright.)
+ *
+ * THIS SOFTWARE IS PROVIDED `AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <stddef.h>
+#include "tini.h"
+#include "tiniparser.h"
+
+struct tiniparser_entry {
+ struct tiniparser_entry *next_entry;
+ char *key;
+ char *value;
+};
+
+struct tiniparser_section {
--
Samba Shared Repository
More information about the samba-cvs
mailing list