Hello all,
I am back with my silly little snippet of code. When I try to create a
function with the following code compiled in to an .so:
#include <string.h>
#include <stdlib.h>
#include "postgres.h"
#include "fmgr.h"
PG_FUNCTION_INFO_V1(ssh_exec);
Datum
ssh_exec(PG_FUNCTION_ARGS)
{
char *uname = PG_GETARG_CHAR(0);
char *uid = PG_GETARG_CHAR(1);
char *gid = PG_GETARG_CHAR(2);
char sshcmd[255];
strncpy(sshcmd, "/usr/local/bin/plsshexec ", 255);
strncat(sshcmd, VARDATA(uname), VARSIZE(uname));
strncat(sshcmd, " ", 255);
strncat(sshcmd, VARDATA(uid), VARSIZE(uid));
strncat(sshcmd, " ", 255);
strncat(sshcmd, VARDATA(gid), VARSIZE(gid));
system(sshcmd);
return 0;
}
I get the following error:
undefined symbol PG_GETARG_CHAR
Is PG_GETARG_CHAR valid? I thought it was. maybe I should re-do it all with
PG_GETARG_TEXT. Thanks for reading my post.
- Joel