#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/times.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <time.h>
#include <stdlib.h>
#include <lber.h>
#include <ldap.h>
int main()
{
.................
/* Read standard input and put stuff into buffer */
memset(buf,0,sizeof(buf));
if (strcmp("POST",getenv("REQUEST_METHOD"))==0) scanf("%s",buf);
else strcpy((char *)buf,getenv("QUERY_STRING"));
/* Parse the input and separate all elements delimited by '&' */
ptr1 = strtok(buf, "&");
ptr2 = strtok(NULL, "&");
/* UDN - 8 characters. */
ptr=strchr(ptr1,'=');
strcpy(identifier, &ptr[1]);
/* Check if field was filled */
if (strlen(identifier) == 0) print_error("Incomplete field: UDN",1);
/* Remove spaces and convert all percent sign notation */
Remove_spaces(identifier, strlen(identifier));
Check_percent(identifier, strlen(identifier));
/* Key - 44 characters */
ptr = strchr(ptr2, '=');
strcpy(encoded_encrypted_deskey,&ptr[1]);
Check_percent(encoded_encrypted_deskey, strlen(encoded_encrypted_deskey));
/* Check to see if key is at least 4 characters long */
if (strlen(encoded_encrypted_deskey) < 4) print_error("Incomplete field: encoded_encrypted_deskey",1);
/* Recipient's name */
strcpy(user_name, getenv("REMOTE_USER"));
....
exit(0);
} /* End of main() */
+++++++++++++++++++++
|