I didn't need the team listing code in in.tokend

This commit is contained in:
Neale Pickett 2011-02-03 21:03:37 -07:00
parent c6998920d4
commit c6456f8a00
1 changed files with 0 additions and 35 deletions

View File

@ -1,5 +1,4 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
@ -11,33 +10,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sysexits.h> #include <sysexits.h>
#include <dirent.h>
#include "common.h" #include "common.h"
#include "arc4.h" #include "arc4.h"
#include "md5.h"
void
list_teams()
{
struct dirent *ent;
DIR *dir;
dir = opendir(state_path("teams/names"));
if (! dir) return;
while ((ent = readdir(dir))) {
struct stat buf;
if ((0 == stat(state_path("teams/names/%s", ent->d_name), &buf)) &&
(S_ISREG(buf.st_mode))) {
char digest[MD5_HEXDIGEST_LEN + 1];
md5_hexdigest((uint8_t *)ent->d_name, strlen(ent->d_name), digest);
digest[MD5_HEXDIGEST_LEN] = '\n';
write(1, digest, sizeof(digest));
}
}
closedir(dir);
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -55,20 +29,11 @@ main(int argc, char *argv[])
len = read(0, category, sizeof(category)); len = read(0, category, sizeof(category));
if (0 >= len) return 0; if (0 >= len) return 0;
/* Category name of "?" lists arc4 hashes of all teams */
if ((1 == len) && ('?' == category[0])) {
list_teams();
return 0;
}
/* Strip invalid characters */
for (categorylen = 0; for (categorylen = 0;
(categorylen < len) && isalnum(category[categorylen]); (categorylen < len) && isalnum(category[categorylen]);
categorylen += 1); categorylen += 1);
} }
/* Read in that category's key. */ /* Read in that category's key. */
{ {
int fd; int fd;