diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-05-05 11:08:55 -0400 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2010-05-06 09:04:49 -0600 |
commit | c2f89941edac3873484f24ca8595a50cdcbc68b6 (patch) | |
tree | 8064346dfc7cc652cfe50c2ae65fae9defa72cfc /ipa-client | |
parent | e29be7ac3edb9dad9b748b20a21e3fc745d637dc (diff) | |
download | freeipa-c2f89941edac3873484f24ca8595a50cdcbc68b6.tar.gz freeipa-c2f89941edac3873484f24ca8595a50cdcbc68b6.tar.xz freeipa-c2f89941edac3873484f24ca8595a50cdcbc68b6.zip |
Initialize XML-RPC structures to fix issues uncovered by MALLOC_PERTURB_
Also re-arrange some code around reading the configuration file. In trying
to eliminate bogus error messages I prevented the file from being read at all.
It isn't a problem when joining with ipa-client (which uses -s) but it wouldn't
work if you don't pass in a server name.
Diffstat (limited to 'ipa-client')
-rw-r--r-- | ipa-client/ipa-join.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/ipa-client/ipa-join.c b/ipa-client/ipa-join.c index 16d8604e7..217ebce1e 100644 --- a/ipa-client/ipa-join.c +++ b/ipa-client/ipa-join.c @@ -134,9 +134,12 @@ callRPC(xmlrpc_env * const envP, struct xmlrpc_curl_xportparms * curlXportParmsP = NULL; xmlrpc_client * clientP = NULL; + memset(&clientparms, 0, sizeof(clientparms)); + XMLRPC_ASSERT(xmlrpc_value_type(paramArrayP) == XMLRPC_TYPE_ARRAY); curlXportParmsP = malloc(sizeof(*curlXportParmsP)); + memset(curlXportParmsP, 0, sizeof(*curlXportParmsP)); /* Have curl do SSL certificate validation */ curlXportParmsP->no_ssl_verifypeer = 1; @@ -148,7 +151,7 @@ callRPC(xmlrpc_env * const envP, curlXportParmsP; clientparms.transportparm_size = XMLRPC_CXPSIZE(cainfo); xmlrpc_client_create(envP, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION, - &clientparms, XMLRPC_CPSIZE(transportparm_size), + &clientparms, sizeof(clientparms), &clientP); /* Set up kerberos negotiate authentication in curl. */ @@ -585,7 +588,6 @@ join(const char *server, const char *hostname, const char *bindpw, const char *k int status = 0; char *ipaserver = NULL; char *iparealm = NULL; - char * conf_data = NULL; const char * princ = NULL; const char * subject = NULL; const char * hostdn = NULL; @@ -598,18 +600,14 @@ join(const char *server, const char *hostname, const char *bindpw, const char *k if (server) { ipaserver = strdup(server); - } else if ((ipaserver = getIPAserver(conf_data)) == NULL) { - conf_data = read_config_file(IPA_CONFIG); - fprintf(stderr, "Unable to determine IPA server from %s\n", IPA_CONFIG); - exit(1); - } -#if 0 - if ((iparealm = getIPArealm(conf_data)) == NULL) { - fprintf(stderr, "Unable to determine IPA realm from %s\n", IPA_CONFIG); - exit(1); + } else { + char * conf_data = read_config_file(IPA_CONFIG); + if ((ipaserver = getIPAserver(conf_data)) == NULL) { + fprintf(stderr, "Unable to determine IPA server from %s\n", IPA_CONFIG); + exit(1); + } + free(conf_data); } -#endif - free(conf_data); if (NULL == hostname) { uname(&uinfo); |