mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Reorder XML-RPC initialization in ipa-join to avoid segfault.
There were a number of code paths where we would try to call xmlrpc_env_clean() without having first called xmlrpc_env_init() Re-order the code so we always initialize the XML-RPC client first. I also noticed a place where the return value of strdup() was not being checked for NULL. https://fedorahosted.org/freeipa/ticket/3275
This commit is contained in:
parent
6cb7441d15
commit
0d836cd6ee
@ -735,6 +735,13 @@ unenroll_host(const char *server, const char *hostname, const char *ktname, int
|
|||||||
char * url = NULL;
|
char * url = NULL;
|
||||||
char * user_agent = NULL;
|
char * user_agent = NULL;
|
||||||
|
|
||||||
|
/* Start up our XML-RPC client library. */
|
||||||
|
xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);
|
||||||
|
|
||||||
|
xmlrpc_env_init(&env);
|
||||||
|
|
||||||
|
xmlrpc_client_setup_global_const(&env);
|
||||||
|
|
||||||
if (server) {
|
if (server) {
|
||||||
ipaserver = strdup(server);
|
ipaserver = strdup(server);
|
||||||
} else {
|
} else {
|
||||||
@ -755,6 +762,11 @@ unenroll_host(const char *server, const char *hostname, const char *ktname, int
|
|||||||
host = strdup(hostname);
|
host = strdup(hostname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NULL == host) {
|
||||||
|
rval = 3;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL == strstr(host, ".")) {
|
if (NULL == strstr(host, ".")) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
fprintf(stderr, _("The hostname must be fully-qualified: %s\n"),
|
fprintf(stderr, _("The hostname must be fully-qualified: %s\n"),
|
||||||
@ -846,13 +858,6 @@ unenroll_host(const char *server, const char *hostname, const char *ktname, int
|
|||||||
ccache = NULL;
|
ccache = NULL;
|
||||||
putenv("KRB5CCNAME=MEMORY:ipa-join");
|
putenv("KRB5CCNAME=MEMORY:ipa-join");
|
||||||
|
|
||||||
/* Start up our XML-RPC client library. */
|
|
||||||
xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);
|
|
||||||
|
|
||||||
xmlrpc_env_init(&env);
|
|
||||||
|
|
||||||
xmlrpc_client_setup_global_const(&env);
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
ret = asprintf(&url, "https://%s:443/ipa/xml", ipaserver);
|
ret = asprintf(&url, "https://%s:443/ipa/xml", ipaserver);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user