+ldapvmail (0.2.1) unstable; urgency=low
+
+ * admin password, new implementation
+ * compilation warning clean
+ * fix initialization for Balias and Bforward buttons
+
+ -- Peter Popovec <popovec@zubok> Thu, 7 Apr 2005 13:55:05 +0200
+
ldapvmail (0.2) unstable; urgency=low
* Default is Maildir not mailbox
-This package was debianized by Peter Popovec <popovec@fei.tuke.sk> on
+By Peter Popovec <popovec@fei.tuke.sk> on
Sun, 30 Jan 2005 12:15:51 +0100.
It was downloaded from http://zub.fei.tuke.sk/local.packages
-Upstream Author(s): Peter Popovec <popovec@fei.tuke.sk>
Copyright:
+++ /dev/null
-Document: ldapvmail
-Title: Debian ldapvmail Manual
-Author: <insert document author here>
-Abstract: This manual describes what ldapvmail is
- and how it can be used to
- manage online manuals on Debian systems.
-Section: unknown
-
-Format: debiandoc-sgml
-Files: /usr/share/doc/ldapvmail/ldapvmail.sgml.gz
-
-Format: postscript
-Files: /usr/share/doc/ldapvmail/ldapvmail.ps.gz
-
-Format: text
-Files: /usr/share/doc/ldapvmail/ldapvmail.text.gz
-
-Format: HTML
-Index: /usr/share/doc/ldapvmail/html/index.html
-Files: /usr/share/doc/ldapvmail/html/*.html
-
-
{
newtComponent form, label, Bok, Bcancel, PWentry, DNentry, answer;
struct newtExitStruct es;
- char *DN, *PW, *GN, *SN;
+ const char *DN, *PW, *GN, *SN;
+ char *newDN;
LDAP *ld;
char *addAttrxValue[8];
addAttr0[i]->mod_values[3] = strdup ("inetOrgPerson");
addAttr0[i]->mod_values[4] = strdup ("qmailUser");
addAttr0[i]->mod_values[5] = NULL;
- asprintf (&DN, "uid=%s,%s", addAttrxValue[0], GetDefaultVmailSubtree ());
+ asprintf (&newDN, "uid=%s,%s", addAttrxValue[0], GetDefaultVmailSubtree ());
switch (ldapLogin (&ld, WRITE_OP))
{
return 1;
}
int ecode;
- if (0 == (ecode = ldap_add_s (ld, DN, addAttr0)))
+ if (0 == (ecode = ldap_add_s (ld, newDN, addAttr0)))
{
infoWindow ("VMAIL account add", "User ok", 100);
return (0);
can be used old credential only if is not expired or old credential is not
escaped with anonymous bind.
+WRITE_OP_CACHED no timeout is checcked, if non anonymous credencial is
+available, no new password is readed
return value:
0 if success, -1 init error, -3 no homedir, -4 invalid credential or other
version = LDAP_VERSION3;
ldap_set_option (*ld, LDAP_OPT_PROTOCOL_VERSION, &version);
gettimeofday (¤t, NULL);
- //if we have anonymous credential or timeout exited
- //we need to get new credential (bnegative timeout -> write passwd cache)
-
- if (GetDefaultVmailPcache () < 0)
+ if (nomod != WRITE_OP_CACHED || logindata.type == 0)
{
- if (logindata.type == 0
- || current.tv_sec >
- logindata.expire.tv_sec + abs (GetDefaultVmailPcache ()))
+ //if we have anonymous credential or timeout exited
+ //we need to get new credential (bnegative timeout -> write passwd cache)
+
+ if (GetDefaultVmailPcache () < 0)
{
- if (0 != get_ldap_login (&logindata))
+ if (current.tv_sec >
+ logindata.expire.tv_sec + abs (GetDefaultVmailPcache ()))
{
- ldap_unbind (*ld); //free ldap structure
- return (-3);
+ if (0 != get_ldap_login (&logindata))
+ {
+ ldap_unbind (*ld); //free ldap structure
+ return (-3);
+ }
}
}
- }
- else
- //if we have anonymous credential or operation is write or timeout exited
- //we need to get new credential
- {
- if (nomod == WRITE_OP || logindata.type == 0
- || current.tv_sec >
- logindata.expire.tv_sec + abs (GetDefaultVmailPcache ()))
+ else
+ //if we have anonymous credential or operation is write or timeout exited
+ //we need to get new credential
{
- if (0 != get_ldap_login (&logindata))
+ if (nomod == WRITE_OP || current.tv_sec >
+ logindata.expire.tv_sec + abs (GetDefaultVmailPcache ()))
{
- ldap_unbind (*ld); //free ldap structure
- return (-3);
+ if (0 != get_ldap_login (&logindata))
+ {
+ ldap_unbind (*ld); //free ldap structure
+ return (-3);
+ }
}
}
}
if (ldap_simple_bind_s (*ld, logindata.binddn, logindata.bindpw))
{
ldap_unbind (*ld); //free ldap structure
- logindata.type = 0; //set as anonymous login
+ logindata.type = 0; //set as anonymous login
return (-4);
}
get_ldap_login (bindCredencial * ldata)
{
- char *defaultDN = NULL;
- char *PW, *DN;
+ const char *defaultDN = NULL;
+ const char *PW, *DN;
newtComponent form, Bok, Bcancel, Banon, label, answer, DNentry, PWentry;
defaultDN = GetDefaultVmailAdmin ();
#define READ_OP 1
#define WRITE_OP 0
+#define WRITE_OP_CACHED 2
int ldapLogin (LDAP ** ld, int type);
#include "vmailHelper.h"
int
-passBox (char *dn)
+passBox (char *dn, LDAP * ld)
{
newtComponent form, Label, entry1, entry2, button, cancel, answer;
- char *pass1, *pass2;
-
+ const char *pass1, *pass2;
+ char *pass;
newtOpenWindow (4, 8, 74, 10, "Change password for DN:");
form = newtForm (NULL, NULL, 0);
entry1 = newtEntry (11, 3, NULL, 32, &pass1, NEWT_FLAG_PASSWORD);
"Sorry, passwords do not match", 1);
continue;
}
- ldapPass (dn, pass1);
+ pass = strdup (pass1);
+ ldapPass (dn, pass, ld);
break;
}
}
}
int
-ldapPass (char *dn, char *pass)
+ldapPass (char *dn, char *pass, LDAP * ld)
{
- LDAP *ld;
+// LDAP *ld;
LDAPMod *addAttr0[2];
addAttr0[0] = malloc (sizeof (LDAPMod));
addAttr0[1] = NULL;
asprintf (&addAttr0[0]->mod_values[0], "{crypt}%s",
crypt (pass, "$!$pemasksk"));
addAttr0[0]->mod_values[1] = NULL;
-
- switch (ldapLogin (&ld, WRITE_OP))
+ if (ld == NULL)
{
- case (0):
- break;
- case (-1):
- infoWindow ("Password change", "LDAP init error", 1);
- return (1);
- case (-3):
- infoWindow ("Password change",
- "Couldn't bind to server, operation canceled", 1);
- return 1;
- default:
- infoWindow ("Password change",
- "Couldn't bind to server, invalid credencial or other error",
- 1);
- return 1;
+ switch (ldapLogin (&ld, WRITE_OP))
+ {
+ case (0):
+ break;
+ case (-1):
+ infoWindow ("Password change", "LDAP init error", 1);
+ return (1);
+ case (-3):
+ infoWindow ("Password change",
+ "Couldn't bind to server, operation canceled", 1);
+ return 1;
+ default:
+ infoWindow ("Password change",
+ "Couldn't bind to server, invalid credencial or other error",
+ 1);
+ return 1;
+ }
}
int ecode;
if (0 == (ecode = ldap_modify_s (ld, dn, addAttr0)))
-int ldapPass (char *dn, char *pass);
-int passBox (char *dn);
+int ldapPass (char *dn, char *pass,LDAP *ld);
+int passBox (char *dn,LDAP *ld);
#include "ldaplogin.h"
#include "vmailHelper.h"
#include "vmailsetup.h"
-
+#include "ldappass.h"
typedef struct vmailEntry0
{
int ldapEdit (vmailEntry * vmail);
int doEdit0 (vmailEntry * vmail);
-int ldapPass (char *dn, char *pass);
-int passBox (char *dn);
int ChangeEntry0 (char *wname, char *olddata, char **data, int type);
char *ChangeEntry (char *wname, char **data, int type);
char *getSearchFilter (void);
int doEdit (void);
int
-main ()
+main (int argc, char *argv[])
{
int rc, textWidth;
if (vmail->forwardValues != NULL)
{
+ Bforward = NULL;
Label0 = newtLabel (1, 6, "Forwarded to:");
newtFormAddComponent (form, Label0);
List1 =
}
if (vmail->aliasValues != NULL)
{
+ Balias=NULL;
Label0 = newtLabel (1, 9, "Aliases:");
newtFormAddComponent (form, Label0);
List2 =
{
int co;
char *data = NULL;
- realedit = 1;
co = (int) newtListboxGetCurrent (List0);
cycle1:
{
{
if (strlen (data) == 0)
goto cycle1;
+ realedit = 1;
newtListboxSetEntry (List0, co, data);
}
}
}
if (answer == Bpass)
- passBox (vmail->dn);
+ passBox (vmail->dn, NULL);
if (answer == Bforward)
{
char **newdata;
ChangeEntry0 (char *wname, char *olddata, char **data, int type)
{
newtComponent form, entry, cancel, button, answer, add = NULL;
- char *entryValue;
+ const char *entryValue;
newtOpenWindow (4, 8, 74, 10, wname);
form = newtForm (NULL, NULL, 0);
entry = newtEntry (16, 1, olddata, 40, &entryValue,
getSearchFilter ()
{
newtComponent form, label, Bcancel, Bok, POPentry, MAILentry, answer;
- char *DN, *PW, *filter;
+ const char *DN, *PW;
+ char *filter;
newtCenteredWindow (65, 12, "Search account");
form = newtForm (NULL, NULL, 0);
#include "ldappass.h"
#include <sys/stat.h>
#include <sys/types.h>
-
+#include "vmailsetup.h"
+#include <string.h>
int
infoWindow (char *wname, char *wmesg, int type)
{
int
selectDN ()
{
- char *entryValue;
+ const char *entryValue;
+ char *DN;
newtComponent form, label, button, entry, cancel, answer;
LDAP *ld;
struct timeval timeout;
label = newtTextbox (1, 0, 50, 3, NEWT_FLAG_WRAP);
newtTextboxSetText (label, "Enter DN or uid/cn to search for DN");
newtFormAddComponent (form, label);
-
- entry = newtEntry (6, 2, NULL, 53, &entryValue,
+ DN = GetDefaultVmailAdmin ();
+ entry = newtEntry (6, 2, DN, 53, &entryValue,
NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
newtFormAddComponent (form, entry);
button = newtButton (19, 6, "Ok");
newtPopWindow ();
return (0);
}
+ if (entryValue == NULL)
+ {
+ newtFormDestroy (form);
+ newtPopWindow ();
+ return (0);
+
+ }
+ if (strlen (entryValue) == 0)
+ {
+ newtFormDestroy (form);
+ newtPopWindow ();
+ return (0);
+
+ }
switch (ldapLogin (&ld, READ_OP))
{
case (0):
newtPopWindow ();
return 1;
}
-//entryValue DN for operatrion
-//TODO ....
- passBox (entryValue);
+ DN = strdup (entryValue);
+ passBox (DN, ld);
newtFormDestroy (form);
newtPopWindow ();
return (0);