]> git.wh0rd.org - dump.git/blobdiff - common/dumprmt.c
Restore uid and gid before invoking external RSH.
[dump.git] / common / dumprmt.c
index 072b0f50d1c4fbab6733a6f6bb465d4a17d665a7..4f6b3c790e674f224362dd704e39be4631efdf2f 100644 (file)
@@ -2,7 +2,7 @@
  *     Ported to Linux's Second Extended File System as part of the
  *     dump and restore backup suit
  *     Remy Card <card@Linux.EU.Org>, 1994-1997
- *     Stelian Pop <pop@cybercable.fr>, 1999
+ *     Stelian Pop <pop@cybercable.fr>, 1999-2000
  */
 
 /*-
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: dumprmt.c,v 1.10 2000/01/17 16:32:44 stelian Exp $";
+       "$Id: dumprmt.c,v 1.12 2000/11/03 18:28:58 stelian Exp $";
 #endif /* not lint */
 
 #ifdef __linux__
@@ -205,6 +205,12 @@ rmtgetconn(void)
                rshcmd[4] = rmt;
                rshcmd[5] = NULL;
 
+               /* Restore the uid and gid. We really don't want
+                * to execute whatever is put into RSH variable with
+                * more priviledges than needed... */
+               setuid(getuid());
+               setgid(getgid());
+
                if ((rshpid = piped_child(rshcmd)) < 0) {
                        msg("cannot open connection\n");
                        return 0;