sp_sendmsg

(UNIX only) Sends a message to a User Datagram Protocol (UDP) port.

Syntax

sp_sendmsg ip_address, port_number, message

Parameters

Examples

Usage

There are additional considerations when using sp_sendmsg:
  • 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.

  • This sample C program listens on a port that you specify and echoes the messages it receives. For example, to receive the sp_sendmsg calls for Example 1, 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);
            }
    }
See also:
  • syb_sendmsg in Reference Manual: Building Blocks

Permissions

Any user can execute sp_sendmsg. Permission checks do not differ based on the granular permissions settings.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect