#!/usr/bin/perl
# helper program to delete users for CGI interface
# WARNING: will run as root!!! make changes with care
# Last modified: 16.11.2000 by Thomas Bleher

# needs some form of error-checking
for (<>) {
	#die if /[^-.\w]/;
	
        # Samba-User löschen
        `/usr/bin/smbpasswd -x $_`;
        `/bin/rm -rf /usr/local/samba/profiles/$_`;

        # public_html-Verzeichnis verschieben
	`/bin/mv /home/public_html/$_ /usr/local/httpd/htdocs/oldhomes/`;
        `/bin/chown -h -f -R root:www-data /usr/local/httpd/htdocs/oldhomes/$_`;
        `/bin/chmod -R 755 /usr/local/httpd/htdocs/oldhomes/$_`;

        # Benutzer und Homeverzeichnis löschen
	`/usr/sbin/userdel -r $_`;
	`/usr/sbin/groupdel $_`;
}
`/usr/local/sbin/generate_apache_auth`;

