Add config file command "chpasswd" which will prompr user to change his password, if logged in.
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
This commit is contained in:
parent
979f455eb0
commit
7d639dea61
10
Makefile.in
10
Makefile.in
|
@ -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
|
||||
|
|
1
config.l
1
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; }
|
||||
|
||||
|
||||
|
|
17
config.y
17
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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue