works!
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@86 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
2966031319
commit
926f3e4af4
2
config.l
2
config.l
|
@ -29,7 +29,7 @@ LONGCOMMENT "/*"
|
||||||
|
|
||||||
%% /* BEGIN RULES SECTION */
|
%% /* BEGIN RULES SECTION */
|
||||||
|
|
||||||
{NUMBER} { yylval.i = atoi(yytext); }
|
{NUMBER} { yylval.i = atoi(yytext); return TYPE_NUMBER; }
|
||||||
{VALUE} {
|
{VALUE} {
|
||||||
yytext[yyleng - 1] = '\0'; /* Kill the trailing quote */
|
yytext[yyleng - 1] = '\0'; /* Kill the trailing quote */
|
||||||
yytext++; /* Kill the leading quote */
|
yytext++; /* Kill the leading quote */
|
||||||
|
|
14
config.y
14
config.y
|
@ -105,21 +105,31 @@ KeyPair: KeyType '=' TYPE_VALUE {
|
||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| KeyType '=' TYPE_NUMBER {
|
| KeyType '=' TYPE_NUMBER {
|
||||||
|
if (!myconfig)
|
||||||
|
myconfig = calloc(1, sizeof(struct dg_config));
|
||||||
|
|
||||||
switch ($1)
|
switch ($1)
|
||||||
{
|
{
|
||||||
case TYPE_SUID:
|
case TYPE_SUID:
|
||||||
if (!myconfig->shed_user && getpwuid($3) != NULL)
|
if (!myconfig->shed_user)
|
||||||
|
{
|
||||||
|
if (getpwuid($3) != NULL)
|
||||||
myconfig->shed_uid = $3;
|
myconfig->shed_uid = $3;
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%s: no such uid %lu\n", config, $3);
|
fprintf(stderr, "%s: no such uid %lu\n", config, $3);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SGID:
|
case TYPE_SGID:
|
||||||
if (!myconfig->shed_group && getgrgid($3) != NULL)
|
if (!myconfig->shed_group)
|
||||||
|
{
|
||||||
|
if (getgrgid($3) != NULL)
|
||||||
myconfig->shed_gid = $3;
|
myconfig->shed_gid = $3;
|
||||||
else
|
else
|
||||||
fprintf(stderr, "%s: no such gid %lu\n", config, $3);
|
fprintf(stderr, "%s: no such gid %lu\n", config, $3);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_MAX:
|
case TYPE_MAX:
|
||||||
|
|
Loading…
Reference in New Issue