1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

445 Commits

Author SHA1 Message Date
Andrew Tridgell
00649a9c62 build: updated configure checks or new syntax 2010-04-06 20:27:00 +10:00
Andrew Tridgell
81d155af96 build: check libc first for several libraries 2010-04-06 20:26:56 +10:00
Andrew Tridgell
845e0cbe6f build: commit all the waf build files in the tree 2010-04-06 20:26:48 +10:00
Andrew Tridgell
aaa4c4b083 build: added statvfs64 test 2010-04-06 20:26:46 +10:00
Andrew Tridgell
2ea4fd6633 build: iconv checks 2010-04-06 20:26:45 +10:00
Andrew Tridgell
ae1c2b9022 build: check for xattr support 2010-04-06 20:26:45 +10:00
Andrew Tridgell
165b5b660a build: move gettimeofday check to libreplace
- add checklink option to CHECK_FUNC()
- Used for when a prototype is not available
2010-04-06 20:26:44 +10:00
Andrew Tridgell
d40b396ad8 build: added interface checking and nicer snprintf checking
use CHECK_CODE()
2010-04-06 20:26:43 +10:00
Andrew Tridgell
2dfced59d5 build: added CHECK_CODE_COMPILES() 2010-04-06 20:26:43 +10:00
Andrew Tridgell
20f4919467 build: check xattr and frsize 2010-04-06 20:26:43 +10:00
Andrew Tridgell
d5560482ea build: check signal functions 2010-04-06 20:26:42 +10:00
Andrew Tridgell
8112b4007d build: backtrace and crypt tests 2010-04-06 20:26:42 +10:00
Andrew Tridgell
cbb3c6eece build: check for backtrace 2010-04-06 20:26:42 +10:00
Andrew Tridgell
b81100c710 debug: enable talloc logging
we want to ensure talloc warnings are printed in the log
2010-04-02 18:52:29 +11:00
Andrew Tridgell
0f113faea8 charset: look for the codepages in the right place
selftest runs from source3/source4. The codepages when not installed
are in ../codepages
2010-03-30 12:31:03 +11:00
Andreas Schneider
a6f25fc635 s3-smbd: Don't close stdout if we want to log to stdout. 2010-03-26 14:48:54 +01:00
Andrew Tridgell
525a4fb2c4 util: on FreeBSD true is in /usr/bin. Use execvp to find it 2010-03-26 19:03:22 +11:00
Andrew Tridgell
fae84f98e3 libutil: moved the networking defines to util_net.h
These were causing thousands of warnings on solaris8
2010-03-26 17:36:02 +11:00
Matthias Dieter Wallnöfer
31b4585489 convert_string_talloc_convenience - print out the input buffer in a better way (using dump_data since it isn't always directly readable) 2010-03-22 23:21:17 +01:00
Stefan Metzmacher
01f2c023f7 lib/util: add allocate_anonymous_shared()
metze
2010-03-22 17:15:10 +01:00
Volker Lendecke
56940a28ff Fix an uninitialized variable 2010-03-21 21:01:28 +01:00
Volker Lendecke
d097d9fb09 Use TALLOC_FREE in talloc_pop() 2010-03-21 17:12:23 +01:00
Volker Lendecke
0f3040a61f Use calloc instead of ZERO_STRUCTP in talloc_stackframe_create() 2010-03-21 17:12:23 +01:00
Volker Lendecke
6695b0e87d Trim an overlong line 2010-03-21 17:12:23 +01:00
Andrew Tridgell
55c45110e6 charset: fixed a problem with the global use of the iconv_convenience structure
We had a crash bug where a cached copy of a iconv convenience pointer
was used after being freed when loadparm asked for iconv to
reload. This could happen if a python module used a iconv based
function before loadparm was completed.

The fix is to ensure that any use of this pointer remains valid, by
reusing the pointer itself when it has already been initialised, but
filling in the child elements with the updated values.
2010-03-18 14:18:41 +11:00
Stefan Metzmacher
d23581b4d7 talloc_stack: reset stackframe pointers to NULL
This makes it easier to debug the code in future.

metze
2010-03-15 15:08:24 +01:00
Stefan Metzmacher
10ed809a1a talloc_stack: make sure we never let talloc_tos() return ts->talloc_stack[-1]
In smbd there's a small gab between TALLOC_FREE(frame); before
be call smbd_parent_loop() where we don't have a valid talloc stackframe.

smbd_parent_loop() calls talloc_stackframe() only within the while(1) loop.
As DEBUG(2,("waiting for connections")) uses talloc_tos() to construct
the time header for the debug message we crash on some systems.

metze
2010-03-15 15:08:23 +01:00
Andrew Bartlett
6441a5b0b9 Explain why we don't use certain characters in the generated pw 2010-03-11 15:34:01 +11:00
Endi S. Dewata
a6253a45c0 lib/util - Removed curly braces from generate_random_password(). 2010-03-11 15:31:08 +11:00
Andrew Bartlett
4ab3e220c4 Move prototype to header of common code for set_sockaddr_port 2010-03-11 11:27:47 +11:00
Stefan Metzmacher
6ea3393798 lib/util: change samba_runcmd() to use tevent_req _send/_recv
metze
2010-03-09 21:49:45 +11:00
Andrew Tridgell
ee4ae0e7ad s4-privs: add root_privileges_original_uid()
This can be used to get the uid we changed away from when we gained 
root privileges

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-03-05 23:07:31 +11:00
Stefan Metzmacher
792dd38d7c lib/util: add generate_random_password()
metze
2010-02-26 08:57:28 +01:00
Andrew Tridgell
b0b857d6ca s4-dns: use a loadparm list for samba_runcmd() commands
This allows commands with multiple arguments and quoting to be used,
while still avoiding running a shell (and this having shell expansion
problems)
2010-02-26 18:19:27 +11:00
Andreas Schneider
8ac0c9fc67 libutil: Remove obsolete signal type cast. 2010-02-23 12:23:44 +01:00
Brad Hards
dd89dc2c31 Spelling fixes for libutil
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-22 21:45:35 +01:00
Andrew Tridgell
8756e13009 util: added samba_runcmd()
This allows us to run a child command in an async fashion, with
control over logging of stdout and stderr (which appears in the Samba
log file). This is useful for ensuring we don't miss important
messages from rndc commands (for example).

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-17 19:43:32 +11:00
Andrew Tridgell
0bedb9cf5e s4-dsdb: removed gendb_search_single_extended_dn()
Use dsdb_search_one() instead, which allows for arbitrary controls

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-16 21:10:51 +11:00
Andrew Tridgell
76a7382346 lib: use TYPESAFE_QSORT() in lib/ and libcli/ 2010-02-14 18:44:20 +11:00
Andrew Tridgell
282cc79454 s4-ldb: use TYPESAFE_QSORT() in the rest of the ldb code 2010-02-14 18:44:20 +11:00
Volker Lendecke
e371317686 use ZERO_STRUCT 2010-02-13 13:25:32 +01:00
Volker Lendecke
95ca53f3e0 Use ZERO_STRUCTP 2010-02-13 13:25:17 +01:00
Volker Lendecke
1a995ab51e s3: Fix a typo 2010-02-13 13:25:03 +01:00
Andrew Tridgell
63844609da util: added TYPESAFE_QSORT() macro
This makes it much harder to get the type of a qsort comparison
function wrong.
2010-02-13 22:36:11 +11:00
Volker Lendecke
ebc08b9938 s3: Add tdb_data_equal 2010-02-12 23:12:10 +01:00
Andrew Tridgell
ae95d611b6 util: added file_compare() utility function
file_compare() returns true if two files are the same. It is meant for
small files.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-02-11 21:04:13 +11:00
Andrew Tridgell
91cb7b7c60 test:local added LOCAL-DLINKLIST testsuite
(cherry picked from commit 95a5bee2c30a67a35604b0456ab7836f6dc67702)
2010-02-10 15:55:34 -08:00
Andrew Tridgell
32809bd8c1 util: rewrite dlinklist.h so that DLIST_ADD_END() is O(1)
This changes the meaning of the ->prev pointer in our doubly linked
lists to point at the end of the list from the front of the list. That
allows us to implement DLIST_ADD_END() and related functions in O(1)
time, which can be a huge saving in many places in Samba.

This also means that the 'type' argument to various DLIST_*() macros
is no longer needed, but I have left it in for now to keep the
patchset small, which will make it easier to revert if any problems
are found. In the future we should remove the 'type' arguments.

(jra. Move the one use of DLIST_TAIL over to the new macros).
2010-02-10 15:53:58 -08:00
Jeremy Allison
32575ed70f Temporary changes to dlinklist to keep the implementation static whilst
uses of (list)->prev are moved over to DLIST_PREV. This will be replaced
when the final (new) version of the dlinklist.h header is added.

Jeremy.
2010-02-10 15:30:59 -08:00
Matthias Dieter Wallnöfer
16aa0744c6 s4:UID wrapper - Fix includes
The includes of the UID wrapper headers werent't really efficient according
to metze's post on the technical mailing list (http://lists.samba.org/archive/samba-technical/2010-February/069165.html).
To achieve this move the "uid_wrapper.h" includes into "lib/util/unix_privs.c",
 "lib/util/util.c", "ntvfs/posix/pvfs_acl.c" and "ntvfs/unixuid/vfs_unixuid.c".
2010-02-05 19:47:26 +01:00
Matt Kraai
a7250eb142 Change uint_t to unsigned int in lib/util
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-02 07:18:17 +01:00
Stefan Metzmacher
ad6ea7b189 lib/util: remove data_blob_talloc_reference()
We want to avoid the usage of talloc_reference() in Samba.

metze
2010-01-29 11:16:44 +01:00
Andrew Tridgell
273a4d9803 s4-debug: removed debug_ctx(). It didn't catch on :-)
There was only one user, which isn't worth it for the overhead.
2010-01-09 10:15:13 +11:00
Björn Jacke
571ee54b79 lib/util: move TIME_T_MIN/MAX defines into header file 2010-01-07 00:50:29 +01:00
Brendan Powers
027cba6a49 Return NULL in strlower_talloc if src is NULL
Prevents strlower_talloc from segfaulting if you pass it a NULL string.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2009-12-18 14:27:43 +11:00
Andrew Tridgell
71943e8858 util: added binsearch.h for binary array searches
This was moved from the schema_query code. It will now be used in more
than one place, so best to make it a library macro. I think there are
quite a few places that could benefit from this.
2009-12-10 17:51:29 +11:00
Matthias Dieter Wallnöfer
012494b800 util/util_strlist - add a call "const_str_list" for making "unconst" lists "const" 2009-12-01 16:46:29 +11:00
Matthias Dieter Wallnöfer
c1cb1f7724 charset/tests/iconv - Remove the "const" from "ptr_in" to prevent "discard_const_p" use
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 16:50:49 +01:00
Matthias Dieter Wallnöfer
94c33bdd72 util/strlist: Fix up "const" warnings in the string list and test code
This work I did using suggestions by Jelmer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-11-20 16:50:47 +01:00
Volker Lendecke
4a777ec4d7 Attempt to fix the s4 build -- we can not use map_nt_error_from_unix in lib/ 2009-11-14 11:32:38 +01:00
Volker Lendecke
f38edcd61a Introduce tevent_req_poll_ntstatus 2009-11-14 11:03:28 +01:00
Volker Lendecke
c254349261 Introduce tevent_req_simple_finish_ntstatus 2009-11-14 11:03:28 +01:00
Kamen Mazdrashki
5b75201dbb util: str_list_unique() bugfix
j is actually the index of the last element in the list
size of the list though is j+1 <- to make room for the
terminating NULL element
2009-11-13 23:19:06 +11:00
Kamen Mazdrashki
b7839b73b1 util: str_list_unique_2() test implementation
Difference with previous test for str_list_unique() is
that this test allows number of elements and number
of duplicates to be supplied on command line using
--option="list_unique:count=47"
--option="list_unique:dups=7"
2009-11-13 23:19:06 +11:00
Andrew Bartlett
fd5174e88c lib/util Split data_blob_hex_string() into upper and lower
Rather than have a repeat of the bugs we found at the plugfest where
hexidecimal strings must be in upper or lower case in particular
places, ensure that each caller chooses which case they want.

This reverts most of the callers back to upper case, as things were
before tridge's patch.  The critical call in the extended DN code is
of course handled in lower case.

Andrew Bartlett
2009-11-12 16:34:01 +11:00
Andrew Bartlett
5a8f21cb88 lib/util Fix comments in rfc1738.c.
The Samba version does not use static buffers

Andrew Bartlett
2009-11-04 14:58:24 +11:00
Andrew Bartlett
7a290130bd lib/util Use rfc1738.c from Squid for all our URL encode/decode needs.
Andrew Bartlett
2009-11-02 16:36:52 +11:00
Andrew Bartlett
87195f55de lib/util Add rfc1738 escape/unescape code from Squid
This is intended to replace our rfc1738_unescape(), and give us an
rfc1738_escape implementation (and hopefully is better tested and more
secure).

Andrew Bartlett
2009-11-02 16:36:52 +11:00
Andrew Bartlett
44a727479e util:ldb Allow multiple entries to be added in one LDIF snippit 2009-10-23 15:41:25 +11:00
Andrew Tridgell
dfa0b74516 util: fixed place where we could look one byte past end of string
We need to check the length before the value
2009-10-22 12:47:54 +11:00
Andrew Tridgell
f49818e422 lib-util: check for too many combinations in generate_unique_strs() 2009-10-20 11:34:49 +11:00
Andrew Tridgell
d680729dfb util: fixed generate_unique_strs() to be portable
'place' was going negative, and giving undefined results. The result
was duplicate names which gave errors in SMB2-DIR on PPC and other
systems.
2009-10-19 22:47:45 +11:00
Kamen Mazdrashki
f11cdc19d1 s4/asn1: Use explicite TALLOC_CTX in ber_write_OID functions 2009-10-16 12:54:13 +03:00
Simo Sorce
7bce1ab5e8 Fix builds with external tdb
Make sure we do not reference our internal tdb directly.
Let configure define what tdb.h file to use so that builds that use an
extrenal tdb do not include 2 different versions of the tdb header.
2009-10-11 09:48:53 -04:00
Simo Sorce
99cdbe3571 Fix builds with external talloc
Make sure we do not reference our internal talloc directly.
Let configure define what talloc.h file to use so that builds that use an
extrenal talloc do not include 2 different versions of the talloc header.
2009-10-09 13:14:08 -04:00
Karolin Seeger
fc2604ed26 asn1_tests: Fix typo in comment.
Karolin
2009-10-09 11:27:06 +02:00
Kamen Mazdrashki
a58bc2c9a9 s4/asn1: ber_read_OID_String() to be based on _ber_read_OID_String_impl() 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
a96c8c2355 s4/asn1: local TALLOC_CTX should be child of torture_context 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
a51571bf41 s4/asn1: fixed typo in torture messages 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
97e7f48f75 s4/asn1: Added test for ber_read_partial_OID_String() 2009-10-01 23:13:00 +02:00
Kamen Mazdrashki
5021301a0e s4/asn1: Added test for ber_read_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
681064e66e s4/asn1: Added test for ber_write_partial_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
3c3ef94ab3 s4/asn1: Added test for ber_write_OID_String() 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
bd5343924f s4/asn1: Added torture suite for ASN1 2009-10-01 23:12:59 +02:00
Kamen Mazdrashki
8330d78b21 util: strhex_to_str() fixed to handle '0x' correctly 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
154ab0b047 util: fixed compile time "discards qualifiers" warning 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
540759ec4d s4/drsuapi: ber_read_partial_OID_String() implementation 2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
55dfc116f4 s4/drsuapi: Internal implementation for ber_read_OID_String
Modified implementation _ber_read_OID_String_impl()
returns how much bytes are converted.
The intentation is to use this implementation both for
reading OIDs and partial-OIDs in the future
2009-10-01 23:12:58 +02:00
Kamen Mazdrashki
715c790600 s4/drsuapi: ber_write_partial_OID_String() implementation 2009-10-01 23:12:57 +02:00
Andrew Kroeger
c5dba4a82e s4:torture: data_blob_hex_string() output is now lowercase.
Based on the change in commit fb84edabbe, these
tests needs to expect lowercase output.
2009-09-30 16:02:14 +02:00
Jelmer Vernooij
d9ada600cc parmlist: Add more tests. 2009-09-27 17:37:53 +02:00
Jelmer Vernooij
db55ea08bc parmlist: Add basic tests for test_get_int(). 2009-09-27 14:39:58 +02:00
Jelmer Vernooij
c145888cec util/parmlist: Add some more comments. 2009-09-27 14:13:38 +02:00
Jelmer Vernooij
2dd7c9bc34 libutil: Add separate utility code for dealing with settings as a
collection of key/value pairs.
2009-09-26 23:59:35 +02:00
Günther Deschner
014a3a9926 lib/util: fix build warning.
Guenther
2009-09-25 15:19:07 +02:00
Jeremy Allison
d1aa7d4796 Remove the const from the str_list_XXX functions that
allocate both list and containing strings. This fixes
problems that people have tried to cast away and are
not needed.
Jeremy.
2009-09-24 15:52:58 -07:00
Andrew Tridgell
bb3bdb3a62 s4-ldb: added a bunch more debug for DC join
These additional debug messages were added to help us track down
w2k8->s4 domain join
2009-09-22 17:10:06 -07:00
Andrew Tridgell
fb84edabbe s4-util: windows only accepts lowercase hex encodings for extended DNs 2009-09-22 17:10:05 -07:00
Kouhei Sutou
f8dae40fc8 spnego: Support ASN.1 BIT STRING and use it in SPNEGO.
Signed-off-by: Günther Deschner <gd@samba.org>
2009-09-17 20:10:54 +02:00
Andrew Bartlett
5a01071692 libcli:nbt put util_net.c protos in new header file
This fixed a very odd build problem due to util.h importing
system/network.h being imported before the uid_wapper code.

Andrew Bartlett
2009-09-15 10:38:53 -07:00
Andrew Bartlett
668470c992 libcli:nbt make the lmhosts parsing code and dependicies common
This starts the process to have Samba4 use lmhosts.

Andrew Bartlett
2009-09-15 07:42:54 -07:00
Matthias Dieter Wallnöfer
41596d2c43 util_strlist: Add some more "const"s - small correction 2009-09-10 22:07:47 +02:00
Matthias Dieter Wallnöfer
7669bc3c89 util_strlist: Add some more "const"s 2009-09-10 07:27:15 +02:00
Steven Danneman
11bd19c007 lib/util: add unique string generator helper function 2009-09-08 13:43:06 -07:00
Matthias Dieter Wallnöfer
56a0f995b8 s4:tests/iconv - Fix a warning 2009-09-07 12:38:44 +02:00
Inra
7ce01743c1 s4: Fix "Small memory leak after calling several times lp_update"
Should fix bug #6660.
2009-09-07 09:40:34 +02:00
Andrew Kroeger
a32f4dd3cf util:tests: Correct time tests for negative UTC offsets.
All:

Please find attached a patch to fix the timestring and http_timestring
tests on hosts that have a negative UTC offset (west of the Prime Meridian).

Sincerely,
Andrew Kroeger

>From 8a8ca35edccf64aa98f2f3ae1469c4c27db8215e Mon Sep 17 00:00:00 2001
From: Andrew Kroeger <andrew@id10ts.net>
Date: Fri, 4 Sep 2009 01:31:50 -0500
Subject: [PATCH] util:tests: Correct time tests for negative UTC offsets.

The timestring and http_timestring tests were failing on hosts with negative
offsets from UTC.  Due to the timezone offset, the returned values were back in
the year 1969 (before the epoch) and did not match the test patterns.

The correction computes the offset from UTC, and if it is negative that offset
is added onto the value given to the timestring() and http_timestring() calls so
that the returned values fall on 01-Jan-1970 and match the test pattern.
2009-09-05 10:06:29 +10:00
Michael Adam
cc248f7dfc util: fix comment and clarify argument name in DLIST_DEMOTE()
Michael
2009-08-27 22:29:22 +02:00
Jeremy Allison
e829ca560d Fix make test.
Jeremy.
2009-08-24 11:24:10 -07:00
Kouhei Sutou
7fc94932ad Rename ASN1_BITFIELD to ASN1_BIT_STRING.
X.690 uses "BIT STRING" not "BIT FIELD".
2009-08-11 12:59:14 +02:00
Andrew Tridgell
58e5e1ea8d make the UID_WRAPPER skip checks at runtime
This fixes two issues pointed out by Andrew. It adds a runtime
uwrap_enabled() call that wraps the skips needed for uid emulation. It
also makes the skip in the directory_create_or_exist() function only
change the uid checking code, not the permissions code
2009-08-05 11:21:06 +10:00
Andrew Tridgell
fd43e0ee09 added a uid_wrapper library
This library intercepts seteuid and related calls, and simulates them
in a manner similar to the nss_wrapper and socket_wrapper
libraries. This allows us to enable the vfs_unixuid NTVFS module in
the build farm, which means we are more likely to catch errors in the
token manipulation.

The simulation is not complete, but it is enough for Samba4 for
now. The major areas of incompleteness are:

 - no emulation of setreuid, setresuid or saved uids. These would be
   needed for use in Samba3

 - no emulation of ruid changing. That would also be needed for Samba3

 - no attempt to emulate file ownership changing, so code that (for
   example) tests whether st.st_uid matches geteuid() needs special
   handling
2009-08-05 10:51:00 +10:00
Stefan Metzmacher
2ef1159c0d util/asn1: fix potential memory leak in asn1_write_OID()
metze
2009-07-31 14:42:02 +02:00
Volker Lendecke
7c768ddab6 No explicit initialization necessary for a zero blob 2009-07-25 12:59:21 -04:00
Tim Prouty
04c3dfde0f lib util: Fix const warning 2009-07-20 16:08:24 -07:00
Slava Semushin
5f8df16471 lib/util/util_file.c(file_save): fixed file descriptor leak when read(2) fails.
Found by cppcheck:
[./lib/util/util_file.c:383]: (error) Resource leak: fd
2009-07-19 16:00:39 +02:00
Matthieu Patou
a817cff5a0 Fix broken password quality check
This fixes broken password tests when the passwords contain non ASCII characters
(e.g. accentuated chars like ('e, `e, ...)
2009-07-19 16:00:19 +02:00
Michael Adam
8d982d91f2 lib/util: fix order of includes in tevent_ntstatus.c
replace.h needs to be included first.

Michael
2009-07-01 11:14:54 +02:00
Michael Adam
e4e855563b lib/util: fix building tevent_ntstatus without config.h
(when called from places with "#define NO_CONFIG_H" set, such as configure)

 Michael
2009-06-29 16:51:52 +02:00
Andrew Bartlett
6e92505080 Fix ndrdump to use a common setup_logging() API
By adding a new common setup_logging_stdout() API, we no longer need to abuse the ABI compatability between the different setup_logging() calls in Samba3 and Samba4's DEBUG() subsystems.

The revert of 49a6d757b4 works with this
to fix bug 6211.

Andrew Bartlett
2009-06-29 20:12:23 +10:00
Andrew Bartlett
0e95b807b9 Revert "s4:debug: make setup_logging() a bit more compatible with samba3"
The problem is that the enum was previously a 'rachet', that is, it
would only reset to a level higher than it was previouly set to.
Changing the order broke file-based logging for our production sites.

This reverts commit 49a6d757b4.
2009-06-29 19:57:57 +10:00
Nathaniel McCallum
1e21adaaf6 Two patches which fix issues on cross compiling/building 2009-06-29 13:39:52 +10:00
Volker Lendecke
22cb9bdfd3 Move asn1_load_nocopy() to lib/util/asn1.c 2009-06-20 18:54:07 +02:00
Volker Lendecke
ecf8cebf32 Move asn1_blob() to lib/util/asn1.c 2009-06-20 18:54:07 +02:00
Andrew Bartlett
223b30f593 Fix build of recurusion fix in reopen_logs() 2009-06-11 19:08:33 +10:00
Andrew Bartlett
e5353ce95b Don't recurse in reopen_logs().
Use the state to avoid recursion in reopen_logs(), as DEBUG() can call
this function.

Andrew Bartlett
2009-06-11 18:54:32 +10:00
Günther Deschner
27bb7ac5d1 lib-util: move set_blocking() call into own file.
Guenther
2009-06-10 21:25:57 +02:00
Andrew Tridgell
d42019644b added asn1 functions for handling booleans in a simple context 2009-06-10 11:45:53 +10:00
Jelmer Vernooij
7f52c8fb50 libsamba-util: Fix soversion. 2009-06-08 22:43:36 +02:00
Volker Lendecke
537b257cca Use data_blob_null instead of data_blob(NULL, 0) 2009-06-06 10:42:55 +02:00
Andrew Tridgell
8ca8dabe46 add gendb_search_single_extended_dn()
This function searches for a single record using a given filter,
adding the extended-dn control so that any returned DNs will have the
GUID and SID fields returned. This will be used in the sam auth code
to prevent us doing a member= search for the groups, which invokes an
unindexed search.
2009-06-04 14:10:11 +10:00
Jelmer Vernooij
4602cc0ac1 Build libsamba-util as a shared library. 2009-06-02 18:05:40 +02:00
Volker Lendecke
3d9e1f605c util: Change license on tevent_unix to LGPLv3+ 2009-05-29 18:31:30 +02:00
Günther Deschner
bff54b90c3 util: move add_gid_to_array_unique to toplevel and add add_uid_to_array_unique.
Guenther
2009-05-29 13:49:58 +02:00
Andrew Bartlett
d73eab2b33 Add extensive tests for str_list function behaviour 2009-05-15 01:50:06 +10:00
Volker Lendecke
074890b39e Remove two unused variables 2009-05-14 15:40:57 +02:00
Andrew Bartlett
a89bee4c98 Add new functions and tests: str_list_make_empty(), str_list_make_single() 2009-05-14 05:56:58 +10:00
Derrell Lipman
045af600f2 Take advantage of the easier-to-use thread macros
- Now that we initialize for the non-thread-safe case in the macro, there's no
  need to do it here too.

Derrell
2009-05-13 14:37:28 -04:00
Derrell Lipman
088906b064 Make the thread functions a bit easier to use
- Create separate macros for lock and unlock so that it's easier to identify
  which request is being made.

- Initialize *ponce in the SMB_THREAD_ONCE macro in the non-thread-safe case,
  rather than requiring each init function to determine if it's in the
  non-thread-safe case and manually initialize.

Derrell
2009-05-13 14:37:28 -04:00
Derrell Lipman
e03b9ae609 Allow a parameter to smb_thread_once's initialization function
- This should make life easier for ourselves. We're no longer constrained to
  the semantics of pthread_once, so let's allow passing a parameter to the
  initialization function. Some of Samba's init functions return a
  value. Although I haven't searched, I suspect that some of the init
  functions require in input parameters. The parameter added here can be used
  for input, output, or both, as necessary... or ignored, as is now done in
  talloc_stackframe_init().

Derrell
2009-05-13 09:50:17 -04:00
Derrell Lipman
7c39e450fc Fix broken smb_thread_once function (again)
- It would help if smb_thread_once did, eventually, set the variable that
  prevents the init function from being run again. Sigh. It must be getting
  late.

Derrell
2009-05-12 21:32:33 -04:00
Derrell Lipman
8a60c26c7c Fix broken smb_thread_once function
- We can't set *ponce=true before running the function because although other
  threads wouldn't re-run the initialization function, they could potentially
  proceed beyond the initialization point while the first thread was still
  running the initialization function. If a second thread gets to an
  SMB_THREAD_ONCE() call while one with the same ponce is running, we need to
  ensure that it enters smb_thread_once() to await the mutex and then recheck
  whether *ponce is set or not.  My original comment about other "once"
  functions possibly being called from within this "once" function is
  irrelevant since those other ones would have their own unique ponce.

Derrell
2009-05-12 21:24:34 -04:00
Jeremy Allison
6bc1ce996d Fix definition of smb_thread_once - must return int not void as
it's used in a ? : comparison macro.
Jeremy.
2009-05-11 22:33:32 -07:00
Jeremy Allison
d0865aeb5d Ensure documentation matches the tdb_util function usage.
Jeremy.
2009-05-11 17:29:16 -07:00
Derrell Lipman
915518c0db Use bool instead of int for a boolean variable 2009-05-10 23:04:00 -04:00
Derrell Lipman
9a93dc092c Optimize smb_thread_once usage by not calling it if known already called
- The macro SMB_THREAD_ONCE now tests whether the "once" variable is already
  set, and if so avoids calling smb_thread_once().

Derrell
2009-05-10 22:58:12 -04:00
Derrell Lipman
404327ad41 Panic upon mutex lock or unlock failure
- It's a serious error if we can't lock or unlock a mutex in
  smb_thread_once(). Panic instead of just displaying a DEBUG message.

Derrell
2009-05-10 22:45:12 -04:00
Derrell Lipman
418a2eeae8 Don't require external use of internal enum smb_thread_lock_type
- Internally, when locking or unlocking a mutex, we'll pass one of the
  values of enum smb_thread_lock_type. That enum is not available to users
  providing a thread implementation. Externally, we'll document the integer
  values which will be passed to their lock_mutex function, but not require
  them to access our internal header file.

Derrell
2009-05-10 22:45:12 -04:00
Derrell Lipman
d3434477e6 Replace external thread "once" with an internal implementation
Jeremy, please check...

- I'm in the process of providing an interface in libsmbclient to the
  recently-added threading capabilities. In the process, I discovered that
  different thread implementations have varying types for the variable passed
  to the thread_impl_once() function. pthreads, for example, uses type
  pthread_once_t. Since Samba needs to internally declare these variables, it
  would need to know the exact type required by each thread implementation's
  function. After considering multiple methods of obtaining an appropriately
  sized variable, I decided that for the basic "once" functionality required
  by Samba, it would be much simpler to just implement our own "once"
  functionality. We don't require cancellation points et all. This commit adds
  an smb_thread_once() function that is implemented using an internal
  mutex. The mutex itself uses the implementation's create_mutex
  function. This eliminates the need for the user to provide a smb_thread_once
  function pointer and the entire issue of that function's first parameter.

Derrell
2009-05-10 22:45:12 -04:00
Volker Lendecke
2467ae1b6a Clean up after Tridge's util_strlist changes 2009-05-03 13:46:44 +02:00
Volker Lendecke
46bbdbd8c7 Fix a missing prototype warning 2009-04-28 15:34:22 +02:00
Michael Adam
664da577f9 pm_process():raise level of debug message
Michael
2009-04-28 12:20:38 +02:00
Jelmer Vernooij
3cf48ee05a Fix push_codepoint function without iconv_convenience. 2009-04-23 17:50:18 +02:00
Jelmer Vernooij
80420745ff Add a new non-convenience version of push_codepoint. 2009-04-23 17:50:18 +02:00
Jeremy Allison
5cbd7556c2 Ensure we have all the definitions needed in both threaded and non-threaded versions.
Jeremy.
2009-04-20 04:25:26 -07:00
Jeremy Allison
399c765538 Attempt to fix build farm on platforms where pthread_once_t is a struct.
Jeremy.
2009-04-20 04:00:06 -07:00
Jeremy Allison
3d2e95c296 Fix the pthread_once initialization issue. Make talloc_stackframe use
this.
Jeremy.
2009-04-20 03:04:42 -07:00
Jeremy Allison
d9804ae3cc Fix bug #6089 - Winbind samr_OpenDomain not possible with Samba 3.2.6+
What a difference a name makes... :-). Just because something is missnamed
SAMR_ACCESS_OPEN_DOMAIN, when it should actually be SAMR_ACCESS_LOOKUP_DOMAIN,
don't automatically use it for a security check in _samr_OpenDomain().
Jeremy.
2009-04-15 15:40:00 -07:00
Jeremy Allison
8e06e945b6 Ensure a tls key is only generated once - wrap create & destroy in a mutex.
Change the function names to add _once to the tls_create & tls_destroy to
make this obvious.
Jeremy.
2009-04-14 15:19:39 -07:00
Jeremy Allison
27a3118bcf Make talloc_stack threadsafe using TLS. Volker please
check. Passes make test and basic valgrind testing.
Jeremy.
2009-04-14 12:23:22 -07:00
Andrew Tridgell
65ad2ced60 Merge branch 'wspp-schema' 2009-04-09 14:40:19 +10:00
Andrew Tridgell
fd7c52231f added _const versions of some of the str_list_*() functions
These const versions don't copy the strings themselves, which
is useful when those strings point at known constant data (into the
schema in this case)
2009-04-09 14:28:38 +10:00
Andrew Tridgell
4f69d7067d added str_list_unique() and str_list_show()
I also undid some of the const changes from Andrew, as
they didn't in fact resolve the const warnings.
2009-04-09 13:44:27 +10:00
Jeremy Allison
e5702da72c Add the thread functions to top level lib/util.
Not yet used, that's the next step.
Jeremy.
2009-04-08 15:46:49 -07:00
Andrew Bartlett
54f7523db1 Rework util_strlist prototypes to use a bit more and less const
Hopefully this produces less warnings, but it might produce more...

Andrew Bartlett
2009-04-08 23:18:13 +10:00
Andrew Tridgell
ef6c6ab4c6 added a str_list_append() function 2009-04-07 16:33:26 +10:00
Stefan Metzmacher
7ce1356c9f lib/util: fallback to any id in idr_get_new_random()
metze
2009-04-01 16:41:15 +02:00
Jelmer Vernooij
1e200c1952 Merge branch 'master' of git://git.samba.org/samba 2009-03-26 15:31:02 +01:00
Volker Lendecke
6a2e71b12d Add tevent_req_simple_recv_ntstatus() 2009-03-24 13:23:40 +01:00
Jelmer Vernooij
ca202cf464 Merge branch 'master' of ssh://git.samba.org/data/git/samba into displaysec 2009-03-20 16:40:09 +01:00
Stefan Metzmacher
b69e72deda lib/util: build tevent_unix.o and tevent_ntstatus.o as UTIL_TEVENT subsystem
metze
2009-03-19 16:25:58 +01:00
Jelmer Vernooij
4478756571 Strip /usr/include from include flags, so we don't end up including
the system tevent if it's too old.
2009-03-15 18:10:20 +01:00
Jelmer Vernooij
7972d82436 Remove -L/usr/lib from a couple more make variables. 2009-03-15 00:54:55 +01:00
Jelmer Vernooij
218ce0e805 Fix prototype mismatch. 2009-03-09 21:49:44 +01:00
Jelmer Vernooij
f992416e23 Revert accidental reintroduction of void ** bug. 2009-03-08 06:57:52 +01:00
Stefan Metzmacher
b00204a461 lib/util: remove samba specific talloc_get_type_abort()
metze
2009-03-03 18:07:33 +01:00
Jelmer Vernooij
c7b9757b8a Import ISO-8859-1, 646 from Samba 3 iconv. 2009-03-02 04:12:57 +01:00
Jelmer Vernooij
7ab8f373c8 Use common header file for character set handling in Samba 3 and Samba 4. 2009-03-01 22:24:34 +01:00
Jelmer Vernooij
94069bd274 s4: Use same function signature for convert_* as s3. 2009-03-01 19:55:46 +01:00
Jelmer Vernooij
4903d20c21 Merge branch 'master' of git://git.samba.org/samba into convenience 2009-03-01 16:41:57 +01:00
Jelmer Vernooij
55903e6f91 Move next_token_talloc to util.c, as util_str.c is only compiled inside samba 4. 2009-03-01 16:19:38 +01:00
Jelmer Vernooij
d776ac03c3 Move next_token_talloc() to top-level. 2009-03-01 16:16:16 +01:00
Jelmer Vernooij
9f6e2d6485 Sync smb_iconv_t type, convert_string return type with Samba 3 equivalents. 2009-03-01 12:59:58 +01:00
Jelmer Vernooij
9ffb6d2d9e Add allow_badcharcnv argument to all conversion function, for
consistency with Samba 3.
2009-03-01 06:33:40 +01:00
Volker Lendecke
4d22554e98 Add tevent_ntstatus 2009-02-26 13:04:33 +01:00
Volker Lendecke
c50233695e Add tevent_req_is_unix_error 2009-02-24 20:40:46 +01:00
Steven Danneman
8d63c596a0 Refactored sys_fork() and sys_pid() into shared util library
This fixes a bug in 116ce19b, where we didn't clear the pid cache in
become_daemon() and thus the /var/run/smbd.pid didn't match the actual
pid of the parent process.

Currently S4 will clear the pid cache on fork but doesn't yet take
advantage of the pid cache by using sys_pid() instead of the direct
get_pid().
2009-02-23 21:17:12 -08:00
Tim Prouty
39b508e38e Fix shadowed declaration warning 2009-02-21 14:00:05 -08:00
Steven Danneman
116ce19b10 Moved become_daemon() and close_low_fds() to shared util lib 2009-02-20 16:30:12 -08:00
Volker Lendecke
0844cca1d5 Replace get_myname() with the talloc version from v3-3-test 2009-02-13 12:15:03 +01:00
Volker Lendecke
c2f7f1b40b Fix Coverity ID 707 (RESOURCE_LEAK) 2009-02-13 10:21:03 +01:00
Jelmer Vernooij
0afa0ab442 Revert "s3/s4: Move CONST_DISCARD into lib/util so it's available from s3 and s4"
lib/util already has discard_const_p.

This reverts commit 0cb430c22e.
2009-02-09 17:48:30 +01:00
Volker Lendecke
cfc27ece10 Attempt to fix "make test" on host "tridge" 2009-02-02 15:39:13 +01:00
Stefan Metzmacher
48a0721606 lib/util: s/new/pn in idtree.c
metze
2009-02-02 13:09:16 +01:00
Stefan Metzmacher
5e6e370c4e lib/util: s/class/dclass
metze
2009-02-02 13:09:16 +01:00
Simo Sorce
10c907bcdb Fix headers, only ldb.h is required 2009-02-01 13:06:13 -05:00
Stefan Metzmacher
24a1b556fc s4:lib/util: fix the build
metze
2009-01-30 18:42:08 +01:00
Stefan Metzmacher
94cb0835ca s4:build: kill DEFAULT_HEADERS variable
metze
2009-01-30 17:38:40 +01:00
Jeremy Allison
77bac5b78c Fix coverity CID#66. Resource leak in error path.
Jeremy.
2009-01-29 17:16:34 -08:00
Stefan Metzmacher
9967907190 util_str: setup the correct talloc name for strings
metze
(partly from samba4wins tree 447e7f9532131117e896712db9def321c96718eb)
2009-01-19 07:05:21 +01:00