1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00
Commit Graph

19971 Commits

Author SHA1 Message Date
Stefan Metzmacher
f86ef9b53a libads/ldap.c: if the client belongs to no site at all any dc is the closest
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:27 +01:00
Stefan Metzmacher
c2d4a84abe libads/ldap.c: pass the real workgroup name to get_dc_name()
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:27 +01:00
Stefan Metzmacher
80e74a27c5 libsmb/namequery.c: add saf_join_store() function
saf_join_store() should be called after a successful
domain join, the affinity to the dc used at join time
has a larger ttl, to avoid problems with delayed replication.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:27 +01:00
Stefan Metzmacher
c127367b1d libsmb/namequery: fallback to returning all dcs, when none is available in the requested site
It could happen that all dcs in a site are unavailable
(some sites have only one dc) and then we need to fallback
to get all dcs.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:26 +01:00
Stefan Metzmacher
d2f7f81f4d s3: libads: use get_dc_name() instead of get_sorted_dc_list() in the LDAP case
We use get_dc_name() for LDAP because it generates the selfwritten
krb5.conf with the correct kdc addresses and sets KRB5_CONFIG.

For CLDAP we need to use get_sorted_dc_list() to avoid recursion.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:26 +01:00
Stefan Metzmacher
dfe5b00db3 s3: correctly detect if the current dc is the closest one
ads->config.tried_closest_dc was never set.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Günther Deschner <gd@samba.org>
2008-10-30 14:52:26 +01:00
Michael Adam
559ba0215c winbind: fix smbd hanging on Solaris when winbindd closes socket.
On some versions of Solaris, we observed a strange effect of close(2)
on a socket: After the server (here winbindd) called close, the client fd
was not marked as readable for select. And a write call to the fd did
not produce an error EPIPE but just returned as if successful.

So while winbindd had called remove_client(), the corresponding smbd
still thought that it was connected, but failed to retrieve answers
for its queries.

This patch works around the problem by forcing the client fd to
the readable state: Just write one byte into the socket before
closing.

