krb5_child.c revision 7dfc7617085c403d30debe9f08d4c9bcca322744
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd Kerberos 5 Backend Module -- tgt_req and changepw child
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd Sumit Bose <sbose@redhat.com>
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd Copyright (C) 2009-2010 Red Hat
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd This program is free software; you can redistribute it and/or modify
b05ab3ff5ab54aa22610b13d56eaba6ddfc3db60nd it under the terms of the GNU General Public License as published by
6ae232055d4d8a97267517c5e50074c2c819941and the Free Software Foundation; either version 3 of the License, or
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd (at your option) any later version.
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd This program is distributed in the hope that it will be useful,
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd but WITHOUT ANY WARRANTY; without even the implied warranty of
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dc0d8d65d35787d30a275895ccad8d8e1b58a5ednd GNU General Public License for more details.
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end You should have received a copy of the GNU General Public License
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#include <popt.h>
#include "util/sss_krb5.h"
#include "util/user_info_msg.h"
#include "providers/child_common.h"
#include "providers/dp_backend.h"
#include "providers/krb5/krb5_auth.h"
#include "providers/krb5/krb5_utils.h"
struct krb5_child_ctx {
int forwardable;
int proxiable;
int addresses;
int not_forwardable;
int not_proxiable;
int no_addresses;
int verbose;
char* principal_name;
char* service_name;
char* keytab_name;
char* k5_cache_name;
char* k4_cache_name;
char *kdcip;
char *realm;
char *ccache_dir;
char *ccname_template;
int auth_timeout;
int child_debug_fd;
struct krb5_req {
char* name;
int read_from_child_fd;
int write_to_child_fd;
char *ccname;
char *keytab;
bool validate;
char *fast_ccname;
const char *upn;
static const char *__krb5_error_msg;
int ret;
long exp_time;
if (password_expiration == 0) {
int ret;
if (num_prompts != 0) {
return KRB5_LIBOS_CANTREADPWD;
return EOK;
return EOK;
return ENOMEM;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
done:
if (kerr != 0) {
return kerr;
char *cc_file_name;
char *dummy;
char *tmp_ccname;
return EINVAL;
return ENOMEM;
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
goto done;
done:
return kerr;
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;
written = 0;
return ret;
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;
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;
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) {
goto fail;
} else if (ret > 0) {
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
goto fail;
fail: