• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item4544: Add pointer to twiki.org topic on special format used in .htpasswd on creation time

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
NotTWiki TWiki.org Normal Confirmed   minor  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

[08:28:59] <Lavr> SteffenPoulsen. Remember when you advice people to use the htpasswd utility that it deletes all email addresses from .htpasswd
[08:29:22] <Lavr> Or at least from the entry to change
[08:30:13] <SteffenPoulsen> ah yep - forgot that, good point :-)
[08:30:17]
<Lavr> I usually run the htpasswd utility on a new password file
and then copy paste the result into the real one
[08:31:05] <SteffenPoulsen> yes, me too .. wonder if there's a topic I could have pointed to on the procedure
[08:32:07] <SvenDowideit> how about a commented out line that is added to the topof the .htpasswd file?
[08:32:55] * CDot has joined #twiki
[08:33:35] * marclaporte has joined #twiki
[08:34:15]
<Lavr> Yes when it is created. That would not be a bad idea. "Do
not use htpasswd utility on this file. See "URL to t.o FAQ topic"
[08:34:32] <SteffenPoulsen> pls go implement :-)
[08:35:25] <SvenDowideit> please add bug item
[08:35:42] <SvenDowideit> twikibot, make new bug?
[08:35:51] <SteffenPoulsen> :-)

-- TWiki:Main/SteffenPoulsen - 04 Sep 2007

Unsure about this, I don't think storing information directly in the .htpasswd file is an option (all entries are read and written on user updates, non-standard lines are lost in the process).

Perhaps a simple thing like this would be OK (create an additional .htpasswd.README file on creation time).

Index: lib/TWiki/Users/HtPasswdUser.pm
===================================================================
--- lib/TWiki/Users/HtPasswdUser.pm     (revision 14913)
+++ lib/TWiki/Users/HtPasswdUser.pm     (working copy)
@@ -123,6 +123,21 @@
 sub _savePasswd {
     my $db = shift;

+    unless (-e "$TWiki::cfg{Htpasswd}{FileName}" ) {
+        # Item4544: Add pointer to twiki.org topic on special format used in .htpasswd
+        umask( 077 );
+        open( FILE, ">$TWiki::cfg{Htpasswd}{FileName}.README" ) ||
+          throw Error::Simple( $TWiki::cfg{Htpasswd}{FileName}.
+                                 '.README open failed: '.$! );
+
+        print FILE "# TWiki uses a specially crafted .htpasswd file format that should not be\n";
+        print FILE "# manipulated using a standard htpasswd utility.\n";
+        print FILE "# (3rd-party utilities does not support the e-mail address format used).\n";
+        print FILE "# \n";
+        print FILE "# More information available at: http://twiki.org/cgi-bin/view/TWiki/HtPasswdFormat.\n";
+        close( FILE);
+    }
+
     umask( 077 );
     open( FILE, ">$TWiki::cfg{Htpasswd}{FileName}" ) ||
       throw Error::Simple( $TWiki::cfg{Htpasswd}{FileName}.

If it is enough for this item, only todo is to create the twiki.org topic linked to.

-- TWiki:Main.SteffenPoulsen - 17 Sep 2007

Confirmed, and applies to TWiki.org

CC

ItemTemplate
Summary Add pointer to twiki.org topic on special format used in .htpasswd on creation time
ReportedBy TWiki:Main.SteffenPoulsen
Codebase

SVN Range TWiki-4.2.0, Thu, 30 Aug 2007, build 14664
AppliesTo NotTWiki
Component TWiki.org
Priority Normal
CurrentState Confirmed
WaitingFor

Checkins

TargetRelease minor
ReleasedIn

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2007-10-12 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback