Add API: set-wrappid-path.
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 3 Jan 2012 17:36:15 +0000 (17:36 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 3 Jan 2012 17:36:15 +0000 (17:36 +0000)
And remove the hard-coded path.

APIs/handle.api
lib/connect.c
lib/internal.h
lib/proto-ssh.c
lib/wrappi.c

index 6cbab8d..7afab28 100644 (file)
@@ -21,3 +21,4 @@ entry_point local void connect ()
 enum scheme ["local"; "ssh"]
 entry_point local void set_scheme (enum scheme scheme)
 entry_point local void set_hostname (string hostname)
+entry_point local void set_wrappid_path (string wrappid)
index e75ba53..bb28e19 100644 (file)
@@ -66,6 +66,18 @@ wrap_set_hostname (wrap_h *w, const char *hostname)
 }
 
 void
+wrap_set_wrappid_path (wrap_h *w, const char *wrappid)
+{
+  if (wrappid == NULL || strlen (wrappid) == 0 || wrappid[0] != '/') {
+    set_error ("invalid path");
+    return;
+  }
+  w->wrappid_path = strdup (wrappid);
+  if (!w->wrappid_path)
+    set_error_errno ("strdup");
+}
+
+void
 wrap_int_make_request (wrap_h *w, int proc_nr, const void *args, void *ret)
 {
   switch (w->scheme) {
index 311f030..1c98ca4 100644 (file)
@@ -63,6 +63,7 @@ struct wrap_h {
    */
   wrap_scheme_enum scheme;
   char *hostname;
+  char *wrappid_path;
 };
 
 /* Declare an error, setting the error field in the handle. */
index 1b505f5..090d91f 100644 (file)
@@ -69,7 +69,7 @@ wrap_int_connect_ssh (wrap_h *w)
             "ssh",
             "-T", "-o", "BatchMode=yes", "-e", "none",
             w->hostname,
-            "sh", "-c", /*XXX*/ "/home/rjones/d/wrappi/daemon/wrappid",
+            "sh", "-c", w->wrappid_path ? : "wrappid",
             NULL);
     perror ("ssh");
     _exit (EXIT_FAILURE);
index 3ea0449..6c31c70 100644 (file)
@@ -52,6 +52,7 @@ wrap_close (wrap_h *w)
     fclose (w->wfp);
 
   free (w->hostname);
+  free (w->wrappid_path);
   free (w);
 }