View Issue Details

IDProjectCategoryView StatusLast Update
0004010mantisbtauthenticationpublic2021-01-16 05:01
Reporterthraxisp Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionwon't fix 
Summary0004010: Add NIS authentication as an alternative
Description

Attached is the code changes to add NIS/YP authentication.

Additional Information

Added global (optional) $g_nis_domains - list of domains to use in authentication

Extended global $g_login_method - added NIS constant

Changed modules:
account_page.php - disable password change if NIS
config_defaults.php, config_inc.php.sample - document new globals
core/authentication.php - added NIS authentication call
core/constant_inc.php - added NIS enum
core/nis_api.php - new file

TagsNo tags attached.
Attached Files
nis.tar.gz (21,326 bytes)
nis.diff (4,746 bytes)   
? core/nis_api.php
Index: account_page.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/account_page.php,v
retrieving revision 1.45
diff -c -r1.45 account_page.php
*** account_page.php	26 May 2004 02:28:54 -0000	1.45
--- account_page.php	5 Jul 2004 22:13:04 -0000
***************
*** 52,57 ****
--- 52,58 ----
  	extract( $row, EXTR_PREFIX_ALL, 'u' );
  
  	$t_ldap = ( LDAP == config_get( 'login_method' ) );
+ 	$t_nis = ( NIS == config_get( 'login_method' ) );
  
  	# In case we're using LDAP to get the email address... this will pull out
  	#  that version instead of the one in the DB
***************
*** 77,83 ****
  		</td>
  	</tr>
  
! <?php if ( $t_ldap ) { ?> <!-- With LDAP -->
  
  	<!-- Username -->
  	<tr class="row-1">
--- 78,84 ----
  		</td>
  	</tr>
  
! <?php if ( $t_ldap || $t_nis ) { ?> <!-- With LDAP or NIS -->
  
  	<!-- Username -->
  	<tr class="row-1">
***************
*** 92,98 ****
  	<!-- Password -->
  	<tr class="row-2">
  		<td colspan="2">
! 			The password settings are controlled by your LDAP entry,<br />
  			hence cannot be edited here.
  		</td>
  	</tr>
--- 93,99 ----
  	<!-- Password -->
  	<tr class="row-2">
  		<td colspan="2">
! 			The password settings are controlled by your <?php PRINT ($t_ldap ? 'LDAP' : 'NIS'); ?> entry,<br />
  			hence cannot be edited here.
  		</td>
  	</tr>
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.170
diff -c -r1.170 config_defaults_inc.php
*** config_defaults_inc.php	28 Jun 2004 10:13:22 -0000	1.170
--- config_defaults_inc.php	5 Jul 2004 22:13:07 -0000
***************
*** 794,799 ****
--- 807,816 ----
  	# You can simply change this at will. Mantis will try to figure out how the passwords were encrypted.
  	$g_login_method				= MD5;
  
+ 	# for NIS, you can specify search domains. This is optional. The default is to use
+ 	#  the default domain set up on the server (through /etc/yp.conf)
+ 	# $g_nis_domains = 'foo,bar';
+ 	
  	# --- limit reporters -------------
  	# Set to ON if you wish to limit reporters to only viewing bugs that they report.
  	$g_limit_reporters			= OFF;
Index: config_inc.php.sample
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_inc.php.sample,v
retrieving revision 1.12
diff -c -r1.12 config_inc.php.sample
*** config_inc.php.sample	8 Feb 2004 13:16:57 -0000	1.12
--- config_inc.php.sample	5 Jul 2004 22:13:07 -0000
***************
*** 49,57 ****
  	$g_return_path_email    = 'admin@example.com';
  
  	# --- login method ----------------
! 	# CRYPT or PLAIN or MD5 or LDAP or BASIC_AUTH
  	$g_login_method = MD5;
  
  	# --- email vars ------------------
  	# set to OFF to disable email check
  	# These should be OFF for Windows installations
--- 49,61 ----
  	$g_return_path_email    = 'admin@example.com';
  
  	# --- login method ----------------
! 	# CRYPT or PLAIN or MD5 or LDAP or BASIC_AUTH or NIS
  	$g_login_method = MD5;
  
+ 	# for NIS, you can specify search domains. This is optional. The default is to use
+ 	#  the default domain set up on the server (through /etc/yp.conf)
+ 	# $g_nis_domains = 'foo,bar';
+ 	
  	# --- email vars ------------------
  	# set to OFF to disable email check
  	# These should be OFF for Windows installations
Index: core/authentication_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/authentication_api.php,v
retrieving revision 1.39
diff -c -r1.39 authentication_api.php
*** core/authentication_api.php	26 May 2004 00:59:27 -0000	1.39
--- core/authentication_api.php	5 Jul 2004 22:13:07 -0000
***************
*** 146,151 ****
--- 146,155 ----
  			return ldap_authenticate( $p_user_id, $p_test_password );
  		}
  
+ 		if ( NIS == $t_configured_login_method ) {
+ 			return nis_authenticate( $p_user_id, $p_test_password );
+ 		}
+ 
  		$t_password			= user_get_field( $p_user_id, 'password' );
  		$t_login_methods	= Array(MD5, CRYPT, PLAIN);
  		foreach ( $t_login_methods as $t_login_method ) {
Index: core/constant_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/constant_inc.php,v
retrieving revision 1.18
diff -c -r1.18 constant_inc.php
*** core/constant_inc.php	8 Jun 2004 06:47:13 -0000	1.18
--- core/constant_inc.php	5 Jul 2004 22:13:08 -0000
***************
*** 90,95 ****
--- 90,96 ----
  	define( 'LDAP',				4 );
  	define( 'BASIC_AUTH',		5 );
  	define( 'HTTP_AUTH',		6 );
+ 	define( 'NIS', 				7 );
  
  	# file upload methods
  	define( 'DISK',			1 );
nis.diff (4,746 bytes)   

Relationships

related to 0004234 closedvboctor CAS authentication 
related to 0004235 closedvboctor Support Generic Authentication through Plug-ins 

Activities

thraxisp

thraxisp

2004-07-12 09:11

reporter   ~0006007

There is also a line needed in core/user_api.php:

Add " require_once( $t_core_dir . 'nis_api.php' );" after the line including the ldap_api.php file.

vboctor

vboctor

2004-07-20 04:50

manager   ~0006170

Ideally, I would like to avoid adding more login techniques to Mantis. However, I would like to expose an interface that can be implemented to make Mantis use a custom authentication method.

Examples of authentication systems:

  • LDAP (which is currently built-in)
  • NIS
  • Content Management System (use user names / password from PostNuke, PhpNuke, ...etc)
  • Email server.

For more details about how we can allow such hooks, see core/custom_function_api.php in 0.19.0a2.

looki

looki

2009-11-13 03:29

reporter   ~0023709

Hi,
can anyone update the nis possibility to version 1.2??
Or goes this feature into the next load?
:)
Thanks for help and informations.
Regards

rogueresearch

rogueresearch

2021-01-06 13:26

reporter   ~0064941

I'm pretty sure NIS is dead technology now in 2021. If this patch hasn't been merged already, then I'm not sure there's a point anymore...

dregad

dregad

2021-01-06 17:46

developer   ~0064945

I did not even know what NIS was, had to look it up ;-)

I don't think it makes any sense to put this in MantisBT core, and if anyone really needs it, they can try to implement it as an authentication plugin.