[sork] Mdaemon passwd module
Michael Cochrane
mike@graftonhall.co.nz
Thu, 4 Jul 2002 10:52:38 +0100
This message is in MIME format.
---------------------- multipart/mixed attachment
Attached is a new file and a diff for passwd to allow users to change their
password on a n Mdaemon mail server. This code uses semaphore files so needs
read/write access to the mdaemon/app folder. only been tested with local access
but network or any other location fopen supports should work. Tested with
mdaemon 5.0.4
FYI: Mdaemon is a windows mail server.
- Mike :-)
Patch:
Index: passwd/main.php
===================================================================
RCS file: /repository/passwd/main.php,v
retrieving revision 1.11
diff -I$Horde -I$Revision -I$Date -r1.11 main.php
116a117,120
> case "mdaemon":
> require PASSWD_BASE . "/mdaemon.php";
> $daemon = new mdaemon;
> break;
Index: passwd/config/conf.php.dist
===================================================================
RCS file: /repository/passwd/config/conf.php.dist,v
retrieving revision 1.6
diff -I$Horde -I$Revision -I$Date -r1.6 conf.php.dist
58a59,64
> // Example of mdaemon server.
> // Note: realm must be set to the maildomain in imp/config/servers.php
> //$conf['server']['type'] = 'mdaemon';
> //$conf['server']['params']['location'] = 'c:/MDaemon/App';
>
>
-------------------------------------------------------------------------
This mail sent from Mike's CVS HEAD install of IMP: http://horde.org/imp/
---------------------- multipart/mixed attachment
PD8NCg0KLyoqDQogKiBUaGUgbWRhZW1vbiBjbGFzcyBhdHRlbXB0cyB0byBjaGFuZ2UgYSB1c2Vy
J3MgcGFzc3dvcmQgb24gYSBtZGFlbW9uDQogKiBtYWlsIHNlcnZlci4NCiAqDQogKiBAYXV0aG9y
ICAgTWlrZSBDb2NocmFuZSA8bWlrZUBncmFmdG9uaGFsbC5jby5uej4NCiAqIEBwYWNrYWdlICBw
YXNzd2QNCiAqLw0KDQpjbGFzcyBtZGFlbW9uIHsNCg0KICAgIC8qKiBlcnJvciBzdHJpbmcgcmV0
dXJuZWQgdG8gdXNlciBpZiBhbiBlcm9yIG9jY3Vycy4gKi8NCiAgICB2YXIgJGVycl9zdHI7DQoN
CiAgICAvKioNCiAgICAgKiBDaGFuZ2UgdGhlIHV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
X3N0ciA9IF8oIk5vdCBhYmxlIHRvIGNyZWF0ZSBsb2NrIGZpbGUiKTsNCiAgICAgICAgICAgcmV0
dXJuIGZhbHNlOw0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgZmNsb3NlKCRmcCk7DQog
ICAgICAgIH0NCg0KICAgICAgICAvKiBnZXQgY3VycmVudCBkZXRhaWxzICovDQogICAgICAgICRj
dXJyZW50X2RldGFpbHMgPSAkdGhpcy0+X2dldFVzZXJEZXRhaWxzKCR1c2VyX25hbWUsICRyZWFs
bSk7DQogICAgICAgIGlmICgkY3VycmVudF9kZXRhaWxzID09PSBmYWxzZSkgew0KICAgICAgICAg
ICByZXR1cm4gZmFsc2U7DQogICAgICAgIH0NCg0KICAgICAgICAkbmV3X2RldGFpbHMgPSBzdWJz
dHJfcmVwbGFjZSgkY3VycmVudF9kZXRhaWxzLCBzdHJfcGFkKCRuZXdfcGFzc3dvcmQsIDE5KSAu
ICJZIiwgMTk1LCAyMCk7DQoNCiAgICAgICAgLyogY3JlYXRlIFNlbWFwaG9yZSBmaWxlICovDQog
ICAgICAgICRmcCA9IGZvcGVuKCRsb2NhdGlvbiAuICcvZWRpdHVzZXIuc2VtJywgIndiIik7DQog
ICAgICAgIGlmICghJGZwKSB7DQogICAgICAgICAgICR0aGlzLT5lcnJfc3RyID0gXygiTm90IGFi
bGUgdG8gY3JlYXRlIHNlbWFwaG9yZSBmaWxlIik7DQogICAgICAgICAgIHJldHVybiBmYWxzZTsN
CiAgICAgICAgfSBlbHNlIHsNCiAgICAgICAgICAgIGZ3cml0ZSgkZnAsICIkdXNlcl9uYW1lQCRy
ZWFsbSwgIiAuICRuZXdfZGV0YWlscyk7DQogICAgICAgICAgICBmY2xvc2UoJGZwKTsNCiAgICAg
ICAgfQ0KDQogICAgICAgIC8qIHJlbW92ZSBsb2NrIGZpbGUgKi8NCiAgICAgICAgQHVubGluaygk
bG9jYXRpb24gLiAnL2VkaXR1c2VyLmxjaycpOw0KDQogICAgICAgIHJldHVybiB0cnVlOw0KICAg
IH0NCg0KDQogICAgLyoqDQogICAgICogUmV0cmVpdmUgcmVsZXZhbnQgbGluZSBmcm9tIHVzZXJs
aXN0LmRhdA0KICAgICAqDQogICAgICogQHBhcmFtICAgJHVzZXJuYW1lICAgICBUaGUgdXNlcm5h
bWUgZm9yIHdoaWNoIHRvIHJldHJpZXZlIGRldGFscy4uDQogICAgICogQHBhcmFtICAgJHJlYWxt
ICAgICAgICBUaGUgcmVhbG0gKGRvbWFpbikgZm9yIHRoZSB1c2VyLg0KICAgICAqDQogICAgICog
QHJldHVybiAgU3RyaW5nICAgICAgICBMaW5lIGZyb20gdXNlcmxpc3QuZGF0DQogICAgICovDQog
ICAgZnVuY3Rpb24gX2dldFVzZXJEZXRhaWxzKCR1c2VyX25hbWUsICRyZWFsbSkgew0KICAgICAg
ICAkY29uZiA9ICYkR0xPQkFMU1snY29uZiddOw0KICAgICAgICAkbG9jYXRpb24gPSAkY29uZlsn
c2VydmVyJ11bJ3BhcmFtcyddWydsb2NhdGlvbiddOw0KDQogICAgICAgICRzZWFyY2hTdHJpbmcg
PSBzdHJfcGFkKCRyZWFsbSwgNDUpIC4gc3RyX3BhZCgkdXNlcl9uYW1lLCAzMCk7DQoNCiAgICAg
ICAgJGZwID0gZm9wZW4oJGxvY2F0aW9uIC4gJy91c2VybGlzdC5kYXQnLCAicmIiKTsNCiAgICAg
ICAgaWYgKCEkZnApIHsNCiAgICAgICAgICAgJHRoaXMtPmVycl9zdHIgPSBfKCJNZGFlbW9uIHVz
ZXJsaXN0IGZpbGUgbm90IGFjY2Vzc2FibGUgb3IgZm91bmQuIik7DQogICAgICAgICAgIHJldHVy
biBmYWxzZTsNCiAgICAgICAgfQ0KICAgICAgICANCiAgICAgICAgd2hpbGUgKCFmZW9mICgkZnAp
KSB7DQogICAgICAgICAgICAkbGluZSA9IGZnZXRzKCRmcCwgNDA5Nik7DQogICAgICAgICAgICBp
ZiAoc3Vic3RyKCRsaW5lLDAsc3RybGVuKCRzZWFyY2hTdHJpbmcpKSA9PSAkc2VhcmNoU3RyaW5n
KSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICRsaW5lOw0KICAgICAgICAgICAgfQ0KICAgICAg
ICB9DQoNCiAgICAgICAkdGhpcy0+ZXJyX3N0ciA9IF8oIlVzZXIgJHVzZXJfbmFtZUAkcmVhbG0g
bm90IGZvdW5kIik7DQogICAgICAgIHJldHVybiBmYWxzZTsNCiAgICB9DQp9DQo=
---------------------- multipart/mixed attachment--