AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h)
AC_CHECK_HEADERS(windows.h malloc.h winsock2.h direct.h io.h)
-AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h)
+AC_CHECK_HEADERS(security/pam_modules.h siad.h usersec.h ucontext.h regex.h)
if test "$ac_cv_header_security_pam_modules_h" = "yes"; then
HAVE_PAM="yes"
AC_CHECK_FUNCS(utimes random srandom getdtablesize snprintf strlcat strlcpy re_comp re_exec)
AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror)
+
+AC_CHECK_FUNCS(regcomp regexec regerror)
+AC_MSG_CHECKING([for POSIX regex library])
+if test "$ac_cv_header_regex_h" = "yes" && \
+ test "$ac_cv_func_regcomp" = "yes" && \
+ test "$ac_cv_func_regexec" = "yes" && \
+ test "$ac_cv_func_regerror" = "yes"; then
+ AC_DEFINE(HAVE_POSIX_REGEX, 1, [define if you have POSIX regex library])
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
AC_CHECK_TYPE(ssize_t, int)
AC_SIZEOF_TYPE(long)
SHLIB_LINKER="ld -b"
;;
- i386_fbsd_4*)
+ *fbsd_*)
LEX="flex -l"
MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
MT_LIBS="-pthread"
- #MT_CFLAGS='-DAFS_PTHREAD_ENV -D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads ${XCFLAGS}'
- #MT_LIBS="-L/usr/local/lib -llthread -llgcc_r"
PAM_CFLAGS="-O2 -pipe -fPIC"
SHLIB_LDFLAGS="-shared -Xlinker -x"
TXLIBS="-lncurses"
XCFLAGS="-O2 -pipe"
- XLIBS="${LIB_AFSDB} -lcompat"
- YACC="byacc"
- ;;
-
- *fbsd_5*)
- LEX="flex -l"
- MT_CFLAGS='-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}'
- MT_LIBS="-pthread"
- PAM_CFLAGS="-O2 -pipe -fPIC"
- SHLIB_LDFLAGS="-shared -Xlinker -x"
- TXLIBS="-lncurses"
- XCFLAGS="-O2 -pipe"
- XLIBS="${LIB_AFSDB} -lcompat"
YACC="byacc"
;;
SHLIB_LDFLAGS="-shared -Xlinker -x"
TXLIBS="/usr/lib/libcurses.so"
XCFLAGS="-O2 -pipe"
- XLIBS="${LIB_AFSDB} -lcompat"
YACC="yacc"
;;
SHLIB_LDFLAGS="-shared -Xlinker -x"
TXLIBS="/usr/lib/libcurses.so"
XCFLAGS="-O2 -pipe"
- XLIBS="${LIB_AFSDB} -lcompat"
YACC="bison -y"
;;
SHLIB_LDFLAGS="-shared -Xlinker -x"
TXLIBS="/usr/lib/libcurses.a"
XCFLAGS="-O2"
- XLIBS="${LIB_AFSDB} -lcompat"
YACC="yacc"
;;
#ifndef AFS_NT40_ENV
#include <unistd.h>
#endif
+#ifdef HAVE_POSIX_REGEX /* use POSIX regexp library */
+#include <regex.h>
+#endif
extern int smallMem;
extern extent_mod;
int pollcount = 0;
int namematchRWBK, namematchRO, thismatch, matchtype;
char volumename[VL_MAXNAMELEN];
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ int need_regfree = 0;
+#endif
COUNT_REQ(VLLISTATTRIBUTESN2);
vldbentries->nbulkentries_val = 0;
findflag = ((attributes->Mask & VLLIST_FLAG) ? 1 : 0);
if (name && (strcmp(name, ".*") != 0) && (strcmp(name, "") != 0)) {
sprintf(volumename, "^%s$", name);
+#ifdef HAVE_POSIX_REGEX
+ if (regcomp(&re, volumename, REG_BASIC | REG_NOSUB) != 0) {
+ errorcode = VL_BADNAME;
+ goto done;
+ }
+ need_regfree = 1;
+#else
t = (char *)re_comp(volumename);
if (t) {
errorcode = VL_BADNAME;
goto done;
}
+#endif
findname = 1;
}
if (tentry.flags & VLF_RWEXISTS) {
if (findname) {
sprintf(volumename, "%s", tentry.name);
+#ifdef HAVE_POSIX_REGEX
+ if (regexec(&re, volumename, 0, NULL, 0) == 0) {
+ thismatch = VLSF_RWVOL;
+ }
+#else
if (re_exec(volumename)) {
thismatch = VLSF_RWVOL;
}
+#endif
} else {
thismatch = VLSF_RWVOL;
}
if (!thismatch && (tentry.flags & VLF_BACKEXISTS)) {
if (findname) {
sprintf(volumename, "%s.backup", tentry.name);
+#ifdef HAVE_POSIX_REGEX
+ if (regexec(&re, volumename, 0, NULL, 0) == 0) {
+ thismatch = VLSF_BACKVOL;
+ }
+#else
if (re_exec(volumename)) {
thismatch = VLSF_BACKVOL;
}
+#endif
} else {
thismatch = VLSF_BACKVOL;
}
} else {
sprintf(volumename, "%s.readonly",
tentry.name);
+#ifdef HAVE_POSIX_REGEX
+ if (regexec(&re, volumename, 0, NULL, 0) == 0) {
+ thismatch = VLSF_ROVOL;
+ }
+#else
if (re_exec(volumename))
thismatch = VLSF_ROVOL;
+#endif
}
} else {
thismatch = VLSF_ROVOL;
}
done:
+#ifdef HAVE_POSIX_REGEX
+ if (need_regfree)
+ regfree(&re);
+#endif
+
if (errorcode) {
COUNT_ABO;
ubik_AbortTrans(trans);
#endif
#include "volser_prototypes.h"
+#ifdef HAVE_POSIX_REGEX
+#include <regex.h>
+#endif
+
struct tqElem {
afs_int32 volid;
struct tqElem *next;
if (seenprefix) {
for (ti = as->parms[0].items; ti; ti = ti->next) {
if (strncmp(ti->data, "^", 1) == 0) {
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ char errbuf[256];
+
+ code = regcomp(&re, ti->data, REG_BASIC | REG_NOSUB);
+ if (code != 0) {
+ regerror(code, &re, errbuf, sizeof errbuf);
+ fprintf(STDERR,
+ "Unrecognizable -prefix regular expression: '%s': %s\n",
+ ti->data, errbuf);
+ exit(1);
+ }
+ regfree(&re);
+#else
ccode = (char *)re_comp(ti->data);
if (ccode) {
fprintf(STDERR,
ti->data, ccode);
exit(1);
}
+#endif
}
}
}
if (seenxprefix) {
for (ti = as->parms[4].items; ti; ti = ti->next) {
if (strncmp(ti->data, "^", 1) == 0) {
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ char errbuf[256];
+
+ code = regcomp(&re, ti->data, REG_BASIC | REG_NOSUB);
+ if (code != 0) {
+ regerror(code, &re, errbuf, sizeof errbuf);
+ fprintf(STDERR,
+ "Unrecognizable -xprefix regular expression: '%s': %s\n",
+ ti->data, errbuf);
+ exit(1);
+ }
+ regfree(&re);
+#else
ccode = (char *)re_comp(ti->data);
if (ccode) {
fprintf(STDERR,
ti->data, ccode);
exit(1);
}
+#endif
}
}
}
if (seenprefix) {
for (ti = as->parms[0].items; ti; ti = ti->next) {
if (strncmp(ti->data, "^", 1) == 0) {
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ char errbuf[256];
+
+ /* XXX -- should just do the compile once! */
+ code = regcomp(&re, ti->data, REG_BASIC | REG_NOSUB);
+ if (code != 0) {
+ regerror(code, &re, errbuf, sizeof errbuf);
+ fprintf(STDERR,
+ "Error in -prefix regular expression: '%s': %s\n",
+ ti->data, errbuf);
+ exit(1);
+ }
+ match = (regexec(&re, vllist->name, 0, NULL, 0) == 0);
+ regfree(&re);
+#else
ccode = (char *)re_comp(ti->data);
if (ccode) {
fprintf(STDERR,
exit(1);
}
match = (re_exec(vllist->name) == 1);
+#endif
} else {
match =
(strncmp(vllist->name, ti->data, strlen(ti->data)) ==
if (match && seenxprefix) {
for (ti = as->parms[4].items; ti; ti = ti->next) {
if (strncmp(ti->data, "^", 1) == 0) {
+#ifdef HAVE_POSIX_REGEX
+ regex_t re;
+ char errbuf[256];
+
+ /* XXX -- should just do the compile once! */
+ code = regcomp(&re, ti->data, REG_BASIC | REG_NOSUB);
+ if (code != 0) {
+ regerror(code, &re, errbuf, sizeof errbuf);
+ fprintf(STDERR,
+ "Error in -xprefix regular expression: '%s': %s\n",
+ ti->data, errbuf);
+ exit(1);
+ }
+ if (regexec(&re, vllist->name, 0, NULL, 0) == 0)
+ match = 0;
+ regfree(&re);
+#else
ccode = (char *)re_comp(ti->data);
if (ccode) {
fprintf(STDERR,
match = 0;
break;
}
+#endif
} else {
if (strncmp(vllist->name, ti->data, strlen(ti->data)) ==
0) {