ldap_child.c revision 8571644422d36fac63d2e351936433f1fb8856c7
/*
SSSD
LDAP Backend Module -- prime ccache with TGT in a child process
Authors:
Jakub Hrozek <jhrozek@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 <unistd.h>
#include <popt.h>
#include <security/pam_modules.h>
#include "util/sss_krb5.h"
#include "providers/child_common.h"
#include "providers/dp_backend.h"
static krb5_context krb5_error_ctx;
struct input_buffer {
const char *realm_str;
const char *princ_str;
const char *keytab_name;
};
struct input_buffer *ibuf)
{
size_t p = 0;
/* realm_str size and length */
if (len) {
p += len;
}
/* princ_str size and length */
if (len) {
p += len;
}
/* keytab_name size and length */
if (len) {
p += len;
}
/* ticket lifetime */
return EOK;
}
{
int len;
size_t p = 0;
if(!r->buf) {
return ENOMEM;
}
/* result */
/* message size */
/* message itself */
/* ticket expiration time */
return EOK;
}
const char *realm_str,
const char *princ_str,
const char *keytab_name,
const krb5_deltat lifetime,
const char **ccname_out,
{
char *ccname;
char *realm_name = NULL;
char *full_princ = NULL;
int kdc_time_offset_usec;
char *principal;
bool found;
int ret;
if (krberr) {
return EFAULT;
}
if (!realm_str) {
if (krberr) {
goto done;
}
} else {
if (!realm_name) {
goto done;
}
}
if (princ_str) {
} else {
}
} else {
char hostname[512];
if (ret == -1) {
goto done;
}
}
if (!full_princ) {
goto done;
}
if (krberr) {
goto done;
}
if (keytab_name) {
} else {
}
if (krberr) {
DEBUG(0, ("Failed to read keytab file: %s\n",
goto done;
}
/* Verify the keytab */
if (krberr) {
"Unable to create GSSAPI-encrypted LDAP connection.",
goto done;
}
found = false;
found = true;
}
if (found) {
break;
}
}
if (krberr) {
DEBUG(0, ("Could not close keytab.\n"));
goto done;
}
if (!found) {
DEBUG(0, ("Principal [%s] not found in keytab [%s]\n",
"Principal [%s] was not found. "
"Unable to create GSSAPI-encrypted LDAP connection.",
goto done;
}
if (!ccname) {
goto done;
}
if (krberr) {
goto done;
}
if (krberr) {
DEBUG(0, ("Failed to init credentials: %s\n",
"Unable to create GSSAPI-encrypted LDAP connection.",
goto done;
}
if (krberr) {
goto done;
}
if (krberr) {
goto done;
}
if (krberr) {
kdc_time_offset = 0;
} else {
if (kdc_time_offset_usec > 0) {
}
}
*ccname_out = ccname;
done:
return ret;
}
const char *ccname,
{
int ret;
if (!r) return ENOMEM;
r->size = 0;
if (kerr == 0) {
} else {
return ENOMEM;
}
}
return ret;
}
*rsp = r;
return EOK;
}
{
int ret;
int kerr;
int opt;
int debug_fd = -1;
time_t expire_time = 0;
struct poptOption long_options[] = {
_("Debug level"), NULL},
_("Add debug timestamps"), NULL},
_("An open file descriptor for the debug logs"), NULL},
};
switch(opt) {
default:
_exit(-1);
}
}
_exit(-1);
}
if (debug_fd != -1) {
}
}
goto fail;
}
goto fail;
}
if (ret == -1) {
continue;
}
goto fail;
} else if (ret > 0) {
if (len > IN_BUF_SIZE) {
goto fail;
}
continue;
} else {
goto fail;
}
}
goto fail;
}
&ccname, &expire_time);
/* Do not return, must report failure */
}
return ENOMEM;
}
written = 0;
if (ret == -1) {
continue;
}
return ret;
}
}
_exit(0);
fail:
_exit(-1);
}