Commit 1fda9872 authored by Cool Fire's avatar Cool Fire

Fix 'username-www' user forces password change

When lastchange ldap attribute is set to 0 it also always forces a
password change. This breaks the suwww command. This commit fixes
that for newly created users only.
parent b5d68294
Pipeline #2194 passed with stage
in 4 minutes and 19 seconds
......@@ -162,6 +162,7 @@ class Manager2Api < Sinatra::Base
pwhash = generate_password_hash(password, nologin)
newuid = ldap_get_next_uid
userdn = "uid=#{username},#{settings.config['ldap']['oup']},#{settings.config['ldap']['base']}"
lastch = nologin ? '1' : '0'
userattrs = {
cn: username,
......@@ -169,7 +170,7 @@ class Manager2Api < Sinatra::Base
homedirectory: homedir,
loginshell: '/bin/bash',
objectclass: %w[account posixAccount top shadowAccount],
shadowlastchange: '0',
shadowlastchange: lastch,
shadowmax: '99999',
shadowwarning: '7',
uid: username,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment