Re: [vchkpw] HA! vqregister database issue squashed

2003-02-19 Thread vol
Hi, everybody.  I wrote the vQregister package a long time ago,
so Im going to attempt to remember the required stuffs.

First, Rick, you are correct, there isnt much documentation
on using the database stuff inside vQregister.  The reason for this,
is that a client of ours paid for the development, but did not
fund documentation, and we were on a rushed schedule.

Second, the default compilation flags (as I left them; they may have 
been modified by someone else here), is set to compile against
MySQL which confuses a lot of people.  It is not a requirement.

Third, pertaining to the field names, you need to define them
because you're building your own database.  vQregister needs to
understand the database value names to correctly match between
user input via the CGI, and the database table values.

Lastly, just an FYI to anyone interested, we have a 'Request
your forgotten password' in the works.  We havent yet decided
the scope of what systems it will support (ie: vpopmail, or
just vQregister, etc), or how it will function for each
individual system.  So, there will, at some time, in the near
future be a release of this utility CGI.  It's just unfortunate
that 'near future' can mean anything from tomorrow, to five
months from now.

If you have any other questions/comments, feel free to send
em along.  Just be sure to CC vchkpw so everyone sees :)


Rick Romero wrote:
On Wed, 2003-02-19 at 08:38, made wrote:


Hello Rick,

Wednesday, February 19, 2003, 12:27:42 AM, you wrote:



Allright, I've been running vqregister for quite a while, and I've
wanted to add a 'Secret Word' so users could re-request their email
password.  Obviously, the database functions should take care of that.



