[Olsr-cvs] olsrd-current/lib/tas/src glua.c, 1.2, 1.3 os_unix.c, 1.4, 1.5
Thomas Lopatic
(spam-protected)
Wed Nov 16 00:46:22 CET 2005
Update of /cvsroot/olsrd/olsrd-current/lib/tas/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29473/lib/tas/src
Modified Files:
glua.c os_unix.c
Log Message:
Use HNA routing table with ETX. Support "<?lua= ... ?>" in TAS. Let
users override the minimal HELLO validity time. Secure session cookies
in TAS.
Index: glua.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/glua.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glua.c 10 Nov 2005 19:50:42 -0000 1.2
--- glua.c 15 Nov 2005 23:46:19 -0000 1.3
***************
*** 178,195 ****
break;
! i += 5;
! start = i;
! code = 1;
continue;
}
! if (code == 1 && (i == lspLen || strncmp((char *)(buff + i), "?>", 2) == 0))
{
for (k = start; k < i; k++)
if (buff[k] != 13)
fputc(buff[k], file);
fputc('\n', file);
--- 178,210 ----
break;
! if (buff[i + 5] == '=')
! {
! i += 6;
! code = 2;
! }
! else
! {
! i += 5;
! code = 1;
! }
!
! start = i;
continue;
}
! if (code > 0 && (i == lspLen || strncmp((char *)(buff + i), "?>", 2) == 0))
{
+ if (code > 1)
+ fprintf(file, "tas.write(");
+
for (k = start; k < i; k++)
if (buff[k] != 13)
fputc(buff[k], file);
+ if (code > 1)
+ fputc(')', file);
+
fputc('\n', file);
Index: os_unix.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/tas/src/os_unix.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** os_unix.c 10 Nov 2005 19:50:42 -0000 1.4
--- os_unix.c 15 Nov 2005 23:46:20 -0000 1.5
***************
*** 67,77 ****
static int mainSocket;
- // XXX - insecure
-
void getRandomBytes(unsigned char *buff, int len)
{
memset(buff, 0, len);
! buff[0] = (unsigned char)getpid();
}
--- 67,101 ----
static int mainSocket;
void getRandomBytes(unsigned char *buff, int len)
{
+ int file;
+ int readLen;
+
memset(buff, 0, len);
! file = open("/dev/random", O_RDONLY);
!
! if (file < 0)
! {
! fprintf(stderr, "warning: cannot open /dev/random\n");
! return;
! }
!
! while (len > 0)
! {
! readLen = read(file, buff, len);
!
! if (readLen < 0)
! {
! fprintf(stderr, "warning: cannot read from /dev/random\n");
! close(file);
! return;
! }
!
! buff += readLen;
! len -= readLen;
! }
!
! close(file);
}
More information about the Olsr-cvs
mailing list