summaryrefslogtreecommitdiffstats
path: root/ipa-client
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-11-25 11:32:39 -0500
committerJason Gerard DeRose <jderose@redhat.com>2009-11-30 18:12:11 -0700
commit0dcaea8d16d976e1d132b6eac03bb2961b6396ae (patch)
treec228502e3e768a182328ece59b6874e90137bd7b /ipa-client
parentab1667f3c1607a22c6df49ceba58274347bc5826 (diff)
downloadfreeipa-0dcaea8d16d976e1d132b6eac03bb2961b6396ae.tar.gz
freeipa-0dcaea8d16d976e1d132b6eac03bb2961b6396ae.tar.xz
freeipa-0dcaea8d16d976e1d132b6eac03bb2961b6396ae.zip
Add server option to ipa-join so the IPA server can be specified.
This is needed because in the client installer we actually perform the join before creating the configuration files that join uses. All we need is the IPA server to join to and we have that from the CLI options so use that.
Diffstat (limited to 'ipa-client')
-rw-r--r--ipa-client/ipa-install/ipa-client-install2
-rw-r--r--ipa-client/ipa-join.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 0cc37deb..54d11cd8 100644
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -376,7 +376,7 @@ def main():
print "Test kerberos configuration failed"
return 1
os.environ['KRB5_CONFIG'] = krb_name
- join_args = ["/usr/sbin/ipa-join"]
+ join_args = ["/usr/sbin/ipa-join", "-s", cli_server]
if options.principal is not None:
principal = options.principal
if principal.find('@') == -1:
diff --git a/ipa-client/ipa-join.c b/ipa-client/ipa-join.c
index 83b519d9..0fef6fd7 100644
--- a/ipa-client/ipa-join.c
+++ b/ipa-client/ipa-join.c
@@ -504,7 +504,7 @@ cleanup_xmlrpc:
}
static int
-join(const char *hostname, const char *bindpw, const char *keytab, int quiet)
+join(const char *server, const char *hostname, const char *bindpw, const char *keytab, int quiet)
{
int rval;
pid_t childpid = 0;
@@ -522,11 +522,13 @@ join(const char *hostname, const char *bindpw, const char *keytab, int quiet)
krb5_error_code krberr;
conf_data = read_config_file(IPA_CONFIG);
- if ((ipaserver = getIPAserver(conf_data)) == NULL) {
+ if (server) {
+ ipaserver = strdup(server);
+ } else if ((ipaserver = getIPAserver(conf_data)) == NULL) {
fprintf(stderr, "Unable to determine IPA server from %s\n", IPA_CONFIG);
exit(1);
}
-#if 1
+#if 0
if ((iparealm = getIPArealm(conf_data)) == NULL) {
fprintf(stderr, "Unable to determine IPA realm from %s\n", IPA_CONFIG);
exit(1);
@@ -644,6 +646,7 @@ cleanup:
int
main(int argc, char **argv) {
static const char *hostname = NULL;
+ static const char *server = NULL;
static const char *keytab = NULL;
static const char *bindpw = NULL;
int quiet = 0;
@@ -651,6 +654,7 @@ main(int argc, char **argv) {
{ "debug", 'd', POPT_ARG_NONE, &debug, 0, "Print the raw XML-RPC output", "XML-RPC debugging Output"},
{ "quiet", 'q', POPT_ARG_NONE, &quiet, 0, "Print as little as possible", "Output only on errors"},
{ "hostname", 'h', POPT_ARG_STRING, &hostname, 0, "Use this hostname instead of the node name", "Host Name" },
+ { "server", 's', POPT_ARG_STRING, &server, 0, "IPA Server to use", "IPA Server Name" },
{ "keytab", 'k', POPT_ARG_STRING, &keytab, 0, "File were to store the keytab information", "Keytab File Name" },
{ "bindpw", 'w', POPT_ARG_STRING, &bindpw, 0, "LDAP password", "password to use if not using kerberos" },
{ NULL, 0, POPT_ARG_NONE, NULL, 0, NULL, NULL }
@@ -675,7 +679,7 @@ main(int argc, char **argv) {
ret = check_perms(keytab);
if (ret == 0)
- ret = join(hostname, bindpw, keytab, quiet);
+ ret = join(server, hostname, bindpw, keytab, quiet);
exit(ret);
}