]> skyeroc.xyz Git - dgamelaunch/commitdiff
Merge commits from http://git.develz.org/?p=dgamelaunch.git
authorPasi Kallinen <paxed@alt.org>
Sat, 17 Mar 2012 12:45:53 +0000 (14:45 +0200)
committerPasi Kallinen <paxed@alt.org>
Sat, 17 Mar 2012 12:45:53 +0000 (14:45 +0200)
 - Allow DGLAUTH as additional variable to pass login data,
   prioritized ahead of USER and LOGNAME. (Marc H. Thoben)
 - Empty autologin variables before running any external
   software. (Edoardo Spadolini)
 - Remove -f parameter to prevent privilege escalation.
   (Edoardo Spadolini)

Update documentation to reflect the changes.

README
dgamelaunch.c

diff --git a/README b/README
index dbb6dd819fc65dd1cf1f6d1a2626d0f50a1fefbc..2b261dbe082d92c8eba5f9f0d3aa35239396f751 100644 (file)
--- a/README
+++ b/README
@@ -10,9 +10,9 @@ Crawl (http://crawl.develz.org).
 DGAMELAUNCH VERSIONS
 ====================
 
-Development version can be fetched from the source repository with subversion:
+Development version can be fetched from the source repository with git:
 
-  svn co svn://triplehelix.org/dgamelaunch/trunk
+  git clone git://github.com/paxed/dgamelaunch.git
 
 Releases are downloadable at http://alt.org/nethack/dgamelaunch/
 
@@ -153,7 +153,6 @@ COMMANDLINE PARAMETERS
 
  -a            Ignored.
  -e            Ignored.
- -f file       Read configuration from file.
  -h            Ignored.
  -i user       Autologin and run the register -command hook for "user"
                (with password "user").
@@ -173,6 +172,7 @@ ENVIRONMENT VARIABLES
  while FreeBSD does not.  FreeBSD, on the other hand, does allow the LOGNAME
  environment variable.  Dgamelaunch will first check USER, then LOGNAME,
  for "username:password", and tries autologin if either exists.
+ Dgamelaunch-specific DGLAUTH is checked before either of those.
 
 
 ERROR CODES
index 17b6c2d621409fefb0fc914921c0b45e5e20e0d5..5a385f78397a344b926681e3035bfa477cb53f2a 100644 (file)
@@ -2594,12 +2594,16 @@ main (int argc, char** argv)
   argv = saved_argv;
 #endif
 
-  p = getenv("USER");
+  p = getenv("DGLAUTH");
 
   /* Linux telnetd allows importing the USER envvar via telnet,
    * while FreeBSD does not.  FreeBSD, on the other hand, does allow
    * the LOGNAME envvar.  Check USER first, then LOGNAME.
    */
+  if (p == NULL) {
+      p = getenv("USER");
+  }
+
   if (p == NULL) {
       p = getenv("LOGNAME");
   }
@@ -2608,9 +2612,12 @@ main (int argc, char** argv)
     auth = strdup(p);
   /* else auth is still NULL */
 
+  /* just to be sure */
+  unsetenv("DGLAUTH"); unsetenv("USER"); unsetenv("LOGNAME");
+
   __progname = basename(strdup(argv[0]));
 
-  while ((c = getopt(argc, argv, "sqh:pf:i:aeW:SD")) != -1)
+  while ((c = getopt(argc, argv, "sqh:pi:aeW:SD")) != -1)
   {
     switch (c)
     {
@@ -2620,17 +2627,6 @@ main (int argc, char** argv)
       case 'q':
        silent = 1; break;
 
-      case 'f':
-       if (config)
-       {
-         if (!silent)
-           fprintf(stderr, "warning: using %s\n", argv[optind]);
-         free(config);
-       }
-
-       config = strdup(optarg);
-       break;
-
       case 'i':
        if (optarg && *optarg != '\0') {
                if (p && *p != '\0')