Cdiff client_init.c
--- /net/etna.eng/build7/semery/mit2/webrev/usr/src/lib/krb5/kadm5/clnt/client_init.c- Wed Sep 8 17:00:02 2004
+++ client_init.c Wed Sep 8 13:40:46 2004
@@ -3,11 +3,11 @@
* Use is subject to license terms.
*
* $Header: /cvs/krbdev/krb5/src/lib/kadm5/clnt/client_init.c,v 1.13.2.2 2000/05/09 13:17:14 raeburn Exp $
*/
-#pragma ident "@(#)client_init.c 1.16 04/09/08 SMI"
+#pragma ident "@(#)client_init.c 1.15 04/05/04 SMI"
/*
* Copyright (C) 1998 by the FundsXpress, INC.
*
* All rights reserved.
@@ -61,10 +61,12 @@
#include <gssapiP_krb5.h>
#include <kadm5/kadm_rpc.h>
#include <rpc/clnt.h>
#include <kadm5/admin.h>
#include "client_internal.h"
+#include <iprop_hdr.h>
+#include "iprop.h"
#define ADM_CCACHE "/tmp/ovsec_adm.XXXXXX"
/* connection timeout to kadmind in seconds */
#define KADMIND_CONNECT_TIMEOUT 25
@@ -302,10 +304,12 @@
struct sockaddr_in *sin;
struct netconfig *nconf;
int code = 0;
generic_ret *r;
char *ccname_orig;
+ char *iprop_svc;
+ boolean_t iprop_enable = B_FALSE;
char mech[] = "kerberos_v5";
gss_OID mech_oid;
gss_OID_set_desc oid_set;
gss_name_t gss_client;
gss_buffer_desc input_name;
@@ -381,12 +385,33 @@
nconf->nc_proto, nconf->nc_device, nconf->nc_nlookups,
nconf->nc_unused);
printf("netaddr: maxlen %d, buf: %s, len: %d\n", netaddr.maxlen,
netaddr.buf, netaddr.len);
#endif
- /* tell clnt_tli_create that given fd is already connected */
- handle->clnt = clnt_tli_create(fd, nconf, NULL, KADM, KADMVERS, 0, 0);
+ /*
+ * Tell clnt_tli_create that given fd is already connected
+ *
+ * If the service_name and client_name are iprop-centric,
+ * we need to clnt_tli_create to the appropriate RPC prog
+ */
+ iprop_svc = strdup(KIPROP_SVC_NAME);
+ if (iprop_svc == NULL)
+ return (ENOMEM);
+
+ if ((strstr(service_name, iprop_svc) != NULL) &&
+ (strstr(client_name, iprop_svc) != NULL)) {
+ iprop_enable = B_TRUE;
+ handle->clnt = clnt_tli_create(fd, nconf, NULL,
+ KRB5_IPROP_PROG, KRB5_IPROP_VERS, 0, 0);
+ }
+ else
+ handle->clnt = clnt_tli_create(fd, nconf, NULL,
+ KADM, KADMVERS, 0, 0);
+
+ if (iprop_svc)
+ free(iprop_svc);
+
if (handle->clnt == NULL) {
syslog(LOG_ERR, dgettext(TEXT_DOMAIN,
"clnt_tli_create failed\n"));
code = KADM5_RPC_ERROR;
(void) close(fd);
@@ -490,10 +515,19 @@
options_ret.minor_status,
mech);
goto error;
}
+ /*
+ * Bypass the remainder of the code and return straightaway
+ * if the gss service requested is kiprop
+ */
+ if (iprop_enable == B_TRUE) {
+ code = 0;
+ goto cleanup;
+ }
+
r = init_1(&handle->api_version, handle->clnt, &rpc_err_code);
if (r == NULL) {
ADMIN_LOGO(LOG_ERR, dgettext(TEXT_DOMAIN,
"error during admin api initialization\n"));
@@ -932,5 +966,14 @@
{
CHECK_HANDLE(handle);
return (0);
}
+/*
+ * Stub function for kadmin. It was created to eliminate the dependency on
+ * libkdb's ulog functions. The srv equivalent makes the actual calls.
+ */
+krb5_error_code
+kadm5_init_iprop(void *handle)
+{
+ return (0);
+}