/*
SSSD
Create uid table
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2009 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <dirent.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <talloc.h>
#include <ctype.h>
#include <dhash.h>
#include "util/find_uid.h"
#include "util/strtonum.h"
#ifdef HAVE_SYSTEMD_LOGIN
#include <systemd/sd-login.h>
#endif
{
}
{
}
{
int ret;
int fd;
char *p;
char *e;
char *endptr;
if (ret < 0) {
return EINVAL;
return EINVAL;
}
if (fd == -1) {
"Proc file [%s] is not available anymore, continuing.\n",
path);
return EOK;
}
return error;
}
if (ret == -1) {
"Proc file [%s] is not available anymore, continuing.\n",
path);
goto fail_fd;
}
goto fail_fd;
}
goto fail_fd;
}
errno = 0;
if (ret == -1) {
goto fail_fd;
}
/* Guarantee NULL-termination in case we read the full BUFSIZE somehow */
if (ret == -1) {
}
if (p != NULL) {
p += 6;
e = strchr(p,'\t');
if (e == NULL) {
return EINVAL;
} else {
*e = '\0';
}
if (error != 0) {
return error;
}
if (*endptr != '\0') {
return EINVAL;
}
} else {
return EINVAL;
}
return EOK;
return error;
}
{
long num;
char *endptr;
errno = 0;
perror("strtol");
return error;
}
if (*endptr != '\0') {
return EINVAL;
}
return ERANGE;
}
return EOK;
}
static int only_numbers(char *p)
{
while(*p!='\0' && isdigit(*p)) ++p;
return *p;
}
{
goto done;
};
errno = 0;
goto done;
}
goto done;
}
if (ret != HASH_SUCCESS) {
goto done;
}
} else {
if (uid == search_uid) {
goto done;
}
}
errno = 0;
}
goto done;
}
if (ret == -1) {
}
} else {
}
done:
if (err) {
}
}
return ret;
}
{
#ifdef __linux__
int ret;
if (ret != HASH_SUCCESS) {
return ENOMEM;
}
return get_active_uid_linux(*table, 0);
#else
return ENOSYS;
#endif
}
{
int ret;
#ifdef HAVE_SYSTEMD_LOGIN
if (ret > 0) {
*result = true;
return EOK;
}
if (ret == 0) {
*result = false;
}
if (ret < 0) {
}
/* fall back to the old method */
#endif
return ret;
}
*result = true;
} else {
*result = false;
}
return EOK;
}