Not on my system :(



I think what it all came down to was my version of MySQL.  I think the
db functions for MySQL were done on an older version than I have, and my
version is just pickier.



Anyways, I attached a full patch that does everything but link


db_mysql.* ->> db_*.  I don't know what parts or even if you want it, but


the biggest issue was the MySQL insert.  
Apparently my versions (I've upgraded since first trying), require the
column names before the values.  So I added that to db_mysql.c, and
that's reflected in the first part of the patch.


Have Fun!



Rick


Great... sorry i'm newbies in vqregister!! is it meant that you can
use mysql to store all the vqregister user database? 


That's Correct.



oh... what a wonderfull
things.. coz i'm always fail to do that. everytime i compile my vqregister
thereis no database on mySQL server like the vqregister blurb said,



Yeah, first thing is to either copy db_mysql.* to db.* or create a
symlink to db_mysql.* from db.*  Took me a while to figure that part
out. I guess it's not really supported, and there are no docs.  :(



is it some bug in vqregiser or maybe i do it in wrong way? so would you please give me some
clue so i can use mysql to store all user information who had
registered via vqregister!!



Start with making sure db_mysql is actually compiled in, by doing one of
the above.  Then make sure you've AT LEAST applied the part of the patch
that adds to db_mysql.c.  You MAY not need that, but it doesn't hurt. 
That part of the patch changes the MySQL insert from:
INSERT INTO VPOPMAIL VALUES ("1","2")
to
INSERT INTO VPOPMAIL (user,dom) VALUES ("1","2")

I assume some version of MySQL doesn't require the field names on an
insert, but mine does.  (Though I'm not sure why you wouldn't want to
specify that.)

At that point, you can at least do what the example shows - the rest of
my patch adds a field for implementation of using a 'Secret Word'.  So
if you want to use more fields, use the rest of the patch as a guide.

Rick


thanks













--
mailto:[EMAIL PROTECTED]
Matt Brookings - Chief Technical Officer
Inter7 Internet Technologies, Inc.
www.inter7.com - 847-492-0470
Prices at http://www.inter7.com/prices





Re: [vchkpw] HA! vqregister database issue squashed

2003-02-19 Thread Rick Romero
On Wed, 2003-02-19 at 08:38, made wrote:
> Hello Rick,
> 
> Wednesday, February 19, 2003, 12:27:42 AM, you wrote:
> 
> > Allright, I've been running vqregister for quite a while, and I've
> > wanted to add a 'Secret Word' so users could re-request their email
> > password.  Obviously, the database functions should take care of that.
> 
> > Not on my system :(
> 
> > I think what it all came down to was my version of MySQL.  I think the
> > db functions for MySQL were done on an older version than I have, and my
> > version is just pickier.
> 
> > Anyways, I attached a full patch that does everything but link
> db_mysql.* ->> db_*.  I don't know what parts or even if you want it, but
> > the biggest issue was the MySQL insert.  
> > Apparently my versions (I've upgraded since first trying), require the
> > column names before the values.  So I added that to db_mysql.c, and
> > that's reflected in the first part of the patch.
> 
> > Have Fun!
> 
> > Rick
> 
> Great... sorry i'm newbies in vqregister!! is it meant that you can
> use mysql to store all the vqregister user database? 

That's Correct.

> oh... what a wonderfull
> things.. coz i'm always fail to do that. everytime i compile my vqregister
> thereis no database on mySQL server like the vqregister blurb said,

Yeah, first thing is to either copy db_mysql.* to db.* or create a
symlink to db_mysql.* from db.*  Took me a while to figure that part
out. I guess it's not really supported, and there are no docs.  :(

> is it some bug in vqregiser or maybe i do it in wrong way? so would you please give 
>me some
> clue so i can use mysql to store all user information who had
> registered via vqregister!!

Start with making sure db_mysql is actually compiled in, by doing one of
the above.  Then make sure you've AT LEAST applied the part of the patch
that adds to db_mysql.c.  You MAY not need that, but it doesn't hurt. 
That part of the patch changes the MySQL insert from:
INSERT INTO VPOPMAIL VALUES ("1","2")
to
INSERT INTO VPOPMAIL (user,dom) VALUES ("1","2")

I assume some version of MySQL doesn't require the field names on an
insert, but mine does.  (Though I'm not sure why you wouldn't want to
specify that.)

At that point, you can at least do what the example shows - the rest of
my patch adds a field for implementation of using a 'Secret Word'.  So
if you want to use more fields, use the rest of the patch as a guide.

Rick

> thanks









[vchkpw] HA! vqregister database issue squashed

2003-02-18 Thread Rick Romero


Allright, I've been running vqregister for quite a while, and I've
wanted to add a 'Secret Word' so users could re-request their email
password.  Obviously, the database functions should take care of that.

Not on my system :(

I think what it all came down to was my version of MySQL.  I think the
db functions for MySQL were done on an older version than I have, and my
version is just pickier.

Anyways, I attached a full patch that does everything but link
db_mysql.* -> db_*.  I don't know what parts or even if you want it, but
the biggest issue was the MySQL insert.  
Apparently my versions (I've upgraded since first trying), require the
column names before the values.  So I added that to db_mysql.c, and
that's reflected in the first part of the patch.

Have Fun!

Rick




diff -u vqregister-2.6/db_mysql.c vqregister-2.61/db_mysql.c
--- vqregister-2.6/db_mysql.c   Thu Mar  8 06:11:54 2001
+++ vqregister-2.61/db_mysql.c  Tue Feb 18 10:46:25 2003
@@ -44,7 +44,7 @@
 {
   int ret = 0, n = 0;
   char *query = NULL;
-
+  char *printme;
   /*
  Gather up combined length
  of fields, and number of fields.
@@ -62,14 +62,27 @@

   ret += strlen(db_name);
   ret += 23; /* "INSERT INTO " " VALUES (" ")" */
-
+   /* Needs to be "INSERT INTO " " (col1, col2) VALUES (" ")" */
   query = (char *)malloc(ret);
   if (query == NULL)
  return DB_E_MEM;

   memset((char *)query, 0, ret);

-  snprintf(query, ret, "INSERT INTO %s VALUES (", tname);
+  snprintf(query, ret, "INSERT INTO %s (", tname);
+
+  for (n = 0; nfields[n]; n++) {
+//  strncat(query, "", ret);
+  strncat(query, nfields[n], ret);
+
+  if (!fields[n + 1])
+ strncat(query, ")", ret);
+  else
+ strncat(query, ",", ret);
+  }
+
+   strncat(query, " VALUES (",ret);
+

   for (n = 0; fields[n]; n++) {
   strncat(query, "'", ret);
@@ -81,13 +94,15 @@
  strncat(query, "',", ret);
   }

+
+//  global_error(query,0,0);
   ret = mysql_real_query(&mysql, query, strlen(query));

   free(query);

   if (ret) {
- global_error("Database query failed", 0, 0);
- exit(1);
+global_error("Database query failed", 0, 0);
+exit(1);
   }

   return DB_E_SUCCESS;
Common subdirectories: vqregister-2.6/html and vqregister-2.61/html
diff -u vqregister-2.6/register.c vqregister-2.61/register.c
--- vqregister-2.6/register.c   Fri Mar 16 07:19:39 2001
+++ vqregister-2.61/register.c  Tue Feb 18 10:46:30 2003
@@ -10,7 +10,7 @@
 extern int password_len;
 extern char verify, *redirect, *password, allowpassword, advertise;
 char *dom = NULL, *user = NULL, *fname = NULL, *cemail = NULL, *pass = NULL,
- *vpass = NULL;
+ *vpass = NULL, *sword=NULL;

 void go_register(void)
 {
@@ -21,20 +21,21 @@
   fname = cgi_is_var("fname");
   user = cgi_is_var("user");
   cemail = cgi_is_var("cemail");
+  sword = cgi_is_var("secretword");

   if ((!dom) || (!user) || (!fname))
- global_error("Misconfigured templates.", 0, 0);
+ global_error("Misconfigured templates Error 1.", 0, 0);

   if (!allowpassword) {
  if (!cemail)
-global_error("Misconfigured templates.", 0, 0);
+global_error("Misconfigured templates Error 2.", 0, 0);
   }
   else {
  pass = cgi_is_var("pass");
  vpass = cgi_is_var("vpass");

  if ((!pass) || (!vpass))
-global_error("Misconfigured templates.", 0, 0);
+global_error("Missing 1st password or Verify Password.", 0, 0);
   }

   if (!allowpassword) {
@@ -67,13 +68,15 @@
   if (*fname)
  global_par("RN", fname);

+  if (*sword)
+global_par("RS", sword);
   /*
  Always do this, because cemail can be optional.
   */
   if (cemail)
  global_par("CE", cemail);

-  if ((!(*dom)) || (!(*user)) || (!(*fname))) {
+  if ((!(*dom)) || (!(*user)) || (!(*fname)) || (!(*sword))) {
  global_warning("Please fill in all fields.");

  if (allowpassword)diff -u vqregister-2.6/vqregister.conf vqregister-2.61/vqregister.conf
--- vqregister-2.6/vqregister.conf  Fri Mar 16 07:22:44 2001
+++ vqregister-2.61/vqregister.conf Tue Feb 18 10:46:54 2003
@@ -185,7 +185,7 @@
 # Syntax: DB_Fields  [,[,]]
 #

-DB_Fields user_info user,dom,pass,cemail,fname
+DB_Fields user_info user,dom,pass,cemail,fname,secretword

 # ADVERTISE
 #
diff -u vqregister-2.6/vqregister.email vqregister-2.61/vqregister.email
--- vqregister-2.6/vqregister.email Mon Mar  5 07:48:16 2001
+++ vqregister-2.61/vqregister.emailTue Feb 18 10:47:16 2003
@@ -11,4 +11,6 @@
 Please do not respond to this message, as it has been
 generated by an unattended mail box.

+Your Secret Recovery Word is: $-RS.
+
 Send all email inquiries to the administrator at $-CA.