home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / win95 / pw32i306.exe / lib / Win32 / netadmin.pm < prev    next >
Text File  |  1996-10-14  |  5KB  |  209 lines

  1. package Win32::NetAdmin;
  2.  
  3. #
  4. #NetAdmin.pm
  5. #Written by Douglas_Lankshear@ActiveWare.com
  6. #
  7.  
  8. require Exporter;
  9. require DynaLoader;
  10.  
  11. die "The Win32::NetAdmin module works only on Windows NT" if(!Win32::IsWinNT() );
  12.  
  13. @ISA= qw( Exporter DynaLoader );
  14. # Items to export into callers namespace by default. Note: do not export
  15. # names by default without a very good reason. Use EXPORT_OK instead.
  16. # Do not simply export all your public functions/methods/constants.
  17. @EXPORT = qw(
  18.     FILTER_TEMP_DUPLICATE_ACCOUNT
  19.     FILTER_NORMAL_ACCOUNT
  20.     FILTER_INTERDOMAIN_TRUST_ACCOUNT
  21.     FILTER_WORKSTATION_TRUST_ACCOUNT
  22.     FILTER_SERVER_TRUST_ACCOUNT
  23.     SV_TYPE_WORKSTATION
  24.     SV_TYPE_SERVER
  25.     SV_TYPE_SQLSERVER
  26.     SV_TYPE_DOMAIN_CTRL
  27.     SV_TYPE_DOMAIN_BAKCTRL
  28.     SV_TYPE_TIMESOURCE
  29.     SV_TYPE_AFP
  30.     SV_TYPE_NOVELL
  31.     SV_TYPE_DOMAIN_MEMBER
  32.     SV_TYPE_PRINT
  33.     SV_TYPE_DIALIN
  34.     SV_TYPE_XENIX_SERVER
  35.     SV_TYPE_NT
  36.     SV_TYPE_WFW
  37.     SV_TYPE_POTENTIAL_BROWSER
  38.     SV_TYPE_BACKUP_BROWSER
  39.     SV_TYPE_MASTER_BROWSER
  40.     SV_TYPE_DOMAIN_MASTER
  41.     SV_TYPE_DOMAIN_ENUM
  42.     SV_TYPE_ALL
  43.     UF_TEMP_DUPLICATE_ACCOUNT
  44.     UF_NORMAL_ACCOUNT
  45.     UF_INTERDOMAIN_TRUST_ACCOUNT
  46.     UF_WORKSTATION_TRUST_ACCOUNT
  47.     UF_SERVER_TRUST_ACCOUNT
  48.     UF_MACHINE_ACCOUNT_MASK
  49.     UF_ACCOUNT_TYPE_MASK
  50.     UF_DONT_EXPIRE_PASSWD
  51.     UF_SETTABLE_BITS
  52.     UF_SCRIPT
  53.     UF_ACCOUNTDISABLE
  54.     UF_HOMEDIR_REQUIRED
  55.     UF_LOCKOUT
  56.     UF_PASSWD_NOTREQD
  57.     UF_PASSWD_CANT_CHANGE
  58.     USE_FORCE
  59.     USE_LOTS_OF_FORCE
  60.     USE_NOFORCE
  61.     USER_PRIV_MASK
  62.     USER_PRIV_GUEST
  63.     USER_PRIV_USER
  64.     USER_PRIV_ADMIN
  65. );
  66.  
  67. =head1 NAME
  68.  
  69. Win32::NetAdmin - manage network groups and users in perl
  70.  
  71. =head1 SYNOPSIS
  72.  
  73.     use Win32::NetAdmin;
  74.  
  75. =head1 DESCRIPTION
  76.  
  77. This module offers control over the administration of groups and users over a network.
  78.  
  79. =head1 FUNCTIONS
  80.  
  81. =head2 NOTE:
  82. all of the functions return FALSE (0) if they fail, unless otherwise noted.
  83. server is optional for all the calls below. (if not given the local machine is assumed.)
  84.  
  85. =over 10
  86.  
  87. =item GetDomainController(server, domain, returnedName)
  88.     Return the name of the domain controller for server
  89.  
  90. =item UserCreate(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  91.     Creates a user on server with password, passwordAge, privilege, homeDir, comment, flags, and scriptPath
  92.  
  93. =item UserDelete(server, user)
  94.     Deletes a user from server
  95.  
  96. =item UserGetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  97.     Gets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  98.  
  99. =item UserSetAttributes(server, userName, password, passwordAge, privilege, homeDir, comment, flags, scriptPath)
  100.     Sets password, passwordAge, privilege, homeDir, comment, flags, and scriptPath for user
  101.  
  102. =item UserChangePassword(domainname, username, oldpassword, newpassword)
  103.     Changes a users password. Can be run under any account.
  104.  
  105. =item UsersExist(server, userName)
  106.     Checks if a User exists
  107.  
  108. =item GetUsers(server, filter, \@userArray)
  109.     Fills userArray with the all of the User names
  110.  
  111. =item GroupCreate(server, group, comment)
  112.     Creates a group
  113.  
  114. =item GroupDelete(server, group)
  115.     Deletes a group
  116.  
  117. =item GroupGetAttributes(server, groupName, comment)
  118.     Gets the comment
  119.  
  120. =item GroupSetAttributes(server, groupName, comment)
  121.     Sets the comment
  122.  
  123. =item GroupAddUsers(server, groupName, users)
  124.     Adds a user to a group
  125.  
  126. =item GroupDelUsers(server, groupName, users)
  127.     Deletes a users from a group
  128.  
  129. =item GroupIsMember(server, groupName, user)
  130.     Returns TRUE if user is a member of groupName
  131.  
  132. =item GroupGetMembers(server, groupName, \@userArray)
  133.     Fills userArray with the members of groupName
  134.  
  135. =item LocalGroupCreate(server, group, comment)
  136.     Creates a local group
  137.  
  138. =item LocalGroupDelete(server, group)
  139.     Deletes a local group
  140.  
  141. =item LocalGroupGetAttributes(server, groupName, comment)
  142.     Gets the comment
  143.  
  144. =item LocalGroupSetAttributes(server, groupName, comment)
  145.     Sets the comment
  146.  
  147. =item LocalGroupIsMember(server, groupName, user)
  148.     Returns TRUE if user is a member of groupName
  149.  
  150. =item LocalGroupGetMembers(server, groupName, \@userArray)
  151.     Fills userArray with the members of groupName
  152.  
  153. =item LocalGroupAddUsers(server, groupName, users)
  154.     Adds a user to a group
  155.  
  156. =item LocalGroupDelUsers(server, groupName, users)
  157.     Deletes a users from a group
  158.  
  159. =item GetServers(server, domain, flags, \@serverArray)
  160.     Gets an array of server names
  161.     flags - see SV_TYPE_... in constants
  162.  
  163. =back
  164.  
  165. =cut
  166.  
  167. sub AUTOLOAD {
  168.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  169.     # XS function.  If a constant is not found then control is passed
  170.     # to the AUTOLOAD in AutoLoader.
  171.  
  172.     my($constname);
  173.     ($constname = $AUTOLOAD) =~ s/.*:://;
  174.     #reset $! to zero to reset any current errors.
  175.     $!=0;
  176.     my $val = constant($constname, @_ ? $_[0] : 0);
  177.     if ($! != 0) {
  178.     if ($! =~ /Invalid/) {
  179.         $AutoLoader::AUTOLOAD = $AUTOLOAD;
  180.         goto &AutoLoader::AUTOLOAD;
  181.     }
  182.     else {
  183.         ($pack,$file,$line) = caller;
  184.         die "Your vendor has not defined Win32::NetAdmin macro $constname, used in $file at line $line.";
  185.     }
  186.     }
  187.     eval "sub $AUTOLOAD { $val }";
  188.     goto &$AUTOLOAD;
  189. }
  190.  
  191. bootstrap Win32::NetAdmin;
  192.  
  193. # Preloaded methods go here.
  194.  
  195. # Autoload methods go after __END__, and are processed by the autosplit program.
  196.  
  197. 1;
  198. __END__
  199.     
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.