W liście z pią, 07-03-2003, godz. 01:32, Dale Woolridge pisze: 
>     3. have the authenticator also return the maildir.
>        if absent, the binc conf setting would be used.
You can find a small program that does something similar in the Contrib
section (http://www.bincimap.andreas.hanssen.name/bincimap-contrib.html)
BTW, Andreas, could you please remove this silly 
 if(cwd==NULL) exit(111);
and replace the getcwd() line with
if(getcwd(cwd,sizeof(cwd))==NULL) exit(111);

? It is a leftover from my previous experiments with getcwd(), and looks
pretty lame with a static array ;)

> 
>     4. explore other options using only vmailmgr capabilities
>        (nothing is obvious to me here)
I attach a native vmailmgr authenticator for binc-imap. Put it into the
authenticate/ dir in your vmailmgr source tree, and apply the patch for
Makefile.am (patch -p1 < Makefile.diff in vmailmgr-0.96.9/), then
recompile.
It has same features as checkvpw, see the source code for details.
Remember to set Maildir path to "" in your bincimap.conf. This code will
also take care of real, system users (exactly as checkvpw does).

regards,

-- 
Marek Gutkowski <[EMAIL PROTECTED]>
// Copyright (C) 1999,2000 Bruce Guenter <[EMAIL PROTECTED]>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#include <config.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include "config/configrc.h"
#include "misc/exec.h"
#include "misc/stat_fns.h"
#include "fdbuf/fdbuf.h"
#include "authvlib.h"

const mystring exec_presetuid = "binc-auth-presetuid";
const mystring exec_postsetuid = "binc-auth-postsetuid";

void fail(const char* msg, const char* execfile, int code)
{
  presetenv("BINC-AUTH_ERROR=", msg);
  execute(execfile);
  exit(code);
}

void fail_login(const char* msg)
{
  fail(msg, "binc-auth-loginfail", 100);
}

void fail_baddata(const char* msg)
{
  fail(msg, "binc-auth-error", 111);
}

void fail_temporary(const char* msg)
{
  fail(msg, "binc-auth-error", 111);
}

struct auth_data 
{
  mystring name;
  mystring pass;

  auth_data(mystring n, mystring p)
    : name(n), pass(p)
  {
    name = name.lower();
  }
  ~auth_data() { }
};

auth_data* getdata()
{
  char *name = getenv("BINC_USERID");
	  if(!name) fail_baddata("$BINC_USERID not set");
  char *pass = getenv("BINC_PASSWD"); 
	  if(!pass) fail_baddata("$BINC_PASSWD not set");
  
  return new auth_data(name, pass);
}

int main(void)
{
  auth_data* auth = getdata();

  mystring hostname;
  set_domain(auth->name, hostname);

  user_data* udata = authenticate(auth->name, auth->pass, hostname);
  fout<<udata->uid<<"."<<udata->gid<<'\n';
  fout<<udata->home<<"/"<<udata->maildir<<'\n';
  execute("binc-auth-postexec");
  return 0;
}
diff -ru vmailmgr-0.96.9-vanilla/authenticate/Makefile.am vmailmgr-0.96.9/authenticate/Makefile.am
--- vmailmgr-0.96.9-vanilla/authenticate/Makefile.am	Sat Sep 23 22:23:32 2000
+++ vmailmgr-0.96.9/authenticate/Makefile.am	Mon Feb 24 23:22:18 2003
@@ -1,4 +1,4 @@
-bin_PROGRAMS = checkvpw vauthenticate
+bin_PROGRAMS = checkvpw vauthenticate bincimap-auth-vmailmgr
 authlib_PROGRAMS = authvmailmgr
 authlibdir = ${prefix}/lib/courier-imap/libexec/authlib/
 
@@ -25,6 +25,9 @@
 
 checkvpw_SOURCES = checkvpw.cc authvlib.cc authvlib.h
 checkvpw_LDADD = ../lib/libvmailmgr.a
+
+bincimap_auth_vmailmgr_SOURCES = bincimap-auth-vmailmgr.cc authvlib.cc authvlib.h
+bincimap_auth_vmailmgr_LDADD = ../lib/libvmailmgr.a
 
 authvmailmgr_SOURCES = authvmailmgr.cc authvlib.cc authvlib.h
 authvmailmgr_LDADD = ../lib/libvmailmgr.a -L../lib/courier-authlib -lauthmod

Reply via email to