1
0
Просмотр исходного кода

Support port numbers on host definition

Héctor García 11 лет назад
Родитель
Сommit
5adcc5bf54
3 измененных файлов с 34 добавлено и 13 удалено
  1. 6 0
      AUTHORS
  2. 2 0
      ChangeLog
  3. 26 13
      src/mssh-terminal.c

+ 6 - 0
AUTHORS

@@ -5,3 +5,9 @@ Current Developer:
 Founder and Lead Developer:
 ----------------------------------------------------------------------------
     Bradley Smith  <[email protected]> (United Kingdom)
+
+Contributors
+----------------------------------------------------------------------------
+    Francisco Licerán <[email protected]>
+    Mario J. Barchéin <[email protected]>
+    Oscar Fernandez <[email protected]>

+ 2 - 0
ChangeLog

@@ -2,6 +2,8 @@
 
     Added patch from Oscar Fernandez to support comments on configuration archive
 
+    Added patch from Mario J. Barchéin and Francisco Licerán to support port numbers on host
+
 2014-01-15  Héctor García  <[email protected]>
 
     Bumped version to 1.3 gtk2 deprecated symbols free

+ 26 - 13
src/mssh-terminal.c

@@ -40,23 +40,36 @@ void mssh_terminal_init_session(MSSHTerminal *terminal, char *hostname)
 
 void mssh_terminal_start_session(MSSHTerminal *terminal, char **env)
 {
-    char *args[3];
+    char *args[5];
+    char *fullhost;
+    char *host = NULL;
+    char *port = NULL;
+
+    fullhost = strdup(terminal->hostname);
+    host = strtok(fullhost, ":");
+    port = strtok(NULL, "");
 
     args[0] = strdup("ssh");
     args[1] = terminal->hostname;
-    args[2] = NULL;
-
-    vte_terminal_fork_command_full(  VTE_TERMINAL(terminal), 
-                                     VTE_PTY_DEFAULT,
-                                     NULL,  /* working dir */
-                                     args,
-                                     env, 
-                                     G_SPAWN_SEARCH_PATH,
-                                     NULL,  /* child_setup */
-                                     NULL,  /* child_setup_data */
-                                     NULL,  /* *child_pid */
-                                     NULL); /* Error handling */
 
+    if (!port)
+        args[2] = NULL;
+    else {
+         args[2] = "-p";
+         args[3] = port;
+         args[4] = NULL;
+    }
+
+    vte_terminal_fork_command_full(VTE_TERMINAL(terminal),
+                                   VTE_PTY_NO_LASTLOG|VTE_PTY_NO_UTMP|VTE_PTY_NO_WTMP,
+                                   NULL,  /* working dir */
+                                   args,
+                                   env,
+                                   G_SPAWN_SEARCH_PATH,
+                                   NULL,  /* child_setup */
+                                   NULL,  /* child_setup_data */
+                                   NULL,  /* *child_pid */
+                                   NULL); /* Error handling */
 
     free(args[0]);
 }