bd5f48540b25dae81c43feb1d6aba4175da52098 |
|
13-Feb-2018 |
Lukas Slebodnik <lslebodn@redhat.com> |
CLIENT: Fix warning Wstringop-overflow
It could not cause any problem because all strings were
compile time constants (defines). But it's better to check
that we have enough data for storing NUL terminated string in
nssaddr.sun_path
src/sss_client/common.c: In function ‘sss_cli_check_socket’:
src/sss_client/common.c:544:5: warning: ‘strncpy’ specified bound depends
on the length of the source argument [-Wstringop-overflow=]
strncpy(nssaddr.sun_path, socket_name,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strlen(socket_name) + 1);
~~~~~~~~~~~~~~~~~~~~~~~~
src/sss_client/common.c:545:13: note: length computed here
strlen(socket_name) + 1);
^~~~~~~~~~~~~~~~~~~
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> |
080e1bfb72ed0e8d96e390d83ad35eaba79bd450 |
|
29-Jan-2018 |
René Genz <liebundartig@freenet.de> |
Fix minor spelling mistakes in sss_client/*
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> |
5e6622722e84d594298a8324f3685a1bda2b5868 |
|
06-Nov-2017 |
Sumit Bose <sbose@redhat.com> |
nss-idmap: add nss like calls with timeout and flags
This patch adds new calls to libsss_nss_idmap to get NSS like user and
group information directly from SSSD without using the system's NSS
interfaces.
Additionally a timeout and a flags options are added which are not
available for system's NSS.
Related to https://pagure.io/SSSD/sssd/issue/2478
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
28f9c2051563fad6db26819c3d5188c8f946633e |
|
19-Oct-2017 |
Sumit Bose <sbose@redhat.com> |
sss_client: refactor internal timeout handling
This patch adds a timeout option to the internal client calls so that
the timeout is not hard-coded anymore in the low level poll() calls but
can be set by the caller with sss_nss_make_request_timeout(). Since the
old timeout value is not changed by this patch there is no functional
change expected.
Related to https://pagure.io/SSSD/sssd/issue/2478
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> |
1f331476e7d33bb03cc35a2a9064ee1cc5bed6cf |
|
22-Sep-2017 |
Sumit Bose <sbose@redhat.com> |
sssd_client: add mutex protected call to the PAC responder
SSSD's plugin for MIT Kerberos to send the PAC to the PAC responder
currently uses sss_pac_make_request() which does not protect the
communication with the PAC responder with a mutex as e.g. the NSS and
PAM clients.
If an application using threads loads this plugin via libkrb5 in
different threads and is heavily processing Kerberos tickets with PACs
chances are that two threads try to communicate with SSSD at once. In
this case one of the threads will miss a reply and will wait for it
until the default client timeout of 300s is passed.
This patch adds a call which uses a mutex to protect the communication
which will avoid the 300s delay mentioned above.
Resolves:
https://pagure.io/SSSD/sssd/issue/3518
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> |
d2f93542650c2f9613043acfa8e2f368972a70cd |
|
24-Nov-2016 |
Howard Guo <hguo@suse.com> |
sss_client: Defer thread cancellation until completion of nss/pam operations
The client code is not cancellation-safe, an application which
has cancelled an NSS operation will experience subtle bugs,
hence thread cancellation is deferred until completion of client
operations.
Resolves:
https://fedorahosted.org/sssd/ticket/3156
Reviewed-by: Sumit Bose <sbose@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com> |
6748a4c9d75db997c724c1dcea541e0047742f52 |
|
11-Mar-2016 |
Lukas Slebodnik <lslebodn@redhat.com> |
CLIENT: Retry request after EPIPE
We have a function sss_cli_check_socket which checks
socket in client code. The socket is reopened in case of some
issues e.g. responder terminated connections ...
We use syscall poll for checking status of socket.
It's not 100% reliable method because there is still
chance that responder will terminate socket after this check.
Here is a schema of sss_*_make_request functions:
sss_cli_check_socket
sss_cli_make_request_nochecks {
sss_cli_send_req {
poll
send
}
sss_cli_recv_rep {
poll
read
}
}
The syscall pool does not return EPIPE directly but we convert
special revents from poll to EPIPE. As it was mentioned earlier,
checking of socket in the sss_cli_check_socket is not 100% reliable.
It can happen very rarely due to TOCTOU issue (Time of check to time of use)
We can return EPIPE from the sss_cli_make_request_nochecks function
in case of failure in poll in sss_cli_send_req. The send function
in sss_cli_send_req can also return EPIPE is responder close socket
in the same time. The send function can succeed in sss_cli_send_req
but it does not mean that responder read the message. It can happen
that timer for closing socket can be handled before reading a message.
Therefore there is a still a chance that we might return EPIPE in case
of failure in poll in sss_cli_recv_rep.
Therefore we need to reconnect to responder(sss_cli_check_socket)
in case of EPIPE returned from sss_cli_make_request_nochecks and
try to do the same request one more time.
Resolves:
https://fedorahosted.org/sssd/ticket/2626
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
a452d199bc125e8d53033d7c00383b4a275ab85e |
|
11-Mar-2016 |
Lukas Slebodnik <lslebodn@redhat.com> |
CLIENT: Reduce code duplication
Patch for #2626 will be simpler with this small refactoring
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
f91029dd8d7dbc026a5c73e222926db957240cb4 |
|
23-Jul-2015 |
Yuri Chornoivan <yurchor@ukr.net> |
Fix minor typos
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com> |
0ed6114c6b2cc9d7e0c09842d19f0987e9ebbb4a |
|
03-Jul-2015 |
Lukas Slebodnik <lslebodn@redhat.com> |
sss_client: Use unique lock for memory cache
Previously the sma lock was used as for communication with
responder. However it would cause a deadlock in case of
re-checking memcache after acquiring the lock and before communication with
responder..
Required by:
https://fedorahosted.org/sssd/ticket/2581
Reviewed-by: Michal Židek <mzidek@redhat.com> |
d51bc5f43fffa516446ef62c2b860be9fa939c9d |
|
07-Apr-2015 |
Lukas Slebodnik <lslebodn@redhat.com> |
CLIENT: Clear errno with enabled sss-default-nss-plugin
Although errno was cleared in function sss_nss_make_request
some sss glic functions set errno with value of output argument errnop.
Reproducer:
* sssd compiled with enabled option sss-default-nss-plugin
* sss is the last value in group (/etc/nsswitch.conf)
* sssd-client is installed but sssd is stopped.
C-program:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <grp.h>
int main(int argc, char *argv[])
{
struct group *p_group;
setgrent();
while (1) {
errno = 0; /* initialize for getgrent() */
p_group = getgrent();
if (p_group == NULL) {
if (errno == 0) {
break; /* end of groups */
} else {
perror("getgrent");
printf("getgrent error %d \n", errno);
endgrent();
exit(-2);
}
}
printf("getgrent() OK group(%d) = %s \n",
p_group->gr_gid, p_group->gr_name);
}
exit(0);
}
Resolves:
https://fedorahosted.org/sssd/ticket/2619
Reviewed-by: Pavel Reichl <preichl@redhat.com> |
858e750c3d4fe54e50616a1ed1e101469503c070 |
|
21-Jan-2015 |
Jakub Hrozek <jhrozek@redhat.com> |
Open the PAC socket from krb5_child before dropping root
The PAC responder by default allows only connections from the root user.
This patch opens the socket to the PAC responder before the krb5_child
drops privileges so the connection seemingly comes from root.
https://fedorahosted.org/sssd/ticket/2559
Reviewed-by: Sumit Bose <sbose@redhat.com> |
5bb0c0596765dd5dd1973b7fc2d1e830bca3e345 |
|
08-Dec-2014 |
Lukas Slebodnik <lslebodn@redhat.com> |
sss_client: Work around glibc bug
glibc is inconsistent with how it treats and returns NSS_STATUS_UNAVAIL.
The sss nss plugin is present in nsswitch by default on some platforms
due to glibc caching and problem with long living applications (e.g. GNOME).
But sssd needn't be configuread and it cause problems in some programs.
In this situation, the SSSD nss plugin should behave as if it was functioning
but had no data even thought sssd is not running. The errors have to be passed
from nss plugin up to the user with minimal moidiffication.
Thanks to Stephen Gallagher for initial patch.
Resolves:
https://fedorahosted.org/sssd/ticket/2439
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> |
fa0938a6e3cb928602633c3da0b909deb269369d |
|
14-Mar-2014 |
Lukas Slebodnik <lslebodn@redhat.com> |
Use pattern #elif defined(identifier)
We had in source code following pattern #elif HAVE_<name>
It worked because undefined identifier(in some cases) was evaluated to 0.
But we do not care about value of HAVE_SOMETHING. We just need to know
whether identifier was defined.
There is not equivalent to #ifdef (short for of #if definded)
We need to use long form: #elif defined HAVE_<name>
It causes also compiler warning with enabled compiler flag -Wundef.
Reviewed-by: Pavel Reichl <preichl@redhat.com> |
a171d77f40aa92e240e91aa4bafe5a392a98b5a2 |
|
03-Dec-2013 |
Michal Zidek <mzidek@redhat.com> |
sss_client: Use SAFEALIGN_COPY_<type> macros where appropriate.
resolves:
https://fedorahosted.org/sssd/ticket/1359 |
c08e3aca5a8f3869e47c42bded962292cffccce6 |
|
28-Aug-2013 |
Lukas Slebodnik <lslebodn@redhat.com> |
CLIENT: Fix non gnu sss_strnlen implementation
last argument of function sss_strnlen "size_t *len" is output variable.
We need to increment value of size_t being pointed to by pointer instead of
incrementing pointer. |
287e76479d68db4134274d4a4fca5fe0fbc9a605 |
|
22-Nov-2012 |
Jan Cholasta <jcholast@redhat.com> |
Fix errors reported by rpmlint |
8445e39d8e154523b1c39ce701830dacef51d1e9 |
|
12-Oct-2012 |
Jakub Hrozek <jhrozek@redhat.com> |
PAM: fix handling the client fd in pam destructor
* Protect the fd with a mutex when closing
* Set it to a safe value after closing |
dba7903ba7fc04bc331004b0453938c116be3663 |
|
11-Oct-2012 |
Jakub Hrozek <jhrozek@redhat.com> |
PAM: close socket fd with pam_set_data
https://fedorahosted.org/sssd/ticket/1569 |
adcb6802e4f6369b48a74c408fd53c4325576071 |
|
10-Oct-2012 |
Pavel Březina <pbrezina@redhat.com> |
do not fail if POLLHUP occurs while reading data
This cause troubles when we send data to a pipe and close the
file descriptor before data is read. The pipe is still readable,
but POLLHUP is detected and we fail to read them.
For example, this may cause a user beeing unable to log in.
Now if POLLHUP appears, we read the pipe and then close it on
the client side too. |
86b61156743b7ebdc049450a6f88452890fd9a61 |
|
27-Aug-2012 |
Jakub Hrozek <jhrozek@redhat.com> |
Use PTHREAD_MUTEX_ROBUST to avoid deadlock in the client
https://fedorahosted.org/sssd/ticket/1460 |
8bbf89c5ab798c112773fe23515c3a9df56dde71 |
|
18-Jul-2012 |
Nick Guay <nguay@redhat.com> |
Fix uninitialized values
https://fedorahosted.org/sssd/ticket/1379 |
e589442117002ab72e4e129232cde8b31eb71f92 |
|
21-Jun-2012 |
Sumit Bose <sbose@redhat.com> |
PAC client: add basic support in common client code |
2a973054b8b1bdf3752a5d39676f51f78e3207ce |
|
18-Jun-2012 |
Shantanu Goel <sgoel@trade4.test-jc.tower-research.com> |
Do not send SIGPIPE on disconnection
Note we set MSG_NOSIGNAL to avoid
having to fiddle with signal masks
but also do not want to die in case
SIGPIPE gets raised and the application
does not handle it. |
ffe862eb84ca64c12920333af29ce02dd416d148 |
|
18-Jun-2012 |
Shantanu Goel <sgoel@trade4.test-jc.tower-research.com> |
Set return errno to the value prior to calling close(). |
347f7c4d1e8e83fc7ffcaf9524a67e8b3ad5d7c5 |
|
07-Feb-2012 |
Jan Cholasta <jcholast@redhat.com> |
SSH: Common client code |
2cbdd12983eb85eddb90f64cfafb24eae5b448f4 |
|
06-Feb-2012 |
Jakub Hrozek <jhrozek@redhat.com> |
AUTOFS: a client library
This is the library the autofs client is using. automounter dlopen()s
the library so there is no header file, no pkgconfig file and the
library is in the libsss_autofs package, not in -devel.
The library provides the following interface:
* _sss_setautomntent() - select the map for processing
* _sss_getautomntent_r() - iterates through key/value pairs in the
selected map. The key is usually the mount
point, the value is mount information
(server:/export)
* _sss_getautomntbyname_r() - returns value for a specific key.
* _sss_endautomntent() deselect a map, clean up |
fd3714d0cf068f3c782c1fff32105fc51cc97a0e |
|
18-Jan-2012 |
Stephen Gallagher <sgallagh@redhat.com> |
NSS: Add sss_readrep_copy_string
There were many places in the client code where we were
duplicating a loop to copy data in from the response buffer. This
patch turns those loops into a function for easier maintenance and
easier-to-read *readrep() routines. |
0ef783e186ef1c9f60e61a4e8e54c44cb366fdfe |
|
16-Dec-2011 |
Pavel Březina <pbrezina@redhat.com> |
SUDO integration - client common interface |
d7ef16231ce8db7b54b7dd242a38b29afdcd2337 |
|
08-Aug-2011 |
Pavel Březina <pbrezina@redhat.com> |
Fixed implicit declaration of function 'time' in src/sss_client/common.c. |
336879aabae137f9a81304f147fb0d43001654b0 |
|
29-Jul-2011 |
Simo Sorce <ssorce@redhat.com> |
sss_client: avoid leaking file descriptors
If a pam or nss module is dlcolse()d and unloaded we were leaking
the file descriptor used to communicate to sssd in the process.
Make sure the fucntion used to close the socket file descriptor is
called on dlclose()
Silence autoconf 2.28 warnings (Patch by Jakub Hrozek) |
324fb26ba803a999bedc29e93c46c84f27abf5b7 |
|
23-May-2011 |
Sumit Bose <sbose@redhat.com> |
Set _GNU_SOURCE globally |
67dabadee5686649814bf4f76d15904bb7267d38 |
|
03-May-2011 |
Simo Sorce <ssorce@redhat.com> |
clients: use poll instead of select
select is limited to fd numbers up to 1024, we need to use poll() here
to avoid causing memory corruption in the calling process.
Fixes: https://fedorahosted.org/sssd/ticket/861 |
66e691ceeee4cca739fc2606f1b357bbff4a3440 |
|
11-Feb-2011 |
Simo Sorce <ssorce@redhat.com> |
Use neutral name for functions used by both pam and nss |
79a04cb672dd9c37f7d6d4370abea8aac52abf89 |
|
08-Feb-2011 |
Simo Sorce <ssorce@redhat.com> |
Check that the socket is really ours before attempting to close it.
Fixes: https://fedorahosted.org/sssd/ticket/790 |
4555f34c78d16746b0856db928e55eb92c9ee2a4 |
|
15-Dec-2010 |
Sumit Bose <sbose@redhat.com> |
Fix another possible memory leak in sss_nss_recv_rep()
https://fedorahosted.org/sssd/ticket/723 |
5d6b7b93c778e22133f889690c3863c305c1e03f |
|
14-Dec-2010 |
Sumit Bose <sbose@redhat.com> |
Fix possible memory leak in sss_nss_recv_rep()
https://fedorahosted.org/sssd/ticket/723 |
c89589fa349f38214c9cb8d9389c0fd557e5dca2 |
|
22-Nov-2010 |
Simo Sorce <ssorce@redhat.com> |
sss_client: make code thread-safe
Add mutexes around nss operations and serialize them.
This is necessary because nss operations may have global state.
For pam it is sufficient to protect socket operations instead.
As pam functions use only the provided pam handler.
Fixes: https://fedorahosted.org/sssd/ticket/640 |
8b37eff6e65298e652eb839df412286e3b4766f5 |
|
15-Nov-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Fix incorrect type comparison
https://fedorahosted.org/sssd/ticket/657 |
3ba74ad02d3a20d50c068faa02797fafba105508 |
|
13-Oct-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Add utility function sss_strnlen()
This is useful for guaranteeing the size of an input buffer. |
8c02b001383aa9d9060076ac170d1b97761d7b60 |
|
23-Jul-2010 |
Sumit Bose <sbose@redhat.com> |
Allow sssd clients to reconnect
Currently the PAM and NSS client just return an error if there are
problems on an open socket. This will lead to problems in long running
programs like gdm if sssd is restarted, e.g. during an update. With this
patch the socket is closed and reopened. |
06247775aa9c49ffce72827921eb45e2d04c6aa1 |
|
10-Jun-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Properly handle read() and write() throughout the SSSD
We need to guarantee at all times that reads and writes complete
successfully. This means that they must be checked for returning
EINTR and EAGAIN, and all writes must be wrapped in a loop to
ensure that they do not truncate their output. |
ea0173fe8ba915960621454168651c62301833cb |
|
16-Apr-2010 |
Sumit Bose <sbose@redhat.com> |
Use SO_PEERCRED on the PAM socket
This is the second attempt to let the PAM client and the PAM responder
exchange their credentials, i.e. uid, gid and pid. Because this approach
does not require any message interchange between the client and the
server the protocol version number is not changed.
On the client side the connection is terminated it the responder is not
run by root. On the server side the effective uid and gid and the pid of
the client are available for future use.
The following additional changes are made by this patch:
- the checks of the ownership and the permissions on the PAM sockets are
enhanced
- internal error codes are introduced on the client side to generate
more specific log messages if an error occurs |
b9923919909cb976ddf42002c56a42b1893e3547 |
|
16-Apr-2010 |
Sumit Bose <sbose@redhat.com> |
Revert "Add better checks on PAM socket"
This reverts commit 5a88e963744e5da453e88b5c36499f04712df097. |
12c6b6683f8a2036578e87c659afa79d3a1d68a9 |
|
15-Mar-2010 |
George McCollister <George.McCollister@gmail.com> |
Fixed buffer alignment in exchange_credentials().
buf needs to be 32 bit aligned on ARM. Also made the fix on the server side.
Signed-off-by: George McCollister <George.McCollister@gmail.com> |
5a88e963744e5da453e88b5c36499f04712df097 |
|
11-Mar-2010 |
Sumit Bose <sbose@redhat.com> |
Add better checks on PAM socket
- check if the public socket belongs to root and has 0666 permissions
- use a SCM_CREDENTIALS message if available |
1c48b5a62f73234ed26bb20f0ab345ab61cda0ab |
|
18-Feb-2010 |
Stephen Gallagher <sgallagh@redhat.com> |
Rename server/ directory to src/
Also update BUILD.txt |