86b11495f3a0f4247165123d5cf36f8cb96376e1
[debian/mod-auth-mysql] / debian / patches / 010-enctype-apache.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 010-enctype-apache.dpatch by Andreas Barth <aba@not.so.argh.org>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Provide an Apache authentication method
6
7 @DPATCH@
8 diff -urNad mod-auth-mysql~/DIRECTIVES mod-auth-mysql/DIRECTIVES
9 --- mod-auth-mysql~/DIRECTIVES  2008-05-14 16:59:28.000000000 +0200
10 +++ mod-auth-mysql/DIRECTIVES   2008-05-15 09:49:06.000000000 +0200
11 @@ -203,6 +203,10 @@
12  
13         MySQL
14                 The hashing scheme used by the MySQL PASSWORD() function.
15 +       
16 +       Apache
17 +               The hashing scheme used by htpasswd utility. Compatible to
18 +               authuserfile.
19                 
20  AuthMySQL_Encryption_Types <type_list>
21         Synonym for Auth_MySQL_Encryption_Types.
22 diff -urNad mod-auth-mysql~/mod_auth_mysql.c mod-auth-mysql/mod_auth_mysql.c
23 --- mod-auth-mysql~/mod_auth_mysql.c    2008-05-14 18:46:21.000000000 +0200
24 +++ mod-auth-mysql/mod_auth_mysql.c     2008-05-15 09:49:06.000000000 +0200
25 @@ -102,6 +102,7 @@
26  #define CRYPT_ENCRYPTION_FLAG          1<<5
27  #endif
28  #define SHA1SUM_ENCRYPTION_FLAG                1<<6
29 +#define APACHE_ENCRYPTION_FLAG         1<<7
30  
31  static int check_no_encryption(const char *passwd, char *enc_passwd)
32  {
33 @@ -235,6 +236,11 @@
34         return (!strcmp(scrambled_passwd, enc_passwd));
35  }
36  
37 +static int check_apache_encryption(const char *passwd, char *enc_passwd)
38 +{
39 +       return (!ap_validate_password(passwd, enc_passwd));
40 +}
41 +
42  typedef struct {
43         char *name;
44         int (*check_function)(const char *passwd, char *enc_passwd);
45 @@ -253,6 +259,7 @@
46         { "Crypt",              check_crypt_encryption,                 CRYPT_ENCRYPTION_FLAG },
47         { "PHP_MD5",            check_PHP_MD5_encryption,               PHP_MD5_ENCRYPTION_FLAG },
48         { "SHA1Sum",    check_SHA1Sum_encryption, SHA1SUM_ENCRYPTION_FLAG},
49 +       { "Apache",             check_apache_encryption,                APACHE_ENCRYPTION_FLAG  },
50         /* add additional encryption types below */
51         { NULL,                 NULL,                                   0 }
52  };