Michael
2008-10-27 15:07:24 +01:00
Andreas Schneider
90651d77f1 Fix the build of pam_winbind. 2008-10-24 12:18:23 +02:00
Andreas Schneider
98f3369e08 Delete the krb5 ccname variable from the PAM environment if set.
If winbind sets the KRB5CCNAME variable it should unset it when
the cache gets destroyed.
2008-10-21 15:29:03 +02:00
Jeremy Allison
cfdbe8a1f2 Cope with bad trans2mkdir requests from System i QNTC IBM SMB client.
If total_data == 4 Windows doesn't care what values
are placed in that field, it just ignores them.
The System i QNTC IBM SMB client puts bad values here,
so ignore them.
Jeremy.
2008-10-16 21:01:56 -07:00
Jeff Layton
4558c09c92 mount.cifs: make return codes match the return codes for /bin/mount (try #3)
The manpage for /bin/mount specifies that the return code should be a
positive integer (actually, it's a bitfield). Clean up the return
codes from mount.cifs to make them match the expected return values
from /bin/mount. This necessary for proper integration with autofs.

This is the third attempt at this patch. The changes here are minor,
just changing some return's from main() into exit() calls for
consistency's sake.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-10-09 10:51:33 -04:00
Jeff Layton
41849ee120 mount.cifs: have uppercase_string return success on NULL pointer
We currently don't attempt to uppercase the device portion of the mount
string if there isn't a prefixpath. Fix that by making uppercase_string
return success without doing anything on a NULL pointer.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-10-09 10:47:45 -04:00
Jeremy Allison
cfa9d20db7 Fix bug #5814 - Winbindd dumping core in a strange manner while doing "rescan_trusted_domain".
From analysis by hargagan <shargagan@novell.com> :
"The winbindd_child_died() is also getting called from process_loop() in case of
SIGCHLD signal. In this case it doesn't make the timeout_handler to NULL for
the first request. It then initiate a new request using
schedule_async_request() which installs a new timeout handler for the same
request. In such a case, for a badly unresponsive system both the timeout
handler can be called. For the first call the "private_data" will be cleared
and for another call the timeout handler will be detecting the double free. So,
for such a case as well, the winbindd_child_died() should make the
timeout_handler to NULL."
Jeremy.
2008-10-08 11:37:43 -07:00
Jeremy Allison
45514fc5d8 Fix use of DLIST_REMOVE as spotted by Constantine Vetoshev <gepardcv@gmail.com>.
This API is unusual in that if used to remove a non-list head it nulls out
the next and prev pointers. This is what you want for debugging (don't want
an entry removed from the list to be still virtually linked into it) but
means there is no consistent idiom for use as the next and prev pointers
get trashed on removal from the list, meaning you must save them yourself.
You can use it one way when deleting everything via the head pointer, as
this preserves the next pointer, but you *must* use it another way when not
deleting everything via the head pointer. Fix all known uses of this (the main
one is in conn_free_internal() and would not free all the private data entries
for vfs modules. The other changes in web/statuspage.c and winbindd_util.c
are not strictly neccessary, as the head pointer is being used, but I've done
them for consistency. Long term we must revisit this as this API is too hard
to use correctly.
Jeremy.
2008-10-01 13:23:36 -07:00
Jeremy Allison
ffa704347a Ensure we emit the notify message before renaming the open files.
Jeremy.
2008-09-30 13:37:54 -07:00
Jeremy Allison
3d10c237a9 Fix for bug #5790 - samba returns STATUS_OBJECT_NAME_NOT_FOUND on set file disposition call.
This was my fault. I use a singleton cache (positive and negative) to speed up pathname based
qfileinfo/setfileinfo lookups for alternate fsp's open on the same path. I only invalidated the
negative cache on adding a new file fsp, as I incorrectly imagined the new fsp was put at the *end* of
the open files list. DLIST_ADD puts it at the start, meaning any subsequent open wasn't seen once the
cache was set. Doh !
Jeremy.
2008-09-26 18:41:05 -07:00
Jeremy Allison
2f230176a1 Fix winbindd crash in an unusual failure mode. Bug #5737. Based on original patch from shargagan@novell.com
Jeremy.
2008-09-23 16:47:21 -07:00
Günther Deschner
72b4ca3ec5 fix net_io_q_srv_pwset2.
yes, we all love hand-marshalled rpc...

Guenther
2008-09-18 14:09:32 +02:00
Jeff Layton
a605c53524 mount.cifs: make local versions of strlcat and strlcpy static
...to silence -Wmissing-prototypes

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-14 08:37:58 -04:00
Jeff Layton
99e75f0071 cifs.upcall: make most functions static and silence compiler warnings
...to silence -Wmissing-prototypes and some uninit'ed variable
warnings. Thanks to GD for the extra-paranoid compiler flags.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-14 08:37:57 -04:00
Jeff Layton
d2bea89894 mount.cifs: don't prompt for password on krb5 mounts
krb5 mounts require that the user already have a valid krb5 ticket.
Since we can't currently use the password entered, don't prompt for it.

Also, switch to using strncmp instead of strcmp here.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:58:00 -04:00
Jeff Layton
59d7d3ae58 mount.cifs: fix several problems when mounting subdirectories of shares (try 2)
This patch is the second patch to attempt to fix up some of the problems
with mounting subdirectories of shares. The earlier patch didn't handle
this correctly when POSIX extensions were enabled. This one does.

This is a bit of a confusing area since the different components of
a service string have different rules:

1) hostname: no '/' (slash) or '\' (backslash) is allowed to be
	     embedded within the string

2) sharename: same rules as hostname

3) prefixpath: '\' *is* allowed to be embedded in a path component,
	       iff POSIX extensions are enabled. Otherwise, neither
	       character is allowed.

The idea here is to allow either character to act as a delimiter when we
know that the character can't be anything but a delimiter (namely
everywhere up to the start of the prefixpath). The patch will convert
any '\' unconditionally to '/' in the UNC portion of the string.

