Hi Brian,
I guess the post went through after all. I couldn’t see it on the list of open threads
Here’s a snippet:
int master;
pid_t pid = forkpty(&master,0,0,0);
if (pid > 0) {
int stat = 0;
waitpid(pid,&stat,0);
return stat != 0;
}
MimeRunner rr(&r);
if (c.login(config->machine, config->user, config->password, config->account, config->account_password)) {
c.run(rr);
c.logout();
exit(r.send(200,"OK",getContentType(),rr.c_str(),rr.size()));
} else {
exit(r.send(500,"SERVER ERROR","text/html","",13));
}
and the login method in the c object (which I have as class called Runtime) is:
int Runtime::login(const char* machine, const char* user, const char* psw, const char* acct, const char* apsw)
{
CPSTR* m = _CP_mkstr((char*)machine);
CPSTR* u = _CP_mkstr((char*)user);
CPSTR* p = psw[0] ? _CP_mkstr((char*)psw) : _CP_str_null;
CPSTR* a = _CP_mkstr((char*)acct);
CPSTR* w = apsw[0] ? _CP_mkstr((char*)apsw) : _CP_str_null;
int n = _CP_logon(m,u,p,a,w,-1,0);
_CP_str_free(m);
_CP_str_free(u);
_CP_str_free(a);
if (psw[0]) _CP_str_free(p);
if (apsw[0]) _CP_str_free(w);
return n>-1;
}
When I run it, _CP_logon never returns, but instead the child dies. I’ve run it with gdb and from the stack trace it shows it dies in strcpy() called from pick_init_termio(). The session does not need to be user interactive. I’m trying to use it as a database connection with basic calling and access to standard D3 functions via the _CP_ api. The program is owned by root with the +s option set.
Any advice would be most appreciated.
Tom
> On Jan 25, 2022, at 10:58 AM, Brian Cram via Rocket Forum