/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h> /* getenv, exit */
#include <signal.h>
#include <memory.h>
#include <stropts.h>
#include <netconfig.h>
#include <syslog.h>
#include <kadm5/kadm_rpc.h>
#include <kadm5/server_internal.h>
#include <server_acl.h>
#include <krb5/adm_proto.h>
#include <string.h>
#include <gssapi_krb5.h>
#include <netdb.h>
#include <libintl.h>
#include "misc.h"
extern int setup_gss_names(struct svc_req *, char **, char **);
extern char *client_addr(struct svc_req *, char *);
extern void *global_server_handle;
extern int nofork;
extern short l_port;
"client=%s, service=%s, addr=%s")
"service=%s, addr=%s")
#ifdef DPRINT
#endif
#ifdef POSIX_SIGNALS
#endif /* POSIX_SIGNALS */
static void
{
switch (ret) {
case UPDATE_OK:
printf("%s: end (OK, sno=%u)\n",
w, sno);
break;
case UPDATE_ERROR:
printf("%s: end (ERROR)\n", w);
break;
printf("%s: end (FR NEEDED)\n", w);
break;
case UPDATE_BUSY:
printf("%s: end (BUSY)\n", w);
break;
case UPDATE_NIL:
printf("%s: end (NIL)\n", w);
break;
case UPDATE_PERM_DENIED:
printf("%s: end (PERM)\n", w);
break;
default:
}
}
static char *
{
switch (ret) {
case UPDATE_OK:
return (reply_ok_str);
case UPDATE_ERROR:
return (reply_err_str);
return (reply_fr_str);
case UPDATE_BUSY:
return (reply_busy_str);
case UPDATE_NIL:
return (reply_nil_str);
case UPDATE_PERM_DENIED:
return (reply_perm_str);
default:
return (reply_unknown_str);
}
}
{
int kret;
/* default return code */
if (!handle) {
gettext("%s: server handle is NULL"),
whoami);
goto out;
}
gettext("%s: setup_gss_names failed"),
whoami);
goto out;
}
DPRINT(("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
gettext("%s: Couldn't obtain client's name"),
whoami);
goto out;
}
name,
NULL,
NULL)) {
"<null>", client_name);
goto out;
}
gettext("%s; Incoming SerialNo=%u; Outgoing SerialNo=%u"),
} else {
gettext("%s; Incoming SerialNo=%u; Outgoing SerialNo=N/A"),
}
obuf,
out:
if (nofork)
if (client_name)
if (service_name)
if (name)
return (&ret);
}
/*
* Return arg cl str ptr on success, else NULL.
*/
static char *
{
char *s;
return (NULL);
}
*s = '\0';
return (cl); /* success */
}
}
return (NULL);
}
/* LINTED */
void *argp,
{
/* default return code */
if (!handle) {
gettext("%s: server handle is NULL"),
whoami);
goto out;
}
gettext("%s: setup_gss_names failed"),
whoami);
goto out;
}
DPRINT(("%s: clprinc=`%s'\n\tsvcprinc=`%s'\n",
gettext("%s: Couldn't obtain client's name"),
whoami);
goto out;
}
name,
NULL,
NULL)) {
"<null>", client_name);
goto out;
}
gettext("%s: getclhoststr failed"),
whoami);
goto out;
}
/*
* construct db dump file name; kprop style name + clnt fqdn
*/
gettext("%s: db dump file name too long; max length=%d"),
(sizeof (tmpf) - 1));
goto out;
}
/*
* note the -i; modified version of kdb5_util dump format
* to include sno (serial number)
*/
sizeof (ubuf)) {
goto out;
}
gettext("%s: kdb5 util dump string too long; max length=%d"),
(sizeof (ubuf) - 1));
goto out;
}
/*
* Fork to dump the db and xfer it to the slave.
* (the fork allows parent to return quickly and the child
* acts like a callback to the slave).
*/
switch (fret) {
case -1: /* error */
if (nofork) {
}
gettext("%s: fork failed: %s"),
goto out;
case 0: /* child */
#ifdef POSIX_SIGNALS
#else
#endif /* POSIX_SIGNALS */
/* run kdb5_util(1M) dump for IProp */
if (pret == -1) {
if (nofork) {
}
gettext("%s: pclose(popen) failed: %s"),
goto out;
}
DPRINT(("%s: exec `kprop -f %s %s' ...\n",
if (pret == -1) {
if (nofork) {
}
gettext("%s: exec failed: %s"),
goto out;
}
default: /* parent */
/* not used by slave (sno is retrieved from kdb5_util dump) */
"<null>", client_name, 0);
"<null>",
"success",
goto out;
}
out:
if (nofork)
if (client_name)
if (service_name)
if (name)
return (&ret);
}
void
{
union {
} argument;
char *result;
char *(*local)();
case NULLPROC:
(char *)NULL);
return;
case IPROP_GET_UPDATES:
local = (char *(*)()) iprop_get_updates_1;
break;
case IPROP_FULL_RESYNC:
local = (char *(*)()) iprop_full_resync_1;
break;
default:
gettext("RPC unknown request: %d (%s)"),
return;
}
gettext("RPC svc_getargs failed (%s)"),
whoami);
return;
}
gettext("RPC svc_sendreply failed (%s)"),
whoami);
}
gettext("RPC svc_freeargs failed (%s)"),
whoami);
exit(1);
}
/* LINTED */
r->updates.kdb_ulog_t_len);
r->updates.kdb_ulog_t_len = 0;
}
}
}
/*
* Get the host base service name for the kiprop principal. Returns
* KADM5_OK on success. Caller must free the storage allocated for
* host_service_name.
*/
const char *realm,
char **host_service_name)
{
char *name;
char *host;
return (ret);
return (ENOMEM);
}
return (KADM5_OK);
}