/*
Authors:
Sumit Bose <sbose@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 "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
#include <fcntl.h>
#include <ctype.h>
#include "util/sss_krb5.h"
#include <krb5/locate_plugin.h>
#include "providers/krb5/krb5_common.h"
} \
} while(0)
struct sssd_ctx {
char *sssd_realm;
char *kdc_addr;
char *kpasswd_addr;
bool debug;
};
{
char *s = NULL;
int ret;
if (ret < 0) {
/* ENOMEM */
return;
}
free(s);
}
enum locate_service_type svc)
{
int ret;
char *port_str;
long port;
char *endptr;
switch (svc) {
case locate_service_kdc:
break;
case locate_service_kpasswd:
break;
default:
return EINVAL;
}
if (krb5info_name == NULL) {
PLUGIN_DEBUG(("malloc failed.\n"));
return ENOMEM;
}
if (ret < 0) {
PLUGIN_DEBUG(("snprintf failed.\n"));
goto done;
}
if (fd == -1) {
PLUGIN_DEBUG(("open failed [%s][%d][%s].\n",
goto done;
}
errno = 0;
if (len == -1) {
goto done;
}
PLUGIN_DEBUG(("Content of krb5info file [%s] is [%d] or larger.\n",
krb5info_name, BUFSIZE));
}
port = 0;
} else {
*port_str = '\0';
++port_str;
errno = 0;
if (errno != 0) {
PLUGIN_DEBUG(("strtol failed on [%s]: [%d][%s], "
port = 0;
}
if (*endptr != '\0') {
PLUGIN_DEBUG(("Found additional characters [%s] in port number "
port = 0;
}
PLUGIN_DEBUG(("Illegal port number [%ld], assuming default.\n",
port));
port = 0;
}
} else {
PLUGIN_DEBUG(("Illegal port number [%s], assuming default.\n",
port_str));
port = 0;
}
}
switch (svc) {
case locate_service_kdc:
PLUGIN_DEBUG(("strdup failed.\n"));
goto done;
}
break;
case locate_service_kpasswd:
PLUGIN_DEBUG(("strdup failed.\n"));
goto done;
}
break;
default:
goto done;
}
ret = 0;
done:
return ret;
}
void **private_data)
{
const char *dummy;
} else {
PLUGIN_DEBUG(("sssd_krb5_locator_init called\n"));
}
*private_data = ctx;
return 0;
}
{
if (private_data == NULL) return;
PLUGIN_DEBUG(("sssd_krb5_locator_close called\n"));
return;
}
enum locate_service_type svc,
const char *realm,
int socktype,
int family,
void *cbdata)
{
int ret;
PLUGIN_DEBUG(("strdup failed.\n"));
return KRB5_PLUGIN_NO_HANDLE;
}
PLUGIN_DEBUG(("get_krb5info failed.\n"));
return KRB5_PLUGIN_NO_HANDLE;
}
svc == locate_service_master_kdc) {
PLUGIN_DEBUG(("reading kpasswd address failed, "
"using kdc address.\n"));
ctx->kpasswd_port = 0;
}
}
}
PLUGIN_DEBUG(("sssd_realm[%s] requested realm[%s] family[%d] socktype[%d] "
switch (svc) {
case locate_service_kdc:
break;
break;
case locate_service_kadmin:
break;
case locate_service_kpasswd:
break;
case locate_service_krb524:
return KRB5_PLUGIN_NO_HANDLE;
default:
return KRB5_PLUGIN_NO_HANDLE;
}
switch (family) {
case AF_UNSPEC:
case AF_INET:
case AF_INET6:
break;
default:
return KRB5_PLUGIN_NO_HANDLE;
}
switch (socktype) {
case SOCK_STREAM:
case SOCK_DGRAM:
break;
default:
return KRB5_PLUGIN_NO_HANDLE;
}
return KRB5_PLUGIN_NO_HANDLE;
PLUGIN_DEBUG(("snprintf failed.\n"));
return KRB5_PLUGIN_NO_HANDLE;
}
if (ret != 0) {
gai_strerror(ret)));
if (ret == EAI_SYSTEM) {
}
return KRB5_PLUGIN_NO_HANDLE;
}
if (ret != 0) {
PLUGIN_DEBUG(("cbfunc failed\n"));
return ret;
} else {
}
} else {
}
return 0;
}
0, /* version */
};