]> skyeroc.xyz Git - dgamelaunch/commitdiff
Add config file command "chpasswd" which will prompr user to change his password...
authorPasi Kallinen <paxed@alt.org>
Sun, 13 Jan 2008 18:12:20 +0000 (18:12 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 13 Jan 2008 18:12:20 +0000 (18:12 +0000)
Also, remove dgl-wall from Makefile, because it doesn't work anymore.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@417 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

Makefile.in
config.l
config.y
dgamelaunch.h
dgl-common.c
examples/dgamelaunch.conf

index 4928f62405aa078a7f39928bec0e442061a07d4a..fc904c747e177deac4f25bef6c6b512962a3af8e 100644 (file)
@@ -22,21 +22,17 @@ EDITOR = @EDITOR@
 STATIC_SRCS = $(EDITOR) dgl-common.c ttyrec.c dgamelaunch.c io.c ttyplay.c mygetnstr.c stripgfx.c strlcpy.c strlcat.c @SETPROCTITLE_C@
 DYN_SRCS = y.tab.c lex.yy.c
 EXTRA_SRCS = nethackstub.c
-DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS) dgl-wall.c
+DEP_SRCS := $(STATIC_SRCS) $(EXTRA_SRCS)
 SRCS := $(STATIC_SRCS) $(DYN_SRCS)
 OBJS = $(SRCS:.c=.o)
-WALL_OBJS = y.tab.o lex.yy.o dgl-common.o dgl-wall.o strlcat.o strlcpy.o
 
-all: .depend $(NAME) dgl-wall
+all: .depend $(NAME)
 
 $(NAME): $(OBJS)
        $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
 
-dgl-wall: $(WALL_OBJS)
-       $(CC) $(CFLAGS) -o $@ $(WALL_OBJS) $(LIBS)
-       
 clean:
-       rm -f $(NAME) nethackstub dgl-wall
+       rm -f $(NAME) nethackstub
        rm -f *.o *~ y.tab.* lex.yy.c .depend .depend.bak
 
 distclean: clean
index 82ed757ab7be2e0c97be1d93214cbea8059ac90c..9f53925c01f4ee226f50f1ba71409b98e1c2716a 100644 (file)
--- a/config.l
+++ b/config.l
@@ -92,6 +92,7 @@ ifnxcp                { yylval.i = DGLCMD_IF_NX_CP; return TYPE_DGLCMD2; }
 unlink         { yylval.i = DGLCMD_UNLINK; return TYPE_DGLCMD1; }
 setenv         { yylval.i = DGLCMD_SETENV; return TYPE_DGLCMD2; }
 exec           { yylval.i = DGLCMD_EXEC;   return TYPE_DGLCMD2; }
+chpasswd       { yylval.i = DGLCMD_CHPASSWD;   return TYPE_DGLCMD0; }
 DEFINE         { return TYPE_DEFINE_GAME; }
 
 
index 1a356618e66b22b792ee9862fba3d3d9e1b04d5b..b18b6137bdfa4d49cf03ead00c2192e96b0d45f4 100644 (file)
--- a/config.y
+++ b/config.y
@@ -43,7 +43,7 @@ static const char* lookup_token (int t);
 %token <s> TYPE_VALUE
 %token <i> TYPE_NUMBER TYPE_CMDQUEUENAME
 %type  <kt> KeyType
-%token <i> TYPE_DGLCMD1 TYPE_DGLCMD2
+%token <i> TYPE_DGLCMD0 TYPE_DGLCMD1 TYPE_DGLCMD2
 %token TYPE_DEFINE_GAME
 %token <i> TYPE_BOOL
 
@@ -368,6 +368,21 @@ dglcmd     : TYPE_DGLCMD1 TYPE_VALUE
 
              }
          }
+       | TYPE_DGLCMD0
+         {
+             struct dg_cmdpart *tmp = malloc(sizeof(struct dg_cmdpart));
+             if (tmp) {
+                 struct dg_cmdpart *foo = curr_cmdqueue;
+                 if (foo) {
+                     while (foo->next) foo = foo->next;
+                     foo->next = tmp;
+                 } else curr_cmdqueue = tmp;
+                 tmp->next = NULL;
+                 tmp->param1 = NULL;
+                 tmp->param2 = NULL;
+                 tmp->cmd = $<i>1;
+             }
+         }
        | TYPE_DGLCMD2 TYPE_VALUE TYPE_VALUE
          {
              struct dg_cmdpart *tmp = malloc(sizeof(struct dg_cmdpart));
index 39a05d531325e7911c451d2be6de8a6b4b3b1b43..a9a2fe5355fa592db0e79d31d5398b40c586e82f 100644 (file)
@@ -103,7 +103,8 @@ typedef enum
     DGLCMD_CP,         /* cp foo bar */
     DGLCMD_UNLINK,     /* unlink foo */
     DGLCMD_EXEC,       /* exec foo bar */
-    DGLCMD_SETENV      /* setenv foo bar */
+    DGLCMD_SETENV,     /* setenv foo bar */
+    DGLCMD_CHPASSWD    /* chpasswd */
 } dglcmd_actions;
 
 typedef enum
index a9ec2d650c72a021dcb5e093c169f7f6883bcc4f..603713a4bdf029f7669211cdf50d3626826321be 100644 (file)
@@ -197,6 +197,9 @@ dgl_exec_cmdqueue(struct dg_cmdpart *queue, int game, struct dg_user *me)
        case DGLCMD_SETENV:
            if (p1 && p2) mysetenv(p1, p2, 1);
            break;
+       case DGLCMD_CHPASSWD:
+           if (loggedin) changepw(1);
+           break;
        }
        free(p1);
        free(p2);
index dd2c09265077e55612b05be36fd432294f659182..8693f7d419b00b1555b9944de0eda8e0d42df219 100644 (file)
@@ -75,6 +75,7 @@ lockfile = "/dgl-lock"
 #   unlink "foo"      = deletes file "foo"
 #   setenv "foo "bar" = sets environment variable "foo" to "bar"
 #   exec "foo" "bar"  = execute "foo" with "bar" as it's param
+#   chpasswd          = do the change password prompting, if logged in
 #
 # The commands will be done inside the chroot and with the uid and gid
 # defined above.