@@ -77,15 +77,16 @@ function insert($event_name,$data) {
7777 $ uid = intval ($ app ->system ->getuid ($ data ['new ' ]['puser ' ]));
7878 if ($ uid > $ this ->min_uid ) {
7979 $ command = 'useradd ' ;
80- $ command .= ' --home ' .escapeshellcmd ($ data ['new ' ]['dir ' ]);
81- $ command .= ' --gid ' .escapeshellcmd ($ data ['new ' ]['pgroup ' ]);
82- $ command .= ' --non-unique ' ;
83- $ command .= ' --password ' .escapeshellcmd ($ data ['new ' ]['password ' ]);
84- $ command .= ' --shell ' .escapeshellcmd ($ data ['new ' ]['shell ' ]);
85- $ command .= ' --uid ' .escapeshellcmd ($ uid );
80+ $ command .= ' -d ' .escapeshellcmd ($ data ['new ' ]['dir ' ]);
81+ $ command .= ' -g ' .escapeshellcmd ($ data ['new ' ]['pgroup ' ]);
82+ $ command .= ' -o ' ; // non unique
83+ if ( $ data [ ' new ' ][ ' password ' ] != '' ) $ command .= ' -p ' .escapeshellcmd ($ data ['new ' ]['password ' ]);
84+ $ command .= ' -s ' .escapeshellcmd ($ data ['new ' ]['shell ' ]);
85+ $ command .= ' -u ' .escapeshellcmd ($ uid );
8686 $ command .= ' ' .escapeshellcmd ($ data ['new ' ]['username ' ]);
8787
8888 exec ($ command );
89+ $ app ->log ("Executed command: " .$ command ,LOGLEVEL_DEBUG );
8990 $ app ->log ("Added shelluser: " .$ data ['new ' ]['username ' ],LOGLEVEL_DEBUG );
9091
9192 //* Disable shell user temporarily if we use jailkit
@@ -125,7 +126,7 @@ function update($event_name,$data) {
125126 $ command .= ' ' .escapeshellcmd ($ data ['old ' ]['username ' ]);
126127
127128 exec ($ command );
128- // $app->log("Updated shelluser : $command ",LOGLEVEL_DEBUG);
129+ $ app ->log ("Executed command : $ command " ,LOGLEVEL_DEBUG );
129130 $ app ->log ("Updated shelluser: " .$ data ['old ' ]['username ' ],LOGLEVEL_DEBUG );
130131 } else {
131132 // The user does not exist, so we insert it now
0 commit comments