/*
- * $Id: volume.c,v 1.36.2.1 2002-10-19 23:33:36 jmarcus Exp $
+ * $Id: volume.c,v 1.36.2.5 2003-09-18 19:24:54 bfernhomberg Exp $
*
* Copyright (c) 1990,1993 Regents of The University of Michigan.
* All Rights Reserved. See COPYRIGHT.
{
char *val;
+ LOG(log_debug, logtype_afpd, "Parsing volset %s", tmp);
+
val = strchr(tmp, ':');
- LOG(log_debug, logtype_afpd, "Parsing volset %s", val);
+ if (!val) {
+ /* we'll assume it's a volume name. */
+ strncpy(volname, tmp, vlen);
- if (optionok(tmp, "allow:", val)) {
+ } else if (optionok(tmp, "allow:", val)) {
if (options[VOLOPT_ALLOW].c_value)
free(options[VOLOPT_ALLOW].c_value);
options[VOLOPT_ALLOW].c_value = strdup(val + 1);
#endif /* FORCE_UIDGID */
- } else if (val) {
+ } else {
/* ignore unknown options */
LOG(log_debug, logtype_afpd, "ignoring unknown volume option: %s", tmp);
- } else {
- /* we'll assume it's a volume name. */
- strncpy(volname, tmp, vlen);
}
}
int c;
p = buf;
- while ((( c = getc( fp )) != EOF ) && ( size > 0 )) {
+ while ((EOF != ( c = getc( fp )) ) && ( size > 0 )) {
if ( c == '\n' || c == '\r' ) {
*p++ = '\n';
break;
LOG(log_error, logtype_afpd, "setextmap: calloc: %s", strerror(errno) );
return;
}
-
}
ext++;
for ( em = extmap, cnt = 0; em->em_ext; em++, cnt++) {
} else {
memcpy(em->em_creator, creator, sizeof( em->em_creator ));
}
-
- if ( !*ext ) {
- defextmap = em;
- }
}
/* -------------------------- */
{
struct extmap *em;
+ extmap_cnt = 0;
if ((em = extmap) == NULL) {
return;
}
- extmap_cnt = 0;
while (em->em_ext) {
em++;
extmap_cnt++;
}
if (extmap_cnt) {
qsort(extmap, extmap_cnt, sizeof(struct extmap), extmap_cmp);
+ defextmap = extmap;
}
}
strcat( path, p2 );
}
- if (( fp = fopen( path, "r" )) == NULL ) {
+ if (NULL == ( fp = fopen( path, "r" )) ) {
return( -1 );
}
path + VOLOPT_DEFAULT_LEN) < 0)
break;
volset(save_options, tmp, sizeof(tmp) - 1,
- obj->options.nlspath, path + VOLOPT_DEFAULT_LEN,
- obj, pwent);
-
+ obj->options.nlspath, path + VOLOPT_DEFAULT_LEN,
+ obj, pwent);
}
}
break;
break;
volset(options, volname, sizeof(volname) - 1,
- obj->options.nlspath, tmp, obj, pwent);
+ obj->options.nlspath, tmp, obj, pwent);
}
/* check allow/deny lists:
ad_setentrylen( &ad, ADEID_NAME, strlen( slash ));
memcpy(ad_entry( &ad, ADEID_NAME ), slash,
ad_getentrylen( &ad, ADEID_NAME ));
+ ad_setdate(ad, AD_DATE_CREATE | AD_DATE_UNIX, st->st_mtime);
ad_flush(&ad, ADFLAGS_HF);
}
if ((vol->v_flags & AFPVOL_RO) ||
((utime(vol->v_path, NULL) < 0) && (errno == EROFS)))
ashort |= VOLPBIT_ATTR_RO;
-#ifdef WITH_CATSEARCH
ashort |= VOLPBIT_ATTR_CATSEARCH;
-#endif
ashort = htons(ashort);
memcpy(data, &ashort, sizeof( ashort ));
data += sizeof( ashort );
*rbuflen = 0;
ibuf += 2;
memcpy(&vid, ibuf, sizeof( vid ));
- if (( vol = getvolbyvid( vid )) == NULL ) {
+ if (NULL == ( vol = getvolbyvid( vid )) ) {
return( AFPERR_PARAM );
}
curdir = ovol->v_dir;
}
}
-
dirfree( vol->v_root );
vol->v_dir = NULL;
#ifdef CNID_DB
char *p;
struct extmap *em;
- if (( p = strrchr( path, '.' )) == NULL ) {
+ if (NULL == ( p = strrchr( path, '.' )) ) {
return( defextmap );
}
p++;
memcpy(&bitmap, ibuf, sizeof( bitmap ));
bitmap = ntohs( bitmap );
- if (( vol = getvolbyvid( vid )) == NULL ) {
+ if (NULL == ( vol = getvolbyvid( vid )) ) {
*rbuflen = 0;
return( AFPERR_PARAM );
}