Anope IRC Services

Anope Development => Modules => Topic started by: BeBoo on October 21, 2008, 03:16:33 PM

Title: misc_sqlcmd and latest build
Post by: BeBoo on October 21, 2008, 03:16:33 PM

We have been using the misc_sqlcmd module for a little while now with success. Since the latest updates to the core code, the module will no longer build and spits out some errors. I know the module coder hasn't been around so I'm hoping I can get some assistance from anyone here to possibly fix the code for the new anope. The errors I am receiving are as follows:

Code: [Select]
misc_sqlcmd_nick.c: In function ‘sqlcmd_handle_nickreg’:
misc_sqlcmd_nick.c:107: error: incompatible types in assignment
misc_sqlcmd_nick.c: In function ‘sqlcmd_handle_nickconf’:
misc_sqlcmd_nick.c:164: error: incompatible types in assignment

For those of you without the code, I have included some segments of the code that it mentions. I do not know any C so sorry if I missed something that might be needed to assist in this issue. The last line in each code block is the line it mentions in the error.

Code: [Select]
NickRequest *nr = NULL, *anr = NULL;
nr = makerequest(av[0]);
nr->passcode = sstrdup(passcode);
nr->password = sstrdup(pass);

Code: [Select]
NickRequest *nr = NULL;
NickAlias *na = NULL;
pass = sstrdup(nr->password);
if (nr->email)
  email = sstrdup(nr->email);
na = makenick(nr->nick);
if (na) {
  len = strlen(pass);
  na->nc->pass = smalloc(PASSMAX);

Thank you very much to anyone who can assist with this!!
Title: Re: misc_sqlcmd and latest build
Post by: Jan Milants on October 21, 2008, 06:35:36 PM
nr->passcode and nr->password are no longer char* and thus cannot be assigned with a sstrdup(). both are now a char[PASSMAX]. Same goes for nc->password.

I don't know how the variables are fetched by the module from sql or how php delivers them, but both should make sure it s considered a buffer which can potentially contain null characters, in the middle of a hash for example. this is the reason it was changed in the core, the module should also handle this accordingly.