[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Mon Aug 3 22:22:04 UTC 2020
The branch, master has been updated
via 23274717563 lib: relicense smb_strtoul(l) under LGPLv3
from 611e643d146 ldap_server: fix hurd build
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 23274717563b19684c52f8a909f528f608dafd7c
Author: Ralph Boehme <slow at samba.org>
Date: Fri Jul 3 08:11:20 2020 +0200
lib: relicense smb_strtoul(l) under LGPLv3
Signed-off-by: Ralph Boehme <slow at samba.org>
Reviewed-by: Swen Schillig <swen at linux.ibm.com>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Mon Aug 3 22:21:04 UTC 2020 on sn-devel-184
-----------------------------------------------------------------------
Summary of changes:
ctdb/protocol/protocol_util.c | 1 +
ctdb/server/ctdb_mutex_fcntl_helper.c | 1 +
ctdb/server/ctdb_recovery_helper.c | 1 +
ctdb/tests/src/cluster_mutex_test.c | 1 +
ctdb/tests/src/db_test_tool.c | 1 +
ctdb/tools/ctdb.c | 1 +
lib/ldb-samba/ldb_matching_rules.c | 1 +
lib/ldb-samba/ldif_handlers.c | 1 +
lib/messaging/messages_dgm.c | 1 +
lib/param/loadparm.c | 1 +
lib/util/access.c | 1 +
lib/util/asn1.c | 1 +
lib/util/smb_strtox.c | 177 +++++++++++++++++++++
lib/util/{tevent_req_profile.h => smb_strtox.h} | 34 ++--
lib/util/tests/util.c | 1 +
lib/util/util.c | 152 ------------------
lib/util/util.h | 13 --
lib/util/util_str.c | 1 +
lib/util/wscript_build | 7 +-
libcli/security/dom_sid.c | 1 +
nsswitch/libwbclient/wbc_idmap.c | 2 +-
nsswitch/libwbclient/wbc_sid.c | 2 +-
nsswitch/libwbclient/wscript | 2 +-
nsswitch/wbinfo.c | 1 +
source3/groupdb/mapping.c | 1 +
source3/groupdb/mapping_tdb.c | 1 +
source3/lib/interface.c | 1 +
source3/lib/namemap_cache.c | 1 +
source3/lib/sysquotas.c | 1 +
source3/lib/tldap_util.c | 1 +
source3/lib/util_str.c | 1 +
source3/modules/vfs_ceph_snapshots.c | 1 +
source3/modules/vfs_preopen.c | 1 +
source3/modules/vfs_snapper.c | 1 +
source3/modules/vfs_unityed_media.c | 1 +
source3/passdb/account_pol.c | 1 +
source3/passdb/pdb_ldap.c | 1 +
source3/passdb/pdb_tdb.c | 1 +
source3/rpc_server/mdssvc/es_parser.y | 1 +
source3/rpcclient/cmd_samr.c | 1 +
source3/rpcclient/cmd_spoolss.c | 1 +
source3/torture/test_readdir_timestamp.c | 1 +
source3/utils/net_idmap.c | 1 +
source3/utils/net_registry.c | 1 +
source3/utils/net_rpc_registry.c | 1 +
source3/utils/net_sam.c | 1 +
source3/utils/pdbedit.c | 1 +
source3/utils/regedit_dialog.c | 1 +
source3/winbindd/idmap_ldap.c | 1 +
source3/winbindd/winbindd_lookuprids.c | 1 +
source3/winbindd/winbindd_util.c | 1 +
source4/auth/gensec/gensec_gssapi.c | 1 +
source4/dns_server/dlz_bind9.c | 1 +
source4/dsdb/common/dsdb_dn.c | 1 +
source4/dsdb/common/util.c | 1 +
source4/dsdb/samdb/ldb_modules/dirsync.c | 1 +
.../dsdb/samdb/ldb_modules/partition_metadata.c | 1 +
source4/dsdb/samdb/ldb_modules/samldb.c | 1 +
source4/dsdb/samdb/ldb_modules/schema_load.c | 1 +
source4/dsdb/schema/schema_prefixmap.c | 1 +
source4/lib/registry/ldb.c | 1 +
source4/lib/socket/interface.c | 1 +
source4/libcli/resolve/dns_ex.c | 1 +
source4/nbt_server/wins/winsdb.c | 1 +
source4/rpc_server/lsa/dcesrv_lsa.c | 1 +
source4/torture/nbench/nbench.c | 1 +
source4/torture/smb2/sharemode.c | 1 +
67 files changed, 259 insertions(+), 189 deletions(-)
create mode 100644 lib/util/smb_strtox.c
copy lib/util/{tevent_req_profile.h => smb_strtox.h} (59%)
Changeset truncated at 500 lines:
diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c
index c67aa2e056f..2d0a6f33038 100644
--- a/ctdb/protocol/protocol_util.c
+++ b/ctdb/protocol/protocol_util.c
@@ -27,6 +27,7 @@
#include "protocol.h"
#include "protocol_util.h"
#include "lib/util/util.h"
+#include "lib/util/smb_strtox.h"
static struct {
enum ctdb_runstate runstate;
diff --git a/ctdb/server/ctdb_mutex_fcntl_helper.c b/ctdb/server/ctdb_mutex_fcntl_helper.c
index 51c46ce733f..87f5dc22c41 100644
--- a/ctdb/server/ctdb_mutex_fcntl_helper.c
+++ b/ctdb/server/ctdb_mutex_fcntl_helper.c
@@ -30,6 +30,7 @@
#include "lib/util/sys_rw.h"
#include "lib/util/tevent_unix.h"
#include "lib/util/util.h"
+#include "lib/util/smb_strtox.h"
/* protocol.h is just needed for ctdb_sock_addr, which is used in system.h */
#include "protocol/protocol.h"
diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c
index f10e60104ae..4ce10b528bf 100644
--- a/ctdb/server/ctdb_recovery_helper.c
+++ b/ctdb/server/ctdb_recovery_helper.c
@@ -32,6 +32,7 @@
#include "lib/util/time.h"
#include "lib/util/tevent_unix.h"
#include "lib/util/util.h"
+#include "lib/util/smb_strtox.h"
#include "protocol/protocol.h"
#include "protocol/protocol_api.h"
diff --git a/ctdb/tests/src/cluster_mutex_test.c b/ctdb/tests/src/cluster_mutex_test.c
index 34398a98ea9..3c045f3e807 100644
--- a/ctdb/tests/src/cluster_mutex_test.c
+++ b/ctdb/tests/src/cluster_mutex_test.c
@@ -27,6 +27,7 @@
#include <tevent.h>
#include "lib/util/util.h"
+#include "lib/util/smb_strtox.h"
/*
* ctdb_cluster_mutex.c is included below. This requires a few hacks...
diff --git a/ctdb/tests/src/db_test_tool.c b/ctdb/tests/src/db_test_tool.c
index fe0ab6c6e2a..7ac6b030740 100644
--- a/ctdb/tests/src/db_test_tool.c
+++ b/ctdb/tests/src/db_test_tool.c
@@ -34,6 +34,7 @@
#include "lib/util/debug.h"
#include "lib/util/sys_rw.h"
#include "lib/util/util.h"
+#include "lib/util/smb_strtox.h"
#include "lib/tdb_wrap/tdb_wrap.h"
#include "common/cmdline.h"
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 171069d7ebf..5209081f322 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -34,6 +34,7 @@
#include "lib/util/debug.h"
#include "lib/util/samba_util.h"
#include "lib/util/sys_rw.h"
+#include "lib/util/smb_strtox.h"
#include "common/db_hash.h"
#include "common/logging.h"
diff --git a/lib/ldb-samba/ldb_matching_rules.c b/lib/ldb-samba/ldb_matching_rules.c
index 4b357bb706a..13edb51daaa 100644
--- a/lib/ldb-samba/ldb_matching_rules.c
+++ b/lib/ldb-samba/ldb_matching_rules.c
@@ -27,6 +27,7 @@
#include "libcli/security/security.h"
#include "dsdb/common/util.h"
#include "librpc/gen_ndr/ndr_dnsp.h"
+#include "lib/util/smb_strtox.h"
static int ldb_eval_transitive_filter_helper(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb,
diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index e74a7182ecf..78a433748bb 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -36,6 +36,7 @@
#include "libcli/security/security.h"
#include "param/param.h"
#include "../lib/util/asn1.h"
+#include "lib/util/smb_strtox.h"
/*
use ndr_print_* to convert a NDR formatted blob to a ldif formatted blob
diff --git a/lib/messaging/messages_dgm.c b/lib/messaging/messages_dgm.c
index b7126b9c8ca..7c9dd8eb42f 100644
--- a/lib/messaging/messages_dgm.c
+++ b/lib/messaging/messages_dgm.c
@@ -32,6 +32,7 @@
#include "lib/util/iov_buf.h"
#include "lib/util/blocking.h"
#include "lib/util/tevent_unix.h"
+#include "lib/util/smb_strtox.h"
#define MESSAGING_DGM_FRAGMENT_LENGTH 1024
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index da639a8b0ff..dc22f646b3e 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -73,6 +73,7 @@
#include "lib/util/samba_util.h"
#include "libcli/auth/ntlm_check.h"
#include "lib/crypto/gnutls_helpers.h"
+#include "lib/util/smb_strtox.h"
#ifdef HAVE_HTTPCONNECTENCRYPT
#include <cups/http.h>
diff --git a/lib/util/access.c b/lib/util/access.c
index 10a14771899..e02117fa23e 100644
--- a/lib/util/access.c
+++ b/lib/util/access.c
@@ -21,6 +21,7 @@
#include "lib/util/memory.h"
#include "lib/util/access.h"
#include "lib/util/unix_match.h"
+#include "lib/util/smb_strtox.h"
#if defined(HAVE_NETGROUP)
#include "system/nis.h"
diff --git a/lib/util/asn1.c b/lib/util/asn1.c
index 88d96d4544b..0dfddc009c0 100644
--- a/lib/util/asn1.c
+++ b/lib/util/asn1.c
@@ -22,6 +22,7 @@
#include "lib/util/asn1.h"
#include "lib/util/debug.h"
#include "lib/util/samba_util.h"
+#include "lib/util/smb_strtox.h"
struct nesting {
off_t start;
diff --git a/lib/util/smb_strtox.c b/lib/util/smb_strtox.c
new file mode 100644
index 00000000000..2cace8b9aaf
--- /dev/null
+++ b/lib/util/smb_strtox.c
@@ -0,0 +1,177 @@
+/*
+ * Unix SMB/CIFS implementation.
+ *
+ * Copyright (C) Swen Schillig 2019
+ *
+ * ** NOTE! The following LGPL license applies to the tevent
+ * ** library. This does NOT imply that all of Samba is released
+ * ** under the LGPL
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "replace.h"
+#include "smb_strtox.h"
+
+/**
+ * Convert a string to an unsigned long integer
+ *
+ * @param nptr pointer to string which is to be converted
+ * @param endptr [optional] reference to remainder of the string
+ * @param base base of the numbering scheme
+ * @param err error occured during conversion
+ * @flags controlling conversion feature
+ * @result result of the conversion as provided by strtoul
+ *
+ * The following flags are supported
+ * SMB_STR_STANDARD # raise error if negative or non-numeric
+ * SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
+ * SMB_STR_FULL_STR_CONV # entire string must be converted
+ * SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
+ * SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul
+ *
+ * The following errors are detected
+ * - wrong base
+ * - value overflow
+ * - string with a leading "-" indicating a negative number
+ * - no conversion due to empty string or not representing a number
+ */
+unsigned long int
+smb_strtoul(const char *nptr, char **endptr, int base, int *err, int flags)
+{
+ unsigned long int val;
+ int saved_errno = errno;
+ char *needle = NULL;
+ char *tmp_endptr = NULL;
+
+ errno = 0;
+ *err = 0;
+
+ val = strtoul(nptr, &tmp_endptr, base);
+
+ if (endptr != NULL) {
+ *endptr = tmp_endptr;
+ }
+
+ if (errno != 0) {
+ *err = errno;
+ errno = saved_errno;
+ return val;
+ }
+
+ if ((flags & SMB_STR_ALLOW_NO_CONVERSION) == 0) {
+ /* got an invalid number-string resulting in no conversion */
+ if (nptr == tmp_endptr) {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+ if ((flags & SMB_STR_ALLOW_NEGATIVE ) == 0) {
+ /* did we convert a negative "number" ? */
+ needle = strchr(nptr, '-');
+ if (needle != NULL && needle < tmp_endptr) {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+ if ((flags & SMB_STR_FULL_STR_CONV) != 0) {
+ /* did we convert the entire string ? */
+ if (tmp_endptr[0] != '\0') {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+out:
+ errno = saved_errno;
+ return val;
+}
+
+/**
+ * Convert a string to an unsigned long long integer
+ *
+ * @param nptr pointer to string which is to be converted
+ * @param endptr [optional] reference to remainder of the string
+ * @param base base of the numbering scheme
+ * @param err error occured during conversion
+ * @flags controlling conversion feature
+ * @result result of the conversion as provided by strtoull
+ *
+ * The following flags are supported
+ * SMB_STR_STANDARD # raise error if negative or non-numeric
+ * SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
+ * SMB_STR_FULL_STR_CONV # entire string must be converted
+ * SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
+ * SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul
+ *
+ * The following errors are detected
+ * - wrong base
+ * - value overflow
+ * - string with a leading "-" indicating a negative number
+ * - no conversion due to empty string or not representing a number
+ */
+unsigned long long int
+smb_strtoull(const char *nptr, char **endptr, int base, int *err, int flags)
+{
+ unsigned long long int val;
+ int saved_errno = errno;
+ char *needle = NULL;
+ char *tmp_endptr = NULL;
+
+ errno = 0;
+ *err = 0;
+
+ val = strtoull(nptr, &tmp_endptr, base);
+
+ if (endptr != NULL) {
+ *endptr = tmp_endptr;
+ }
+
+ if (errno != 0) {
+ *err = errno;
+ errno = saved_errno;
+ return val;
+ }
+
+ if ((flags & SMB_STR_ALLOW_NO_CONVERSION) == 0) {
+ /* got an invalid number-string resulting in no conversion */
+ if (nptr == tmp_endptr) {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+ if ((flags & SMB_STR_ALLOW_NEGATIVE ) == 0) {
+ /* did we convert a negative "number" ? */
+ needle = strchr(nptr, '-');
+ if (needle != NULL && needle < tmp_endptr) {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+ if ((flags & SMB_STR_FULL_STR_CONV) != 0) {
+ /* did we convert the entire string ? */
+ if (tmp_endptr[0] != '\0') {
+ *err = EINVAL;
+ goto out;
+ }
+ }
+
+out:
+ errno = saved_errno;
+ return val;
+}
diff --git a/lib/util/tevent_req_profile.h b/lib/util/smb_strtox.h
similarity index 59%
copy from lib/util/tevent_req_profile.h
copy to lib/util/smb_strtox.h
index 3bcdbc1a289..f72bf123823 100644
--- a/lib/util/tevent_req_profile.h
+++ b/lib/util/smb_strtox.h
@@ -1,9 +1,7 @@
/*
* Unix SMB/CIFS implementation.
*
- * Helpers around tevent_req_profile
- *
- * Copyright (C) Volker Lendecke 2018
+ * Copyright (C) Swen Schillig 2019
*
* ** NOTE! The following LGPL license applies to the tevent
* ** library. This does NOT imply that all of Samba is released
@@ -23,24 +21,20 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __LIB_UTIL_TEVENT_REQ_PROFILE_UNPACK
-#define __LIB_UTIL_TEVENT_REQ_PROFILE_UNPACK
+#ifndef SMB_STRTOX_H
+#define SMB_STRTOX_H
+
+#define SMB_STR_STANDARD 0x00
+#define SMB_STR_ALLOW_NEGATIVE 0x01
+#define SMB_STR_FULL_STR_CONV 0x02
+#define SMB_STR_ALLOW_NO_CONVERSION 0x04
+#define SMB_STR_GLIBC_STANDARD (SMB_STR_ALLOW_NO_CONVERSION | \
+ SMB_STR_ALLOW_NEGATIVE)
-#include "replace.h"
-#include <tevent.h>
+unsigned long int
+smb_strtoul(const char *nptr, char **endptr, int base, int *err, int flags);
-char *tevent_req_profile_string(TALLOC_CTX *mem_ctx,
- const struct tevent_req_profile *profile,
- unsigned indent,
- unsigned max_indent);
-ssize_t tevent_req_profile_pack(
- const struct tevent_req_profile *profile,
- uint8_t *buf,
- size_t buflen);
-ssize_t tevent_req_profile_unpack(
- const uint8_t *buf,
- size_t buflen,
- TALLOC_CTX *mem_ctx,
- struct tevent_req_profile **p_profile);
+unsigned long long int
+smb_strtoull(const char *nptr, char **endptr, int base, int *err, int flags);
#endif
diff --git a/lib/util/tests/util.c b/lib/util/tests/util.c
index 4876144bcdc..03f62974c3f 100644
--- a/lib/util/tests/util.c
+++ b/lib/util/tests/util.c
@@ -30,6 +30,7 @@
#include "torture/local/proto.h"
#include "lib/util/samba_util.h"
+#include "lib/util/smb_strtox.h"
#include "limits.h"
#include "string.h"
diff --git a/lib/util/util.c b/lib/util/util.c
index a90d48f6f1b..1f37688cbad 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -52,158 +52,6 @@
* @brief Misc utility functions
*/
-/**
- * Convert a string to an unsigned long integer
- *
- * @param nptr pointer to string which is to be converted
- * @param endptr [optional] reference to remainder of the string
- * @param base base of the numbering scheme
- * @param err error occured during conversion
- * @flags controlling conversion feature
- * @result result of the conversion as provided by strtoul
- *
- * The following flags are supported
- * SMB_STR_STANDARD # raise error if negative or non-numeric
- * SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
- * SMB_STR_FULL_STR_CONV # entire string must be converted
- * SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
- * SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul
- *
- * The following errors are detected
- * - wrong base
- * - value overflow
- * - string with a leading "-" indicating a negative number
- * - no conversion due to empty string or not representing a number
- */
-unsigned long int
-smb_strtoul(const char *nptr, char **endptr, int base, int *err, int flags)
-{
- unsigned long int val;
- int saved_errno = errno;
- char *needle = NULL;
- char *tmp_endptr = NULL;
-
- errno = 0;
- *err = 0;
-
- val = strtoul(nptr, &tmp_endptr, base);
-
- if (endptr != NULL) {
- *endptr = tmp_endptr;
- }
-
- if (errno != 0) {
- *err = errno;
- errno = saved_errno;
- return val;
- }
-
- if ((flags & SMB_STR_ALLOW_NO_CONVERSION) == 0) {
- /* got an invalid number-string resulting in no conversion */
- if (nptr == tmp_endptr) {
- *err = EINVAL;
- goto out;
- }
- }
-
- if ((flags & SMB_STR_ALLOW_NEGATIVE ) == 0) {
- /* did we convert a negative "number" ? */
- needle = strchr(nptr, '-');
- if (needle != NULL && needle < tmp_endptr) {
- *err = EINVAL;
- goto out;
- }
- }
-
- if ((flags & SMB_STR_FULL_STR_CONV) != 0) {
- /* did we convert the entire string ? */
- if (tmp_endptr[0] != '\0') {
- *err = EINVAL;
- goto out;
- }
- }
-
-out:
- errno = saved_errno;
- return val;
-}
-
-/**
- * Convert a string to an unsigned long long integer
- *
- * @param nptr pointer to string which is to be converted
- * @param endptr [optional] reference to remainder of the string
- * @param base base of the numbering scheme
- * @param err error occured during conversion
- * @flags controlling conversion feature
- * @result result of the conversion as provided by strtoull
- *
- * The following flags are supported
- * SMB_STR_STANDARD # raise error if negative or non-numeric
- * SMB_STR_ALLOW_NEGATIVE # allow strings with a leading "-"
- * SMB_STR_FULL_STR_CONV # entire string must be converted
- * SMB_STR_ALLOW_NO_CONVERSION # allow empty strings or non-numeric
- * SMB_STR_GLIBC_STANDARD # act exactly as the standard glibc strtoul
- *
- * The following errors are detected
- * - wrong base
- * - value overflow
- * - string with a leading "-" indicating a negative number
--
Samba Shared Repository
More information about the samba-cvs
mailing list