diff options
author | Ken Raeburn <raeburn@mit.edu> | 2008-06-24 05:04:29 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2008-06-24 05:04:29 +0000 |
commit | 5661d1290f74312a405db970aea097da77706f71 (patch) | |
tree | 0ab69c8078ef3275b99a3ad27f3592b607e43f70 /src/lib/kadm5/clnt/client_init.c | |
parent | 6879f371402854465e5276d36e4792938906097f (diff) | |
download | krb5-5661d1290f74312a405db970aea097da77706f71.zip krb5-5661d1290f74312a405db970aea097da77706f71.tar.gz krb5-5661d1290f74312a405db970aea097da77706f71.tar.bz2 |
Merge from branch sun-iprop
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20465 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kadm5/clnt/client_init.c')
-rw-r--r-- | src/lib/kadm5/clnt/client_init.c | 52 |
1 files changed, 49 insertions, 3 deletions
diff --git a/src/lib/kadm5/clnt/client_init.c b/src/lib/kadm5/clnt/client_init.c index 8fc3dc1..d5131cf 100644 --- a/src/lib/kadm5/clnt/client_init.c +++ b/src/lib/kadm5/clnt/client_init.c @@ -48,6 +48,8 @@ #include <kadm5/admin.h> #include <kadm5/kadm_rpc.h> #include "client_internal.h" +#include <iprop_hdr.h> +#include "iprop.h" #include <gssrpc/rpc.h> #include <gssapi/gssapi.h> @@ -165,6 +167,8 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, struct hostent *hp; int fd; + char *iprop_svc; + int iprop_enable = 0; char full_svcname[BUFSIZ]; char *realm; @@ -296,15 +300,37 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, goto cleanup; } + /* + * If the service_name and client_name are iprop-centric, + * we need to clnttcp_create to the appropriate RPC prog. + */ + iprop_svc = strdup(KIPROP_SVC_NAME); + if (iprop_svc == NULL) + return ENOMEM; + + if (service_name != NULL && + (strstr(service_name, iprop_svc) != NULL) && + (strstr(client_name, iprop_svc) != NULL)) + iprop_enable = 1; + else + iprop_enable = 0; + memset(&addr, 0, sizeof(addr)); addr.sin_family = hp->h_addrtype; (void) memcpy((char *) &addr.sin_addr, (char *) hp->h_addr, sizeof(addr.sin_addr)); - addr.sin_port = htons((u_short) handle->params.kadmind_port); + if (iprop_enable) + addr.sin_port = htons((u_short) handle->params.iprop_port); + else + addr.sin_port = htons((u_short) handle->params.kadmind_port); fd = RPC_ANYSOCK; - - handle->clnt = clnttcp_create(&addr, KADM, KADMVERS, &fd, 0, 0); + + if (iprop_enable) { + handle->clnt = clnttcp_create(&addr, KRB5_IPROP_PROG, KRB5_IPROP_VERS, + &fd, 0, 0); + } else + handle->clnt = clnttcp_create(&addr, KADM, KADMVERS, &fd, 0, 0); if (handle->clnt == NULL) { code = KADM5_RPC_ERROR; #ifdef DEBUG @@ -326,6 +352,16 @@ static kadm5_ret_t _kadm5_init_any(char *client_name, if (code) goto error; + /* + * Bypass the remainder of the code and return straightaway + * if the gss service requested is kiprop + */ + if (iprop_enable == 1) { + code = 0; + *server_handle = (void *) handle; + goto cleanup; + } + r = init_2(&handle->api_version, handle->clnt); if (r == NULL) { code = KADM5_RPC_ERROR; @@ -794,3 +830,13 @@ krb5_error_code kadm5_init_krb5_context (krb5_context *ctx) { return krb5_init_context(ctx); } + +/* + * 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); +} |