1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 3.2//EN">
4 <TITLE> [IRCServices Coding] Migrating Modules to
5.1...
6 <LINK REL=
"Index" HREF=
"index.html" >
7 <LINK REL=
"made" HREF=
"mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20Migrating%20Modules%20to%205.1...&In-Reply-To=48AB0288.7060600%40webspace.ms">
8 <META NAME=
"robots" CONTENT=
"index,nofollow">
9 <META http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
10 <LINK REL=
"Previous" HREF=
"003323.html">
11 <LINK REL=
"Next" HREF=
"003325.html">
13 <BODY BGCOLOR=
"#ffffff">
14 <H1>[IRCServices Coding] Migrating Modules to
5.1...
</H1>
16 <A HREF=
"mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20Migrating%20Modules%20to%205.1...&In-Reply-To=48AB0288.7060600%40webspace.ms"
17 TITLE=
"[IRCServices Coding] Migrating Modules to 5.1...">achurch at achurch.org
19 <I>Wed Aug
20 11:
20:
26 PDT
2008</I>
21 <LI>Previous message:
<A HREF=
"003323.html">[IRCServices Coding] Migrating Modules to
5.1...
23 <LI>Next message:
<A HREF=
"003325.html">[IRCServices Coding] [IRCServices] akick not setting channel ban
25 <LI> <B>Messages sorted by:
</B>
26 <a href=
"date.html#3324">[ date ]
</a>
27 <a href=
"thread.html#3324">[ thread ]
</a>
28 <a href=
"subject.html#3324">[ subject ]
</a>
29 <a href=
"author.html#3324">[ author ]
</a>
34 <PRE>To extract from a Password structure (assuming the source password buffer
35 is declared as
"Password source_password
"):
37 char password_buffer[PASSMAX];
39 memcpy(password_buffer, source_password.password, PASSMAX);
40 cipher = strdup(source_password.cipher);
42 To copy into a Password structure (assuming the target password buffer is
43 declared as
"Password target_password
" and the data to be copied is in
44 "password_buffer
" and
"cipher
" variables as above):
46 Password temp_password;
47 init_password(
&temp_password);
48 memcpy(temp_password.password, password_buffer, PASSMAX);
49 temp_password.cipher = cipher;
50 copy_password(
&target_password,
&temp_password);
51 // Don't leave a copy of the password in memory
52 memset(
&temp_password,
0, sizeof(temp_password));
53 memset(password_buffer,
0, PASSMAX);
55 I actually think I'll add a set_password() function to simplify this, so
56 the above would then become simply:
58 set_password(
&target_password, password_buffer, cipher);
59 // Don't leave a copy of the password in memory
60 memset(password_buffer,
0, PASSMAX);
62 See the
"encrypt.h
" header file and section
2-
9-
1 of the technical manual
66 <A HREF=
"http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">achurch at achurch.org
</A>
67 <A HREF=
"http://achurch.org/">http://achurch.org/
</A>
71 </I>><i>Would that be the right way?:
73 </I>><i>copy_password(
&ngi-
>pass,
&passbuf);
74 </I>><i>strncpy(
&passbuf, row[field(MYSQL_FIELD_USERINFO_PASSWORD) ...
76 </I>><i>Are there sample codes to use copy_password in the right way?
81 </I>><i>Andrew Church schrieb:
82 </I>>><i> Passwords are no longer stored as simple strings, since each password
83 </I>>><i> can be encrypted with a different method (cipher). To save data from
84 </I>>><i> a Password structure, you need to save both the contents of
85 </I>>><i> Password.password (as a binary buffer, not a string) and the string
86 </I>>><i> pointed to by Password.cipher (which may be NULL). To restore a
87 </I>>><i> Password structure, fill in the password and cipher fields in a
88 </I>>><i> temporary variable, then use copy_password() to copy the data to the
89 </I>>><i> destination Password structure.
91 </I>>><i> --Andrew Church
92 </I>>><i> <A HREF=
"http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">achurch at achurch.org
</A>
93 </I>>><i> <A HREF=
"http://achurch.org/">http://achurch.org/
</A>
96 </I>>>><i> Hy,
98 </I>>>><i> I'm migrating my old modules for ircservices-
5.1.11, but I've seen that
99 </I>>>><i> there were many changes in the nickgroupinfo_ struct.
100 </I>>>><i> "char pass[PASSMAX];
" were replaced by
"Password pass;
", so my module
101 </I>>>><i> won't compile anymore:
103 </I>>>><i> modules/nickserv/dbsynch.c: In function `copy_data':
104 </I>>>><i> modules/nickserv/dbsynch.c:
83: error: incompatible type for argument
1
105 </I>>>><i> of `__builtin_strncpy'
108 </I>>>><i> Line of this code:
110 </I>>>><i> static void copy_data(MYSQL_ROW row, unsigned long *lengths, NickInfo
111 </I>>>><i> *ni, NickGroupInfo *ngi) {
112 </I>>>><i> char temp[
100];
113 </I>>>><i> strncpy(ngi-
>pass, row[field(MYSQL_FIELD_USERINFO_PASSWORD)], PASSMAX
<
114 </I>>>><i> lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] ? PASSMAX :
115 </I>>>><i> lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] +
1);
116 </I>>>><i> ....
118 </I>>>><i> When I replace
"ngi-
>pass
" by
"&ngi-
>pass
" there's only a warning left,
119 </I>>>><i> but by running this function copy_data my services crashes.
121 </I>>>><i> Any Ideas?
122 </I>>>><i> Regards.
123 </I>>>><i> ------------------------------------------------------------------
124 </I>>>><i> To unsubscribe or change your subscription options, visit:
125 </I>>>><i> <A HREF=
"http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding
</A>
127 </I>>>><i> ------------------------------------------------------------------------
129 </I>>>><i> ------------------------------------------------------------------
130 </I>>>><i> To unsubscribe or change your subscription options, visit:
131 </I>>>><i> <A HREF=
"http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding
</A>
140 <LI>Previous message:
<A HREF=
"003323.html">[IRCServices Coding] Migrating Modules to
5.1...
142 <LI>Next message:
<A HREF=
"003325.html">[IRCServices Coding] [IRCServices] akick not setting channel ban
144 <LI> <B>Messages sorted by:
</B>
145 <a href=
"date.html#3324">[ date ]
</a>
146 <a href=
"thread.html#3324">[ thread ]
</a>
147 <a href=
"subject.html#3324">[ subject ]
</a>
148 <a href=
"author.html#3324">[ author ]
</a>