[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
call_usermodehelper dont't execute mysql client?
hi,
i'm having problems while executing mysql client from a work queue
(process context), but with no problems other executable files (simple
daemon i've programmed)
the code is: (connection is a global structure)
static void my_call_usermodehelper(void *data) {
int err;
struct sendbuffer_t *sendbuffer = data;
/* prepare data */
sendbuffer->argv[0] = "/usr/bin/mysql";
sendbuffer->argv[1] = "--host='localhost'";
sendbuffer->argv[2] = "--user='user'";
sendbuffer->argv[3] = "--password='passwd'";
sprintf(tmp, "--execute=\"USE pnvoip; INSERT INTO connections
(id,src_ip,src_port,dst_ip,dst_port,bytes,packets,start_time,finish_time) VALUES ('%s',%u,%d,%u,%d,%d,%d,'%lu','%lu');\"",connection->id,connection->saddr,connection->sport,connection->daddr,connection->dport,connection->bytes,connection->packets,connection->first_seen,connection->last_seen);
sendbuffer->argv[4] = tmp;
sendbuffer->argv[5] = NULL;
sendbuffer->envp[0] = "HOME=/";
sendbuffer->envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
sendbuffer->envp[2] = NULL;
printk(KERN_INFO "call_usermodehelper(%s %s %s %s %s %s);
\n",sendbuffer->argv[0],sendbuffer->argv[1],sendbuffer->argv[2],sendbuffer->argv[3],sendbuffer->argv[4], sendbuffer->argv[5]);
if ((err = call_usermodehelper(sendbuffer->argv[0], sendbuffer->argv,
sendbuffer->envp, 0)) < 0)
printk(KERN_INFO "exec mysql failed (error = %d)!\n", err);
}
the /var/log/messages file prints out:
Jan 4 14:12:28 localhost kernel: call_usermodehelper(/usr/bin/mysql
--host='localhost' --user='pnvoip_user' --password='pnvoip_passwd'
--execute="USE pnvoip; INSERT INTO connections
(callid,src_ip,src_port,dst_ip,dst_port,bytes,packets,start_time,finish_time) VALUES ('RTP_192.168.0.1.53_192.168.0.23.32790',16820416,53,385919168,32790,13560,1,'1136380346','1136380346'); COMMIT;" <NULL>);
(this command is correct, i've pasted on a termnal and it adds a row to
my table)
any idea to solve that? or what it's not working?
thanks,
regards,
toni
--
toni <agar9938@xxxxxxxxxxxxxxxxxx>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/