However, inside the prefixpath, we can't make assumptions about what
constitutes a delimiter because POSIX allows for embedded '\'
characters. So there we don't attempt to do any conversion, and pass the
prefixpath to the kernel as is. Once the kernel determines whether POSIX
extensions are enabled, it can then convert the path if needed and it's
able to do so. A patch to handle this has already been committed to the
cifs-2.6 git tree.

This patch also fixes an annoyance. When you mount a subdir of a share,
mount.cifs munges the device string so that you can't tell what the
prefixpath is. So if I mount:

	//server/share/p1/p2/p3

..then /proc/mounts and mtab will show only:

	//server/share

Finally, it also tries to apply some consistent rules to the uppercasing
of strings.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:58:00 -04:00
Jeff Layton
be4adc6938 Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL };
Cherry picked from commit 3d3d61687e

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:58:00 -04:00
Jeff Layton
ce937b28a7 cifs.upcall: bump SPNEGO msg version number and don't reject old versions
When we added the ability for the kernel to send sec=mskrb5 to the
upcall, we subtly broke old cifs.upcall versions that don't understand
it. Bump the spnego message version to 2 to make this clear. Also,
change cifs.upcall to not reject requests with a version that's lower
than the current one, and to send the reply with the same version that
the request sent. The idea is to try and keep cifs.upcall backward
compatible with old kernels.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:59 -04:00
Jeff Layton
b5cf5a34d2 cifs.upcall: fix build warning
Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:59 -04:00
Jeff Layton
340fdd5fed cifs.upcall: handle MSKRB5 OID properly
When the kernel sends the upcall a sec=mskrb5 parameter, that means
the the MSKRB5 OID is preferred by the server. This patch fixes the
upcall to use that OID in place of the "normal" krb5 OID when it
gets a sec=mskrb5 parameter.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steve French <smfrench@gmail.com>
2008-09-12 16:57:59 -04:00
Jeff Layton
8ee20a90bf cifs.upcall: negatively instantiate keys on error
When a request-key upcall exits without instantiating a key, the kernel
will negatively instantiate the key with a 60s timeout. Older kernels,
however seem to also link that key into the session keyring. This
behavior can interefere with subsequent mount attempts until the
key times out. The next request_key() call will get this negative key
even if the upcall would have worked the second time.

Fix this by having cifs.upcall negatively instantiate the key itself
with a 1s timeout and don't attach it to the session keyring.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:59 -04:00
Steve French
186eb5b26e Building cifs.upcall is giving this build warning:
client/cifs.upcall.c:205: warning: function declaration isn’t a prototype

This patch fixes this by properly declaring usage() args as void.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@samba.org>
2008-09-12 16:57:59 -04:00
Steve French
de0e8337d4 cifs.upcall: fix manpage and comments
The "cifs.resolver" key type has been changed to "dns_resolver". Fix
the comments at the top of cifs.upcall and the manpage accordingly.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@samba.org>
---
 docs-xml/manpages-3/cifs.upcall.8.xml |    4 ++--
 source/client/cifs.upcall.c           |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
2008-09-12 16:57:59 -04:00
Steve French
da92a35cae cifs.upcall was not recognizing the newer name "dns_resolver" key type
(as a synonym for the older "cifs.resolver" name) when resolving host
names to ip addresses for the kernel.

Acked-by: Jeff Layton
2008-09-12 16:57:59 -04:00
Steve French
fb47f5de05 cifs.upcall: fix compile warning
Steve French noticed these warnings when building cifs.upcall:

   Compiling client/cifs.upcall.c
   client/cifs.upcall.c: In function 'usage':
   client/cifs.upcall.c:204: warning: declaration of 'prog' shadows a global declaration
   client/cifs.upcall.c:33: warning: shadowed declaration is here

