/* Abort on error, possibly trapping to debugger or dumping a trace. */
void afs_NTAbort(void);
-#endif /* NT40 */
+#endif /* AFS_NT40_ENV */
typedef char b32_string_t[8];
/* b64_string_t is 8 bytes, in stds.h */
typedef char lb64_string_t[12];
+#ifndef HAVE_STRLCAT
+extern size_t strlcat(char *dst, const char *src, size_t siz);
+#endif
+
+#ifndef HAVE_STRLCPY
+extern size_t strlcpy(char *dst, const char *src, size_t siz);
+#endif
+
#ifndef UKERNEL
#include "afs/ktime.h"
#endif
#include <afsconfig.h>
#include <afs/param.h>
-
RCSID
("$Header$");
#include <stdlib.h>
#endif
+#include "afsutil.h"
+
+/* maximum number of partitions - must match vol/voldefs.h */
+#define VOLMAXPARTS 255
+
/**
* map a partition id from any partition-style name.
*
if (tc >= '0' && tc <= '9') {
temp = atoi(aname);
/* this next check is to make the syntax less ambiguous when discriminating
- * between volume numbers and partition IDs. This less things like
- * bos salvage do some reasonability checks its input w/o checking
+ * between volume numbers and partition IDs. This lets things like
+ * bos salvage do some reasonability checks on its input w/o checking
* to see if the partition is really on the server.
*/
- if (temp < 0 || temp > 25)
+ if (temp < 0 || temp >= VOLMAXPARTS)
return -1;
else
return temp;
return -1; /* wrongo */
if (ascii[1] < 'a' || ascii[1] > 'z')
return -1; /* just as bad */
- return (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
+ temp = (ascii[0] - 'a') * 26 + (ascii[1] - 'a') + 26;
+ return (temp >= VOLMAXPARTS ? -1 : temp);
}
}
char tempString[3];
register int i;
- if (part < 0 || part >= (26 * 26 + 26)) {
+ if (part < 0 || part >= VOLMAXPARTS) {
return -2;
}
negative = 0;
/* skip over leading spaces */
- while ((tc = *as)) {
+ for (; tc = *as; as++) {
if (tc != ' ' && tc != '\t')
break;
}
base = 10;
/* compute the # itself */
- while ((tc = *as)) {
+ for (; tc = *as; as++) {
if (!ismeta(tc, base))
return -1;
total *= base;
total += getmeta(tc);
- as++;
}
if (negative)
total = 0; /* initialize things */
/* skip over leading spaces */
- while ((tc = *as)) {
+ for (; tc = *as; as++) {
if (tc != ' ' && tc != '\t')
break;
}
base = 10;
/* compute the # itself */
- while ((tc = *as)) {
+ for (;tc = *as; as++) {
if (!ismeta(tc, base))
return -1;
total *= base;
total += getmeta(tc);
- as++;
}
*aval = total;