radix.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1999 Dug Song. All rights reserved.
* Copyright (c) 2002 Markus Friedl. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#include "uuencode.h"
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef AFS
#include <krb.h>
#include <radix.h>
#include "bufaux.h"
int
{
Buffer b;
int ret;
buffer_init(&b);
buffer_put_char(&b, '\0');
buffer_put_char(&b, '\0');
buffer_put_char(&b, '\0');
buffer_put_char(&b, '\0');
buffer_put_char(&b, '\0');
/* Null string to repeat the realm. */
buffer_put_char(&b, '\0');
/* 32 bit size + data */
buffer_free(&b);
return ret;
}
do { \
int i, found = 0; \
for (i = 0; i < tlen; i++) { \
if (buffer_len(b) == 0) \
goto done; \
t[i] = buffer_get_char(b); \
if (t[i] == '\0') { \
found = 1; \
break; \
} \
} \
if (!found) \
goto done; \
} while(0)
int
{
Buffer b;
char c, version, *p;
ret = 0;
/* sanity check for size */
if (blen > 8192)
return 0;
buffer_init(&b);
/* check version and length! */
if (len < 1)
goto done;
version = buffer_get_char(&b);
if (buffer_len(&b) == 0)
goto done;
/* Ignore possibly different realm. */
;
if (buffer_len(&b) == 0)
goto done;
endTime = buffer_get_int(&b);
len = buffer_len(&b);
goto done;
p = buffer_get_string(&b, &len);
goto done;
ret = 1;
done:
buffer_free(&b);
return ret;
}
#endif /* AFS */