krb5_child.c revision 951a2082ba1bfe2fec59b06b1f3fdf424d9d75c2
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos Kerberos 5 Backend Module -- tgt_req and changepw child
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos Sumit Bose <sbose@redhat.com>
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos Copyright (C) 2009-2010 Red Hat
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos This program is free software; you can redistribute it and/or modify
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos it under the terms of the GNU General Public License as published by
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos the Free Software Foundation; either version 3 of the License, or
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos (at your option) any later version.
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos This program is distributed in the hope that it will be useful,
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos but WITHOUT ANY WARRANTY; without even the implied warranty of
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos GNU General Public License for more details.
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos You should have received a copy of the GNU General Public License
9414015dda290f99570edc01b6dbe98f0f4c49c7Laszlo Hordos along with this program. If not, see <http://www.gnu.org/licenses/>.
52ac627fd3ec7d31990e454143b1a476284fb3d5Jason Lemay#define SSSD_KRB5_CHANGEPW_PRINCIPAL "kadmin/changepw"
52ac627fd3ec7d31990e454143b1a476284fb3d5Jason Lemay /* opts taken from kinit */
10a9be648c010204b8ba63b283aa177749227e11Paul Bryan /* in seconds */
904cb62bed9852642ea1d7699cb0515f4f62794aJon Branch errno_t (*child_req)(int fd, struct krb5_req *kr);
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos const char *upn;
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos#define KRB5_CHILD_DEBUG(level, error) KRB5_DEBUG(level, krb5_error_ctx, error)
d3bd4c99b4d249234086d3e694d9c8fb649dcc3ePaul Bryanstatic void sss_krb5_expire_callback_func(krb5_context context, void *data,
9c4d05edc8e0887d3aad788027d46d5afedb3ee0Travis Hall struct krb5_req *kr = talloc_get_type(data, struct krb5_req);
aa26d20912b59f80d1b06b9c0a34c2d4de507a4fLaszlo Hordos DEBUG(SSSDBG_TRACE_INTERNAL, ("exp_time: [%d]\n", exp_time));
d3bd4c99b4d249234086d3e694d9c8fb649dcc3ePaul Bryan ret = pam_add_response(kr->pd, SSS_PAM_USER_INFO, 2 * sizeof(uint32_t),
52ac627fd3ec7d31990e454143b1a476284fb3d5Jason Lemaystatic krb5_error_code sss_krb5_prompter(krb5_context context, void *data,
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos struct krb5_req *kr = talloc_get_type(data, struct krb5_req);
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos DEBUG(1, ("Cannot handle password prompts.\n"));
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos DEBUG(5, ("Prompter called with empty banner, nothing to do.\n"));
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos DEBUG(SSSDBG_FUNC_DATA, ("Prompter called with [%s].\n", banner));
47196c962e3caf7cdf7ea5d00ccdefc9f208bdceLaszlo Hordos ret = pam_add_response(kr->pd, SSS_PAM_TEXT_MSG, strlen(banner)+1,
d3bd4c99b4d249234086d3e694d9c8fb649dcc3ePaul Bryanstatic krb5_error_code create_empty_cred(krb5_context ctx, krb5_principal princ,
d3bd4c99b4d249234086d3e694d9c8fb649dcc3ePaul Bryan kerr = krb5_copy_principal(ctx, princ, &cred->client);
if (kerr != 0) {
goto done;
done:
if (kerr != 0) {
return kerr;
static krb5_error_code
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
#ifdef HAVE_KRB5_DIRCACHE
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
done:
return kerr;
char *cc_file_name;
char *dummy;
char *tmp_ccname;
return EINVAL;
return ENOMEM;
goto done;
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
goto done;
done:
return kerr;
#ifdef HAVE_KRB5_DIRCACHE
static errno_t
errno = 0;
return EIO;
return EACCES;
return EACCES;
return ret;
return EOK;
static krb5_error_code
const char *dirname;
return EIO;
goto done;
if (kerr != 0) {
goto done;
if (kerr) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
return EIO;
if (kerr != 0) {
goto done;
done:
return kerr;
static krb5_error_code
switch (cctype) {
case SSS_KRB5_TYPE_FILE:
#ifdef HAVE_KRB5_DIRCACHE
case SSS_KRB5_TYPE_DIR:
return EINVAL;
size_t p = 0;
return ENOMEM;
return EOK;
int pam_status)
int ret;
return NULL;
if (kerr == 0) {
return NULL;
return NULL;
return NULL;
return NULL;
return resp;
int ret;
return ENOMEM;
errno = 0;
return ret;
return EOK;
return EOK;
int ret;
return ret;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
if (kerr != 0) {
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr == 0) {
done:
return kerr;
int canonicalize = 0;
char *tmp_str;
char *ccname)
&options);
if (kerr != 0) {
return kerr;
if (kerr != 0) {
goto done;
kerr = 0;
done:
return kerr;
char *password)
int ret;
const char *realm_name;
int realm_length;
kr);
if (kerr != 0) {
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
return ret;
if (kerr != 0) {
goto done;
kerr = 0;
done:
return kerr;
int ret;
const char *realm_name;
int realm_length;
goto sendresponse;
goto sendresponse;
goto sendresponse;
if (kerr != 0) {
goto sendresponse;
goto sendresponse;
goto sendresponse;
goto sendresponse;
if (kerr != 0) {
goto sendresponse;
if (kerr != 0) {
return ret;
int ret;
goto sendresponse;
goto sendresponse;
goto sendresponse;
if (kerr != 0) {
if (kerr == 0) {
if (kerr != 0) {
switch (kerr) {
case KRB5_KDC_UNREACH:
case KRB5KDC_ERR_KEY_EXP:
return ret;
int status;
int ret;
if (kerr != 0) {
return ret;
int ret;
int kerr;
char *ccname;
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
kerr = 0;
done:
return ret;
int ret;
if (ret != 0) {
return ret;
size_t p = 0;
p += len;
p += len;
p += len;
p += len;
p += len;
p += len;
return EOK;
return EOK;
if (krberr != 0) {
goto done;
if (krberr != 0) {
krberr = 0;
goto done;
krberr = 0;
done:
return krberr;
const char *realm,
const char *keytab_name,
char **fast_ccname)
char *ccname;
char *server_name;
goto done;
goto done;
if (kerr) {
goto done;
if (kerr != 0) {
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr == 0) {
goto done;
if (kerr != 0) {
goto done;
kerr = 0;
done:
if (kerr == 0) {
return kerr;
char *lifetime_str;
char *use_fast_str;
char *tmp_str;
goto failed;
case SSS_PAM_AUTHENTICATE:
if (offline) {
case SSS_PAM_CHAUTHTOK:
case SSS_PAM_CHAUTHTOK_PRELIM:
case SSS_PAM_ACCT_MGMT:
case SSS_CMD_RENEW:
if (!offline) {
goto failed;
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
goto failed;
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
lifetime_str));
goto failed;
if (kerr != 0) {
lifetime_str));
goto failed;
if (!offline) {
if (!tmp_str) {
if (kerr) {
goto failed;
&tmp_str);
if (kerr) {
goto failed;
if (!fast_principal) {
goto failed;
if (!fast_principal_realm) {
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
goto failed;
if (kerr != 0) {
goto failed;
goto failed;
return EOK;
return kerr;
int ret;
int opt;
switch(opt) {
if (!debug_prg_name) {
goto fail;
goto fail;
goto fail;
errno = 0;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
fail: