Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:11.4
openslp
openslp.truncate.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openslp.truncate.diff of Package openslp
--- ./slpd/slpd_incoming.c.orig 2006-11-14 16:25:18.000000000 +0000 +++ ./slpd/slpd_incoming.c 2006-11-15 18:20:10.000000000 +0000 @@ -79,6 +79,7 @@ void IncomingDatagramRead(SLPList* sockl int bytestowrite; int byteswritten; int peeraddrlen = sizeof(struct sockaddr_in); + int truncate; bytesread = recvfrom(sock->fd, sock->recvbuf->start, @@ -90,9 +91,13 @@ void IncomingDatagramRead(SLPList* sockl { sock->recvbuf->end = sock->recvbuf->start + bytesread; + truncate = SLP_MAX_DATAGRAM_SIZE; + if (G_SlpdProperty.oversizedUDP) + truncate = 0; switch (SLPDProcessMessage(&sock->peeraddr, sock->recvbuf, - &(sock->sendbuf))) + &(sock->sendbuf), + truncate)) { case SLP_ERROR_PARSE_ERROR: case SLP_ERROR_VER_NOT_SUPPORTED: @@ -238,7 +243,7 @@ void IncomingStreamRead(SLPList* socklis { switch (SLPDProcessMessage(&sock->peeraddr, sock->recvbuf, - &(sock->sendbuf))) + &(sock->sendbuf), 0)) { case SLP_ERROR_PARSE_ERROR: case SLP_ERROR_VER_NOT_SUPPORTED: --- ./slpd/slpd_outgoing.c.orig 2006-11-14 16:26:13.000000000 +0000 +++ ./slpd/slpd_outgoing.c 2006-11-15 18:29:31.000000000 +0000 @@ -89,7 +89,7 @@ void OutgoingDatagramRead(SLPList* sockl SLPDProcessMessage(&(sock->peeraddr), sock->recvbuf, - &(sock->sendbuf)); + &(sock->sendbuf), 0); /* Completely ignore the message */ } @@ -264,7 +264,7 @@ void OutgoingStreamRead(SLPList* socklis { switch ( SLPDProcessMessage(&(sock->peeraddr), sock->recvbuf, - &(sock->sendbuf)) ) + &(sock->sendbuf), 0) ) { case SLP_ERROR_DA_BUSY_NOW: sock->state = STREAM_WRITE_WAIT; --- ./slpd/slpd_process.c.orig 2006-11-14 16:18:24.000000000 +0000 +++ ./slpd/slpd_process.c 2006-11-15 15:22:05.000000000 +0000 @@ -301,7 +301,8 @@ int ProcessDASrvRqst(SLPMessage message, /*-------------------------------------------------------------------------*/ int ProcessSrvRqst(SLPMessage message, SLPBuffer* sendbuf, - int errorcode) + int errorcode, + int truncate) /*-------------------------------------------------------------------------*/ { int i; @@ -310,12 +311,6 @@ int ProcessSrvRqst(SLPMessage message, int size = 0; SLPBuffer result = *sendbuf; -#ifdef ENABLE_SLPv2_SECURITY - SLPAuthBlock* authblock = 0; - int j; -#endif - - /*--------------------------------------------------------------*/ /* If errorcode is set, we can not be sure that message is good */ /* Go directly to send response code */ @@ -445,33 +440,24 @@ int ProcessSrvRqst(SLPMessage message, { for (i=0;i<db->urlcount;i++) { + /* check size limitation */ + if (truncate && size > truncate) + break; + /* urlentry is the url from the db result */ urlentry = db->urlarray[i]; - size += urlentry->urllen + 6; /* 1 byte for reserved */ - /* 2 bytes for lifetime */ - /* 2 bytes for urllen */ - /* 1 byte for authcount */ -#ifdef ENABLE_SLPv2_SECURITY - - /* make room to include the authblock that was asked for */ - if (G_SlpdProperty.securityEnabled && - message->body.srvrqst.spistrlen ) + if (urlentry->opaque == 0) { - for (j=0; j<urlentry->authcount;j++) - { - if (SLPCompareString(urlentry->autharray[j].spistrlen, - urlentry->autharray[j].spistr, - message->body.srvrqst.spistrlen, - message->body.srvrqst.spistr) == 0) - { - authblock = &(urlentry->autharray[j]); - size += authblock->length; - break; - } - } + size += urlentry->urllen + 6; /* 1 byte for reserved */ + /* 2 bytes for lifetime */ + /* 2 bytes for urllen */ + /* 1 byte for authcount */ + } + else + { + size += urlentry->opaquelen; } -#endif } } @@ -523,6 +509,10 @@ int ProcessSrvRqst(SLPMessage message, for (i=0;i<db->urlcount;i++) { + /* check size limitation */ + if (truncate && result->curpos - result->start > truncate) + break; + /* urlentry is the url from the db result */ urlentry = db->urlarray[i]; @@ -1312,7 +1302,8 @@ int ProcessSAAdvert(SLPMessage message, /*=========================================================================*/ int SLPDProcessMessage(struct sockaddr_in* peerinfo, SLPBuffer recvbuf, - SLPBuffer* sendbuf) + SLPBuffer* sendbuf, + int truncate) /* Processes the recvbuf and places the results in sendbuf */ /* */ /* peerinfo - the socket the message was received on */ @@ -1390,7 +1381,7 @@ int SLPDProcessMessage(struct sockaddr_i switch (message->header.functionid) { case SLP_FUNCT_SRVRQST: - errorcode = ProcessSrvRqst(message,sendbuf,errorcode); + errorcode = ProcessSrvRqst(message,sendbuf,errorcode,truncate); break; case SLP_FUNCT_SRVREG: --- ./slpd/slpd_process.h.orig 2006-11-14 16:23:21.000000000 +0000 +++ ./slpd/slpd_process.h 2006-11-14 16:23:38.000000000 +0000 @@ -60,7 +60,8 @@ /*=========================================================================*/ int SLPDProcessMessage(struct sockaddr_in* peerinfo, SLPBuffer recvbuf, - SLPBuffer* sendbuf) ; + SLPBuffer* sendbuf, + int truncate) ; /* Processes the recvbuf and places the results in sendbuf */ /* */ /* peerinfo - the socket the message was received on */ --- ./slpd/slpd_property.c.orig 2006-11-15 18:14:47.000000000 +0000 +++ ./slpd/slpd_property.c 2006-11-15 18:16:28.000000000 +0000 @@ -131,6 +131,7 @@ int SLPDPropertyInit(const char* conffil G_SlpdProperty.securityEnabled = SLPPropertyAsBoolean(SLPPropertyGet("net.slp.securityEnabled")); G_SlpdProperty.checkSourceAddr = SLPPropertyAsBoolean(SLPPropertyGet("net.slp.checkSourceAddr")); G_SlpdProperty.DAHeartBeat = SLPPropertyAsInteger(SLPPropertyGet("net.slp.DAHeartBeat")); + G_SlpdProperty.oversizedUDP = SLPPropertyAsBoolean(SLPPropertyGet("net.slp.oversizedUDP")); /*-------------------------------------*/ --- ./slpd/slpd_property.h.orig 2006-11-15 18:14:05.000000000 +0000 +++ ./slpd/slpd_property.h 2006-11-15 18:15:28.000000000 +0000 @@ -94,6 +94,7 @@ typedef struct _SLPDProperty int securityEnabled; int checkSourceAddr; int DAHeartBeat; + int oversizedUDP; }SLPDProperty;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor