Joel Dudley writes:
> PG_FUNCTION_INFO_V1(ssh_exec);
>
> Datum
> ssh_exec(PG_FUNCTION_ARGS)
> {
> char sshcmd[255];
>
> strncpy(sshcmd, "/usr/local/bin/plsshexec ", 255);
> strncat(sshcmd, *uname, 255);
> strncat(sshcmd, " ", 255);
> strncat(sshcmd, *uid, 255);
> strncat(sshcmd, " ", 255);
> strncat(sshcmd, *gid, 255);
> system(sshcmd);
> return 0;
> }
You missed the part about fetching the arguments using PG_GETARG_xxx.
Also you should use PG_RETURN_xxx and you need to null-terminate your
string.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/