krb5_child.c revision fe1afaccc7c9a99df823a7c44cd89fc3c619715a
7db9f691a00ead175b03335457ca296a33ddf31bnd Kerberos 5 Backend Module -- tgt_req and changepw child
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd Sumit Bose <sbose@redhat.com>
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd Copyright (C) 2009-2010 Red Hat
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd This program is free software; you can redistribute it and/or modify
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd it under the terms of the GNU General Public License as published by
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd the Free Software Foundation; either version 3 of the License, or
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd (at your option) any later version.
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd This program is distributed in the hope that it will be useful,
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd but WITHOUT ANY WARRANTY; without even the implied warranty of
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd GNU General Public License for more details.
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd You should have received a copy of the GNU General Public License
0a146bb31945dd13e6f7ad35818f6842ec91ff53nd along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "sss_cli.h"
struct krb5_req {
char* name;
char *realm;
char *ccname;
char *keytab;
bool validate;
bool send_pac;
bool use_enterprise_princ;
char *fast_ccname;
const char *upn;
if (kerr != 0) {
return kerr;
int ret;
int errnop;
return EIO;
return EOK;
int ret;
long exp_time;
if (password_expiration == 0) {
typedef int (*checker)(int c);
switch (format) {
return isdigit;
return isxdigit;
return isalnum;
return NULL;
return ENOTSUP;
return ENOTSUP;
return EPROTO;
return ENOMEM;
return ENOTSUP;
return EMSGSIZE;
return ENOMEM;
return EMSGSIZE;
return EMSGSIZE;
return ENOMEM;
return EBADMSG;
return ret;
goto done;
goto done;
switch (ret) {
case EBADMSG:
case EMSGSIZE:
case ENOTSUP:
case EPROTO:
goto done;
goto done;
goto done;
done:
return ret;
void *data,
return EINVAL;
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;
#ifdef HAVE_KRB5_CC_COLLECTION
bool ret = false;
if (kerr != 0) {
goto done;
ret = true;
goto done;
} else if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
ret = true;
done:
if (kerr != 0) {
goto done;
return ret;
static krb5_error_code
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
if (kerr != 0) {
goto done;
#ifdef HAVE_KRB5_CC_COLLECTION
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_CC_COLLECTION
static errno_t
errno = 0;
return EIO;
return EACCES;
return EACCES;
return ret;
return EOK;
static krb5_error_code
const char *dirname;
return EIO;
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_CC_COLLECTION
case SSS_KRB5_TYPE_DIR:
return EINVAL;
size_t p = 0;
if (!buf) {
return ENOMEM;
*_len = p;
return EOK;
int ret;
return ERR_INTERNAL;
return ENOMEM;
return ret;
int ret;
return ret;
errno = 0;
return ret;
return EOK;
return EOK;
int ret;
unsigned int upn_len = 0;
goto done;
if (kerr != 0) {
goto done;
goto done;
done:
return ret;
bool realm_entry_found = false;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
goto done;
if (kerr != 0) {
realm_entry_found = true;
if (!realm_entry_found) {
if (kerr != 0) {
goto done;
goto done;
if (kerr != 0) {
goto done;
if (kerr == 0) {
principal));
goto done;
if (kerr != 0) {
kerr = 0;
goto done;
if (kerr != 0) {
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;
const char *password)
const char *realm_name;
int realm_length;
char *cc_name;
kr);
if (kerr != 0) {
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
goto done;
if (kerr != 0) {
kerr = 0;
done:
return kerr;
if (kerr != 0) {
switch (kerr) {
return ERR_OK;
case KRB5_LIBOS_CANTREADPWD:
return ERR_NO_CREDS;
case KRB5_KDC_UNREACH:
return ERR_NETWORK_IO;
case KRB5KDC_ERR_KEY_EXP:
return ERR_CREDS_EXPIRED;
return ERR_AUTH_FAILED;
case KRB5_PREAUTH_FAILED:
return ERR_CREDS_INVALID;
return ERR_INTERNAL;
int ret;
const char *realm_name;
int realm_length;
return ERR_NO_CREDS;
if (!prelim) {
if (kerr != 0) {
return kerr;
if (kerr != 0) {
msg);
return kerr;
if (prelim) {
return EOK;
return ERR_NO_CREDS;
return ERR_NETWORK_IO;
if (kerr != 0) {
return ERR_CHPASS_FAILED;
if (kerr == 0) {
int ret;
switch (ret) {
case EOK:
case EACCES:
return ERR_INVALID_CRED_TYPE;
return ERR_NO_CREDS;
if (kerr == 0) {
goto done;
if (kerr != 0) {
if (kerr != 0) {
return kerr;
if (kerr == 0) {
done:
return ret;
if (kerr != 0) {
if (access_allowed) {
return EOK;
return ERR_AUTH_DENIED;
const char *ccname;
int ret;
return ERR_INVALID_CRED_TYPE;
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;
if (kerr != 0) {
goto done;
if (kerr != 0) {
done:
if (kerr != 0) {
return EINVAL;
switch (auth_token_type) {
case SSS_AUTHTOK_TYPE_EMPTY:
case SSS_AUTHTOK_TYPE_CCFILE:
return EINVAL;
*p += auth_token_length;
return ret;
size_t p = 0;
return ENOMEM;
p += len;
p += len;
p += len;
if (ret) {
return ret;
if (ret) {
return ret;
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 *primary,
const char *realm,
const char *keytab_name,
char **fast_ccname)
char *ccname;
char *server_name;
return ENOMEM;
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;
errno = 0;
return ret;
return ret;
char *fast_principal_realm;
char *fast_principal;
char *tmp_str;
if (tmp_str) {
if (kerr) {
return kerr;
&tmp_str);
if (kerr) {
return kerr;
if (!fast_principal) {
return KRB5KRB_ERR_GENERIC;
if (!fast_principal_realm) {
return ENOMEM;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (demand) {
if (kerr != 0) {
return kerr;
return EOK;
char *lifetime_str;
char *use_fast_str;
int parse_flags;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return EIO;
* missing in krb5.conf or to allow SSSD to work with multiple unconnected
if (kerr != 0) {
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
return ENOMEM;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
return kerr;
if (kerr != 0) {
lifetime_str));
return kerr;
if (kerr != 0) {
lifetime_str));
return kerr;
if (!offline) {
use_fast_str));
return EINVAL;
return kerr;
int opt;
switch(opt) {
if (!debug_prg_name) {
goto done;
goto done;
goto done;
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 done;
goto done;
done:
exit(0);