version 1.6, 2012/02/04 21:22:32 |
version 1.7, 2013/06/03 17:04:35 |
|
|
{ "branch", RCS_TOK_BRANCH}, |
{ "branch", RCS_TOK_BRANCH}, |
{ "branches", RCS_TOK_BRANCHES}, |
{ "branches", RCS_TOK_BRANCHES}, |
{ "comment", RCS_TOK_COMMENT}, |
{ "comment", RCS_TOK_COMMENT}, |
|
{ "commitid", RCS_TOK_COMMITID}, |
{ "date", RCS_TOK_DATE}, |
{ "date", RCS_TOK_DATE}, |
{ "desc", RCS_TOK_DESC}, |
{ "desc", RCS_TOK_DESC}, |
{ "expand", RCS_TOK_EXPAND}, |
{ "expand", RCS_TOK_EXPAND}, |
|
|
static int rcsparse_token(RCSFILE *, int); |
static int rcsparse_token(RCSFILE *, int); |
static void rcsparse_warnx(RCSFILE *, char *, ...); |
static void rcsparse_warnx(RCSFILE *, char *, ...); |
static int valid_login(char *); |
static int valid_login(char *); |
|
static int valid_commitid(char *); |
|
|
/* |
/* |
* head [REVISION]; |
* head [REVISION]; |
|
|
if (rcsparse_token(rfp, RCS_TYPE_COMMITID) != RCS_TYPE_COMMITID) |
if (rcsparse_token(rfp, RCS_TYPE_COMMITID) != RCS_TYPE_COMMITID) |
return (1); |
return (1); |
|
|
/* XXX - do something with commitid */ |
pdp->rp_delta->rd_commitid = pdp->rp_value.str; |
|
|
return (rcsparse_token(rfp, RCS_TOK_SCOLON) != RCS_TOK_SCOLON); |
return (rcsparse_token(rfp, RCS_TOK_SCOLON) != RCS_TOK_SCOLON); |
} |
} |
|
|
|
|
switch (allowed) { |
switch (allowed) { |
case RCS_TYPE_COMMITID: |
case RCS_TYPE_COMMITID: |
/* XXX validate commitid */ |
if (!valid_commitid(pdp->rp_buf)) { |
|
rcsparse_warnx(rfp, "invalid commitid \"%s\"", |
|
pdp->rp_buf); |
|
return (0); |
|
} |
|
pdp->rp_value.str = xstrdup(pdp->rp_buf); |
break; |
break; |
case RCS_TYPE_LOGIN: |
case RCS_TYPE_LOGIN: |
if (!valid_login(pdp->rp_buf)) { |
if (!valid_login(pdp->rp_buf)) { |
|
|
} |
} |
} |
} |
if ((char *)cp - login_name > _PW_NAME_LEN) |
if ((char *)cp - login_name > _PW_NAME_LEN) |
|
return 0; |
|
return 1; |
|
} |
|
|
|
static int |
|
valid_commitid(char *commitid) |
|
{ |
|
unsigned char *cp; |
|
|
|
/* A-Za-z0-9 */ |
|
for (cp = commitid; *cp ; cp++) { |
|
if (!isalnum(*cp)) |
|
return 0; |
|
} |
|
if ((char *)cp - commitid > RCS_COMMITID_MAXLEN) |
return 0; |
return 0; |
return 1; |
return 1; |
} |
} |