
787 | ExternalUser Management DellPowerConnectW-SeriesArubaOS6.2 | User Guide
sa.sin_family = AF_INET;
sa.sin_port = htons(80);
fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
perror("socket");
exit(1);
}
if (connect(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
perror("connect");
exit(1);
}
if (write(fd, post, postlen) != postlen) {
perror("write");
exit(1);
}
while ((len = read(fd, post, sizeof(post))) > 0)
write(1, post, len);
close(fd);
exit(0);
}
static void encode_message_digest (unsigned char *md, int mdlen, char *output)
{
int i;
for (i=0; i<mdlen; i++) {
sprintf(output, "%02x", md[i]);
output += 2;
}
}
}
##### Authentication Script Example -- END --
Understanding Request and Response
The controller processes the authentication task and sends a response to the authentication server in the XML
format to the authentication server. The XML response contains the status of the request and a code in case of an
error. The example script is listed in Figure 357.
Request format: <script_name> [options] <controller-ip> <command> <secret_key>
Understanding XML API Request Parameters
The Table 358list all parameter that you can use in a request.
Parameter Description
script_name
The name of the script executable.
Options
l -i <ip_addr>—Specify the client’s IP address.
l -m <mac_addr>—Specify the client’s MAC address.
l -n <name>—Specify the client’s user name.
l -p <passwd>—Specify the client password.
Table 358:
XML API Request Parameters and Descriptions