Project

General

Profile

unable to assign ip address to the system using "system" function using cgi c programming

Added by neethu 7 days ago

Hi,

I have a problem while setting IP address to the system using "system" command in cgi C . when i run the same code directly from the system the IP is getting updated but when i tried to update through web server it is not working.
I'm attaching the code with this. Can you please heslp me wih this

Thanks regards

Neethu

ipv1.c (1.49 KB) ipv1.c Cgi c script for setting IP address

Replies (2)

RE: unable to assign ip address to the system using "system" function using cgi c programming - Added by gstrauss 7 days ago

This request for help is "not working". Provide more details. "Not working" with no other details is pretty useless.

Why are you writing this in C instead of as a simple shell script? Your C code is insecure. Your fgets() is vulnerable to a stack buffer overflow.

RE: unable to assign ip address to the system using "system" function using cgi c programming - Added by neethu 3 days ago

I wrote the code in C because i wanted to use CGI C for backend programming.

I wanted to know whether i have to give any permission in lighttpd for this "system" function execution. Because it is running succefully as a normal C code but only thing is when i execute this through lighttpd CGI C program the return value of system function is non zero ( as system function returns ) on success and non zero value on failure ). Do we need to give any permission for lighttpd???

    (1-2/2)