patches/gnome-system-tools-02-forkpty.diff
author dc144907
Fri, 04 Aug 2006 09:34:07 +0000
changeset 7859 8517272aace0
child 8394 bcd58bae020d
permissions -rw-r--r--
Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can be bumped.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7859
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     1
diff -u ./src/common/gst-auth.c-clean ./src/common/gst-auth.c
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     2
--- ./src/common/gst-auth.c-clean	Tue May  9 13:09:57 2006
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     3
+++ ./src/common/gst-auth.c	Thu May 11 16:18:00 2006
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     4
@@ -43,6 +43,13 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     5
 #ifdef __FreeBSD__
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     6
 # include <errno.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     7
 # include <libutil.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     8
+#elif defined(__sun)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
     9
+#include <fcntl.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    10
+#include <unistd.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    11
+#include <stdlib.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    12
+#include <sys/ioctl.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    13
+#include <sys/stream.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    14
+#include <sys/stropts.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    15
 #else
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    16
 #include <pty.h>
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    17
 #endif
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    18
@@ -53,6 +60,10 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    19
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    20
 #define GST_AUTH_RESPONSE_NP 1
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    21
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    22
+#ifdef __sun
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    23
+#define EMBEDDED_SU "/usr/lib/embedded_su"
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    24
+#endif /* __sun */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    25
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    26
 static int root;			/* if we are root, no password is
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    27
 					   required */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    28
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    29
@@ -118,6 +129,122 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    30
 	return TRUE;	
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    31
 }
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    32
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    33
+#ifdef __sun
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    34
+/* forkpty() rmplacement for Solaris.
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    35
+ * This ignore the last two arguments
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    36
+ * for the moment
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    37
+ */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    38
+#ifdef NOPTY
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    39
+/*
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    40
+ * This is implemented using pipes instead of pseudo tty to avoid
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    41
+ * bug 4907342.
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    42
+ */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    43
+static
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    44
+int forkpty (int *amaster, char *name, void *unused1, void *unused2)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    45
+{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    46
+	pid_t pid;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    47
+	int pp[2];
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    48
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    49
+	pipe (pp);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    50
+	pid = fork ();
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    51
+	switch (pid)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    52
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    53
+	case -1: /* Error */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    54
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    55
+	case 0: /* Child */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    56
+		if (setsid() < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    57
+			return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    58
+		close (pp[1]);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    59
+		dup2 (pp[0], 0);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    60
+		return 0;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    61
+	default: /* Parent */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    62
+		close (pp[0]);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    63
+		*amaster = pp[1];
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    64
+		return pid;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    65
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    66
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    67
+	return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    68
+}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    69
+#else
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    70
+int forkpty (int *amaster, char *name, void *unused1, void *unused2)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    71
+{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    72
+	int master, slave, fd;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    73
+	char *slave_name;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    74
+	pid_t pid;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    75
+	void (*sig_saved)(int);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    76
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    77
+	master = open("/dev/ptmx", O_RDWR | O_NOCTTY);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    78
+	if (master < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    79
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    80
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    81
+	sig_saved = signal (SIGCHLD, SIG_DFL);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    82
+	if (grantpt (master) < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    83
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    84
+		signal (SIGCHLD, sig_saved);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    85
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    86
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    87
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    88
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    89
+	if (unlockpt (master) < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    90
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    91
+		signal (SIGCHLD, sig_saved);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    92
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    93
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    94
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    95
+	signal (SIGCHLD, sig_saved);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    96
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    97
+	slave_name = ptsname (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    98
+	if (slave_name == NULL)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
    99
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   100
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   101
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   102
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   103
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   104
+	slave = open (slave_name, O_RDWR | O_NOCTTY);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   105
+	if (slave < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   106
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   107
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   108
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   109
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   110
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   111
+	if (ioctl (slave, I_PUSH, "ptem") < 0
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   112
+	    || ioctl (slave, I_PUSH, "ldterm") < 0
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   113
+	    || ioctl (slave, I_PUSH, "ttcompat") < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   114
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   115
+		close (slave);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   116
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   117
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   118
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   119
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   120
+	if (amaster)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   121
+		*amaster = master;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   122
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   123
+	if (name)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   124
+		strcpy (name, slave_name);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   125
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   126
+	pid = fork ();
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   127
+	switch (pid)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   128
+	{
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   129
+	case -1: /* Error */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   130
+		return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   131
+	case 0: /* Child */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   132
+		if (setsid() < 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   133
+			return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   134
+		close (master);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   135
+		dup2 (slave, STDIN_FILENO);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   136
+		dup2 (slave, STDOUT_FILENO);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   137
+		dup2 (slave, STDERR_FILENO);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   138
+		return 0;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   139
+	default: /* Parent */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   140
+		close (slave);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   141
+		return pid;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   142
+	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   143
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   144
+	return -1;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   145
+}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   146
+#endif
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   147
+#endif
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   148
+
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   149
 /* runs a term with su in it */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   150
 static void
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   151
 gst_auth_run_term (GstTool *tool, gchar *args[])
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   152
@@ -177,8 +304,15 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   153
 	gchar        *s, *str;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   154
 	gint          ret;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   155
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   156
+#if defined(__sun) && defined (EMBEDDED_SU)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   157
+        gst_tool_write_to_backend(tool, (gchar*)".\n"); /* Send empty text block to start conversation */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   158
+#endif
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   159
 	while (!cont) {
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   160
+#if defined(__sun) && defined (EMBEDDED_SU)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   161
+		s   = gst_tool_read_from_backend (tool, "SUCCESS", "\n.\n", NULL); /* Look for end of text block - a period (.) on a line by itself */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   162
+#else
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   163
 		s   = gst_tool_read_from_backend (tool, "assword:", "/no)?", "\n", NULL);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   164
+#endif /* __sun */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   165
 		str = g_ascii_strup (s, -1);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   166
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   167
 		/* FIXME: hope that someday we can get rid of this ssh output string parsing */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   168
@@ -189,6 +323,11 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   169
 			/* it's asking for the password */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   170
 			cont = TRUE;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   171
 			ret  = GST_AUTH_PASSWORD;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   172
+#if defined(__sun) && defined (EMBEDDED_SU)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   173
+		} else if (g_strrstr (str, "SUCCESS") != NULL) {
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   174
+			cont = TRUE;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   175
+			ret  = GST_AUTH_PASSWORDLESS;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   176
+#endif /* __sun */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   177
 		} else if (g_strrstr (str, "\n") != NULL) {
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   178
 			/* this is the last case to test, it's the CR
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   179
 			   used to synchronize communication */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   180
@@ -296,6 +435,12 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   181
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   182
 		if (strlen (password) > 0)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   183
 			memset (password, 0, strlen (password));
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   184
+#if defined(__sun) && defined (EMBEDDED_SU) && 0
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   185
+                {
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   186
+                    gchar *s  = gst_tool_read_from_backend (tool, "\n.\n", "SUCCESS", "\n", NULL);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   187
+                    g_free(s);
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   188
+                }
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   189
+#endif /* __sun */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   190
 	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   191
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   192
 	tool->root_access = ROOT_ACCESS_REAL;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   193
@@ -378,7 +523,11 @@
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   194
 	}
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   195
 
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   196
 	/* these are the su args */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   197
+#if defined(__sun) && defined (EMBEDDED_SU)
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   198
+	su_args[0] = EMBEDDED_SU;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   199
+#else
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   200
 	su_args[0] = SU_PATH;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   201
+#endif /* __sun */
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   202
 	su_args[1] = "root";
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   203
 	su_args[2] = "-c";
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   204
 	su_args[3] = command->str;
8517272aace0 Unbump gnome-system-tools back to 2.14.0. Other modules need work before it can
dc144907
parents:
diff changeset
   205