version 1.47, 2006/07/04 03:53:54 |
version 1.48, 2008/02/02 20:56:46 |
Line 75 __weak_alias(cgetnum,_cgetnum) |
|
Line 75 __weak_alias(cgetnum,_cgetnum) |
|
__weak_alias(cgetset,_cgetset) |
__weak_alias(cgetset,_cgetset) |
__weak_alias(cgetstr,_cgetstr) |
__weak_alias(cgetstr,_cgetstr) |
__weak_alias(cgetustr,_cgetustr) |
__weak_alias(cgetustr,_cgetustr) |
|
__weak_alias(csetexpandtc,_csetexpandtc) |
#endif |
#endif |
|
|
#define BFRAG 1024 |
#define BFRAG 1024 |
Line 90 __weak_alias(cgetustr,_cgetustr) |
|
Line 91 __weak_alias(cgetustr,_cgetustr) |
|
static size_t topreclen; /* toprec length */ |
static size_t topreclen; /* toprec length */ |
static char *toprec; /* Additional record specified by cgetset() */ |
static char *toprec; /* Additional record specified by cgetset() */ |
static int gottoprec; /* Flag indicating retrieval of toprecord */ |
static int gottoprec; /* Flag indicating retrieval of toprecord */ |
|
static int expandtc = 1; /* flag to expand tc= or not */ |
|
|
#ifndef SMALL |
#ifndef SMALL |
static int cdbget(DB *, char **, const char *); |
static int cdbget(DB *, char **, const char *); |
Line 225 cgetent(char **buf, const char * const * |
|
Line 227 cgetent(char **buf, const char * const * |
|
return getent(buf, &dummy, db_array, -1, name, 0, NULL); |
return getent(buf, &dummy, db_array, -1, name, 0, NULL); |
} |
} |
|
|
|
void |
|
csetexpandtc(int etc) |
|
{ |
|
expandtc = etc; |
|
} |
|
|
/* |
/* |
* Getent implements the functions of cgetent. If fd is non-negative, |
* Getent implements the functions of cgetent. If fd is non-negative, |
* *db_array has already been opened and fd is the open file descriptor. We |
* *db_array has already been opened and fd is the open file descriptor. We |
Line 317 getent(char **cap, size_t *len, const ch |
|
Line 325 getent(char **cap, size_t *len, const ch |
|
} else { |
} else { |
#ifndef SMALL |
#ifndef SMALL |
(void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p); |
(void)snprintf(pbuf, sizeof(pbuf), "%s.db", *db_p); |
if ((capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0)) |
if (expandtc && |
|
(capdbp = dbopen(pbuf, O_RDONLY, 0, DB_HASH, 0)) |
!= NULL) { |
!= NULL) { |
free(record); |
free(record); |
retval = cdbget(capdbp, &record, name); |
retval = cdbget(capdbp, &record, name); |
Line 504 getent(char **cap, size_t *len, const ch |
|
Line 513 getent(char **cap, size_t *len, const ch |
|
* Got the capability record, but now we have to expand all tc=name |
* Got the capability record, but now we have to expand all tc=name |
* references in it ... |
* references in it ... |
*/ |
*/ |
tc_exp: { |
tc_exp: |
|
tc_not_resolved = 0; |
|
if (expandtc) { |
char *newicap, *s; |
char *newicap, *s; |
size_t ilen, newilen; |
size_t ilen, newilen; |
int diff, iret, tclen; |
int diff, iret, tclen; |
|
|
* scanned for tc=name constructs. |
* scanned for tc=name constructs. |
*/ |
*/ |
scan = record; |
scan = record; |
tc_not_resolved = 0; |
|
for (;;) { |
for (;;) { |
if ((tc = cgetcap(scan, "tc", '=')) == NULL) |
if ((tc = cgetcap(scan, "tc", '=')) == NULL) |
break; |
break; |