R
Robert Mens
Hi,
I've got this problem with this project i am working on, i am
a bit new to c so i don't know why this happens.
string is read from a telnet socket.
Here's the piece of code that segfaults:
struct login_usertable{
char username;
char password;
int status; /* 0=disconnected, 1=need password, 2=connected */
};
struct login_usertable user;
int login_fillusers(){
user.username="robert";
user.password="test";
user.status=0;
}
int login_requesthandler(int socket,char *string){
if(user.status==0) login_showlogin(socket, 0);
if(user.status==1){
if(strcmp((char *)user.username,string)==0){ //segfaults
printf("logged in\n");
login_showlogin(socket, 1);
}else{
printf("err\n");
login_showlogin(socket, 0);
}
}
}
What's wrong with it?
Thanks in Advance,
Robert
I've got this problem with this project i am working on, i am
a bit new to c so i don't know why this happens.
string is read from a telnet socket.
Here's the piece of code that segfaults:
struct login_usertable{
char username;
char password;
int status; /* 0=disconnected, 1=need password, 2=connected */
};
struct login_usertable user;
int login_fillusers(){
user.username="robert";
user.password="test";
user.status=0;
}
int login_requesthandler(int socket,char *string){
if(user.status==0) login_showlogin(socket, 0);
if(user.status==1){
if(strcmp((char *)user.username,string)==0){ //segfaults
printf("logged in\n");
login_showlogin(socket, 1);
}else{
printf("err\n");
login_showlogin(socket, 0);
}
}
}
What's wrong with it?
Thanks in Advance,
Robert