]> jfr.im git - irc.git/blobdiff - software/!RELEASES/ircservices/achurch.org/services/lists/ircservices-coding/2008/003324.html
RELEASE -> !RELEASE
[irc.git] / software / !RELEASES / ircservices / achurch.org / services / lists / ircservices-coding / 2008 / 003324.html
diff --git a/software/!RELEASES/ircservices/achurch.org/services/lists/ircservices-coding/2008/003324.html b/software/!RELEASES/ircservices/achurch.org/services/lists/ircservices-coding/2008/003324.html
new file mode 100644 (file)
index 0000000..b53122d
--- /dev/null
@@ -0,0 +1,152 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+ <HEAD>
+   <TITLE> [IRCServices Coding] Migrating Modules to 5.1...
+   </TITLE>
+   <LINK REL="Index" HREF="index.html" >
+   <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">
+   <META NAME="robots" CONTENT="index,nofollow">
+   <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
+   <LINK REL="Previous"  HREF="003323.html">
+   <LINK REL="Next"  HREF="003325.html">
+ </HEAD>
+ <BODY BGCOLOR="#ffffff">
+   <H1>[IRCServices Coding] Migrating Modules to 5.1...</H1>
+    <B>Andrew Church</B> 
+    <A HREF="mailto:ircservices-coding%40ircservices.za.net?Subject=%5BIRCServices%20Coding%5D%20Migrating%20Modules%20to%205.1...&In-Reply-To=48AB0288.7060600%40webspace.ms"
+       TITLE="[IRCServices Coding] Migrating Modules to 5.1...">achurch at achurch.org
+       </A><BR>
+    <I>Wed Aug 20 11:20:26 PDT 2008</I>
+    <P><UL>
+        <LI>Previous message: <A HREF="003323.html">[IRCServices Coding] Migrating Modules to 5.1...
+</A></li>
+        <LI>Next message: <A HREF="003325.html">[IRCServices Coding] [IRCServices] akick not setting channel ban
+</A></li>
+         <LI> <B>Messages sorted by:</B> 
+              <a href="date.html#3324">[ date ]</a>
+              <a href="thread.html#3324">[ thread ]</a>
+              <a href="subject.html#3324">[ subject ]</a>
+              <a href="author.html#3324">[ author ]</a>
+         </LI>
+       </UL>
+    <HR>  
+<!--beginarticle-->
+<PRE>To extract from a Password structure (assuming the source password buffer
+is declared as &quot;Password source_password&quot;):
+
+    char password_buffer[PASSMAX];
+    char *cipher;
+    memcpy(password_buffer, source_password.password, PASSMAX);
+    cipher = strdup(source_password.cipher);
+
+To copy into a Password structure (assuming the target password buffer is
+declared as &quot;Password target_password&quot; and the data to be copied is in
+&quot;password_buffer&quot; and &quot;cipher&quot; variables as above):
+
+    Password temp_password;
+    init_password(&amp;temp_password);
+    memcpy(temp_password.password, password_buffer, PASSMAX);
+    temp_password.cipher = cipher;
+    copy_password(&amp;target_password, &amp;temp_password);
+    // Don't leave a copy of the password in memory
+    memset(&amp;temp_password, 0, sizeof(temp_password));
+    memset(password_buffer, 0, PASSMAX);
+
+I actually think I'll add a set_password() function to simplify this, so
+the above would then become simply:
+
+    set_password(&amp;target_password, password_buffer, cipher);
+    // Don't leave a copy of the password in memory
+    memset(password_buffer, 0, PASSMAX);
+
+See the &quot;encrypt.h&quot; header file and section 2-9-1 of the technical manual
+for further details.
+
+  --Andrew Church
+    <A HREF="http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">achurch at achurch.org</A>
+    <A HREF="http://achurch.org/">http://achurch.org/</A>
+
+&gt;<i>Hy,
+</I>&gt;<i>
+</I>&gt;<i>Would that be the right way?:       
+</I>&gt;<i>
+</I>&gt;<i>copy_password(&amp;ngi-&gt;pass, &amp;passbuf);
+</I>&gt;<i>strncpy(&amp;passbuf, row[field(MYSQL_FIELD_USERINFO_PASSWORD) ...
+</I>&gt;<i>
+</I>&gt;<i>Are there sample codes to use copy_password in the right way?
+</I>&gt;<i>
+</I>&gt;<i>Regards.
+</I>&gt;<i>
+</I>&gt;<i>
+</I>&gt;<i>Andrew Church schrieb:
+</I>&gt;&gt;<i> Passwords are no longer stored as simple strings, since each password
+</I>&gt;&gt;<i> can be encrypted with a different method (cipher).  To save data from
+</I>&gt;&gt;<i> a Password structure, you need to save both the contents of
+</I>&gt;&gt;<i> Password.password (as a binary buffer, not a string) and the string
+</I>&gt;&gt;<i> pointed to by Password.cipher (which may be NULL).  To restore a
+</I>&gt;&gt;<i> Password structure, fill in the password and cipher fields in a
+</I>&gt;&gt;<i> temporary variable, then use copy_password() to copy the data to the
+</I>&gt;&gt;<i> destination Password structure.
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i>   --Andrew Church
+</I>&gt;&gt;<i>     <A HREF="http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">achurch at achurch.org</A>
+</I>&gt;&gt;<i>     <A HREF="http://achurch.org/">http://achurch.org/</A>
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i>   
+</I>&gt;&gt;&gt;<i> Hy,
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> I'm migrating my old modules for ircservices-5.1.11, but I've seen that 
+</I>&gt;&gt;&gt;<i> there were many changes in the nickgroupinfo_ struct.
+</I>&gt;&gt;&gt;<i> &quot;char pass[PASSMAX];&quot; were replaced by &quot;Password pass;&quot;, so my module 
+</I>&gt;&gt;&gt;<i> won't compile anymore:
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> modules/nickserv/dbsynch.c: In function `copy_data':
+</I>&gt;&gt;&gt;<i> modules/nickserv/dbsynch.c:83: error: incompatible type for argument 1 
+</I>&gt;&gt;&gt;<i> of `__builtin_strncpy'
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> Line of this code:
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> static void copy_data(MYSQL_ROW row, unsigned long *lengths, NickInfo 
+</I>&gt;&gt;&gt;<i> *ni, NickGroupInfo *ngi) {
+</I>&gt;&gt;&gt;<i>        char temp[100];
+</I>&gt;&gt;&gt;<i> strncpy(ngi-&gt;pass, row[field(MYSQL_FIELD_USERINFO_PASSWORD)], PASSMAX &lt; 
+</I>&gt;&gt;&gt;<i> lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] ? PASSMAX : 
+</I>&gt;&gt;&gt;<i> lengths[field(MYSQL_FIELD_USERINFO_PASSWORD)] + 1);
+</I>&gt;&gt;&gt;<i> ....
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> When I replace &quot;ngi-&gt;pass&quot; by &quot;&amp;ngi-&gt;pass&quot; there's only a warning left, 
+</I>&gt;&gt;&gt;<i> but by running this function copy_data my services crashes.
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> Any Ideas?
+</I>&gt;&gt;&gt;<i> Regards.
+</I>&gt;&gt;&gt;<i> ------------------------------------------------------------------
+</I>&gt;&gt;&gt;<i> To unsubscribe or change your subscription options, visit:
+</I>&gt;&gt;&gt;<i> <A HREF="http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding</A>
+</I>&gt;&gt;&gt;<i>     
+</I>&gt;&gt;&gt;<i> ------------------------------------------------------------------------
+</I>&gt;&gt;&gt;<i>
+</I>&gt;&gt;&gt;<i> ------------------------------------------------------------------
+</I>&gt;&gt;&gt;<i> To unsubscribe or change your subscription options, visit:
+</I>&gt;&gt;&gt;<i> <A HREF="http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding">http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding</A>
+</I>&gt;<i>
+</I></PRE>
+
+
+<!--endarticle-->
+    <HR>
+    <P><UL>
+        <!--threads-->
+       <LI>Previous message: <A HREF="003323.html">[IRCServices Coding] Migrating Modules to 5.1...
+</A></li>
+       <LI>Next message: <A HREF="003325.html">[IRCServices Coding] [IRCServices] akick not setting channel ban
+</A></li>
+         <LI> <B>Messages sorted by:</B> 
+              <a href="date.html#3324">[ date ]</a>
+              <a href="thread.html#3324">[ thread ]</a>
+              <a href="subject.html#3324">[ subject ]</a>
+              <a href="author.html#3324">[ author ]</a>
+         </LI>
+       </UL>
+
+</body></html>