Change the usage function to not take and arg and have it just use the global
"prog" variable. Fix a typo in the log message generated when an unknown
option is specified. Also getopt() always returns '?' when it sees an unknown
option so there's no point in printing it out.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:59 -04:00
Michael Adam
c3d0508619 build: fix linking cifs.upcall when nscd_flush_cache() is found.
Michael
2008-09-12 16:57:59 -04:00
Jeff Layton
af743c4407 cifs.upcall: move default install location to EPREFIX/sbin
cifs.upcall links to libraries that live under /usr, so installing it
in /sbin doesn't seem appropriate. Move it to EPREFIX/sbin instead
(i.e. /usr/sbin).

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:58 -04:00
Jeff Layton
362092be71 cifs.upcall: enable building by default on linux
When building on linux, default to building cifs.upcall. Throw a
warning if ADS support is disabled or keyutils isn't installed.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-09-12 16:57:58 -04:00
Jeremy Allison
e2e41ff95c This patchset comprises a number of cleanups for the cifs upcall
binary. The biggest change is that it renames it from cifs.spnego
to cifs.upcall since the cifs.spnego name really isn't applicable
anymore.

It also fixes a segfault when the program is run without any args
and adds a manpage. Comments and/or suggestions appreciated.

This set should apply cleanly to the 3.3 test branch.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeremy.
2008-09-12 16:57:58 -04:00
Igor Mammedov
64f1f899dc Adds support for cifs.resolver upcall.
Here is a patch for userspace cifs.spnego handler that adds support for cifs.resolver
upcall used in DFS code.
Any comments are appreciated.

#############################

Cifs upcall with key type cifs.resolver is used for resolving
server names in handling DFS refferals.

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2008-09-12 16:57:58 -04:00
Simo Sorce
63aae3f313 Fix warning 2008-09-12 16:57:58 -04:00
Igor Mammedov
8898907505 * helper source for handling cifs kernel module upcall for kerberos
authorization
* Added -c option to set service prefix to "cifs" in service principal by
default service prefix "host" is used
* replaced malloc/free/srtncpy with replacements from samba project

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2008-09-12 16:57:58 -04:00
Igor Mammedov
9d2c5aee56 * Adds support for cifs.spnego helper into configure and Makefile.in
* Added checks for spnego prereq keyutils.h and kerberos in configure.in

Signed-off-by: Igor Mammedov <niallain@gmail.com>
2008-09-12 16:57:58 -04:00
Jeremy Allison
5e73ddba11 Backport of bugfix for #5751, smbclient: cannot show ACLs on DFS, done by
SATOH Fumiyasu <fumiyas@osstech.co.jp>.
Jeremy.
2008-09-12 11:16:03 -07:00
Jeremy Allison
d3e790fa70 Here's the fix for bug #5750. Note this bug does *NOT* affect
3.2.x (code is different there).
Jeremy.
2008-09-11 12:16:31 -07:00
Jeremy Allison
78941c166d Fix bug #5052 - not work cancel inheritance on share. We were
using the parent security descriptor type and flags instead
of using the passed in SD.
Jeremy.
2008-09-10 16:23:54 -07:00
Jeremy Allison
2f509fdbed Remove unecessary msync.
Jeremy.
2008-09-05 15:36:59 -07:00
Qiao Yang
05a80132ea Fix a memleak
request.extra_data is not freed if there is no extra_data in response or when
there is some error happens in processing. This patch will free the buffer
right after processing a request before sending back a response.
2008-09-05 14:17:04 +02:00
Jeremy Allison
f3d604ab72 Fix bug #5729. Explicitly allow "-valid".
Jeremy
2008-09-03 13:19:20 -07:00
Simo Sorce
0b39c04fed The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here. 2008-09-03 14:35:09 -04:00
Günther Deschner
09145720b5 net: net should just use machine account creds when changing passwords.
Guenther
2008-08-29 00:10:08 +02:00
Günther Deschner
84fbac51ff Backport bugfix for bug #5710.
In order to successfully update a machine account password we need to use
Netlogon ServerPasswordSet2 when NETLOGON_NEG_PASSWORD_SET2 has been negotiated.

Guenther
2008-08-29 00:10:08 +02:00
Günther Deschner
a5b913dd31 netlogon: "re-run make idl" - implement netr_ServerPasswordSet2 client.
Guenther
2008-08-29 00:10:05 +02:00
Günther Deschner
15fe1a3fa0 netlogon: define NET_SRVPWSET2 call.
Guenther
2008-08-29 00:07:26 +02:00