[IRCServices Coding] Migrating Modules to 5.1...

Andrew Church achurch at achurch.org
Tue Aug 19 18:52:46 PDT 2008


Passwords are no longer stored as simple strings, since each password
can be encrypted with a different method (cipher).  To save data from
a Password structure, you need to save both the contents of
Password.password (as a binary buffer, not a string) and the string
pointed to by Password.cipher (which may be NULL).  To restore a
Password structure, fill in the password and cipher fields in a
temporary variable, then use copy_password() to copy the data to the
destination Password structure.

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/

>Hy,
>
>I'm migrating my old modules for ircservices-5.1.11, but I've seen that 
>there were many changes in the nickgroupinfo_ struct.
>"char pass[PASSMAX];" were replaced by "Password pass;", so my module 
>won't compile anymore:
>
>modules/nickserv/dbsynch.c: In function `copy_data':
>modules/nickserv/dbsynch.c:83: error: incompatible type for argument 1 
>of `__builtin_strncpy'
>
>
>Line of this code:
>
>static void copy_data(MYSQL_ROW row, unsigned long *lengths, NickInfo 
>*ni, NickGroupInfo *ngi) {
>        char temp[100];
>strncpy(ngi->pass, row[field(MYSQL_FIELD_USERINFO_PASSWORD)], PASSMAX < 
>lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] ? PASSMAX : 
>lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] + 1);
>....
>
>When I replace "ngi->pass" by "&ngi->pass" there's only a warning left, 
>but by running this function copy_data my services crashes.
>
>Any Ideas?
>Regards.
>------------------------------------------------------------------
>To unsubscribe or change your subscription options, visit:
>http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding