pamsrv.c revision 830ded27453015080a54d6ba85fd4999ee7e9af1
/*
SSSD
PAM Responder
Copyright (C) Simo Sorce <ssorce@redhat.com> 2009
Copyright (C) Sumit Bose <sbose@redhat.com> 2009
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 <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <popt.h>
#include "sbus/sssd_dbus.h"
#include "responder/common/responder_packet.h"
#include "providers/data_provider.h"
#include "monitor/monitor_interfaces.h"
#include "sbus/sbus_client.h"
#include "responder/common/negcache.h"
#include "responder/common/responder_sbus.h"
#define DEFAULT_PAM_FD_LIMIT 8192
#define ALL_UIDS_ALLOWED "all"
#define ALL_DOMAIMS_ARE_PUBLIC "all"
#define NO_DOMAIMS_ARE_PUBLIC "none"
#define DEFAULT_ALLOWED_UIDS ALL_UIDS_ALLOWED
struct mon_cli_iface monitor_pam_methods = {
{ &mon_cli_iface_meta, 0 },
.resetOffline = NULL,
.clearMemcache = NULL,
.clearEnumCache = NULL,
.sysbusReconnect = NULL,
};
static struct data_provider_iface pam_dp_methods = {
{ &data_provider_iface_meta, 0 },
.RegisterService = NULL,
.pamHandler = NULL,
.sudoHandler = NULL,
.autofsHandler = NULL,
.hostHandler = NULL,
.getDomains = NULL,
.getAccountInfo = NULL,
};
{
int ret;
/* Did we reconnect successfully? */
if (status == SBUS_RECONNECT_SUCCESS) {
/* Identify ourselves to the data provider */
"PAM");
/* all fine */
return;
}
}
/* Handle failure */
/* FIXME: kill the frontend and let the monitor restart it ? */
/* pam_shutdown(rctx); */
}
{
char *uid_str;
goto done;
}
pctx->trusted_uids_count = 0;
} else {
&pctx->trusted_uids);
}
goto done;
}
done:
return ret;
}
{
char *domains_str = NULL;
goto done;
}
/* copy all domains */
goto done;
}
pctx->public_domains_count = 0;
} else {
goto done;
}
}
done:
return ret;
}
struct tevent_context *ev,
struct confdb_ctx *cdb)
{
struct sss_cmd_table *pam_cmds;
int ret, max_retries;
int id_timeout;
int fd_limit;
pam_cmds = get_pam_cmds();
&rctx);
return ret;
}
if (!pctx) {
goto done;
}
goto done;
}
goto done;
}
/* Enable automatic reconnection to the Data Provider */
/* FIXME: "retries" is too generic, either get it from a global config
* or specify these retries are about the sbus connections to DP */
"Failed to set up automatic reconnection\n");
goto done;
}
}
/* Set up the negative cache */
&pctx->neg_timeout);
/* Set up the PAM identity timeout */
&id_timeout);
"fatal error initializing negative cache\n");
goto done;
}
goto done;
}
/* Create table for initgroup lookups */
"Could not create initgroups hash table: [%s]",
goto done;
}
/* Set up file descriptor limits */
&fd_limit);
"Failed to set up file descriptor limit\n");
goto done;
}
goto done;
}
done:
}
return ret;
}
{
int opt;
struct main_context *main_ctx;
int ret;
struct poptOption long_options[] = {
};
/* Set debug level to invalid value so we can deside if -d 0 was used. */
switch(opt) {
default:
return 1;
}
}
/* set up things like debug, signals, daemonization, etc... */
debug_log_file = "sssd_pam";
ret = die_if_parent_died();
/* This is not fatal, don't return */
"Could not set up to exit when parent process does\n");
}
/* loop on main */
return 0;
}