(UNIX only) Sends a message to a User Datagram Protocol (UDP) port.
sp_sendmsg ip_address, port_number, message
sp_sendmsg "120.10.20.5", 3456, "Hello World"
To enable the use of UDP messaging, a system security officer must set the configuration parameter allow sendmsg to 1.
No security checks are performed with sp_sendmsg. Be very cautious when using sp_sendmsg to send sensitive information across the network. By enabling this functionality, the user accepts any security problems that result from its use.
updmon 3456
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <fcntl.h>
main(argc, argv)
int argc; char *argv[];
{
struct sockaddr_in sadr;
int portnum,sck,dummy,msglen;
char msg[256];
if (argc < 2) {
printf(“Usage: udpmon <udp portnum>\n”);
exit(1);
}
if ((portnum=atoi(argv[1])) < 1) {
printf("Invalid udp portnum\n");
exit(1);
}
if ((sck=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP)) < 0) {
printf("Couldn't create socket\n");
exit(1);
}
sadr.sin_family = AF_INET;
sadr.sin_addr.s_addr = inet_addr("0.0.0.0");
sadr.sin_port = portnum;
if (bind(sck,&sadr,sizeof(sadr)) < 0) {
printf("Couldn't bind requested udp port\n");
exit(1);
}
for (;;)
{
if((msglen=recvfrom(sck,msg,sizeof(msg),0,NULL,&dummy)) < 0)
printf("Couldn't recvfrom() from udp port\n");
printf("%.*s\n", msglen, msg);
}
}
syb_sendmsg in Reference Manual: Building Blocks
Any user can execute sp_sendmsg. Permission checks do not differ based on the granular permissions settings.
Values in event and extrainfo columns from the sysaudits table are:
| Information | Values |
|---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|