home *** CD-ROM | disk | FTP | other *** search
/ isnet Internet / Isnet Internet CD.iso / prog / hiz / 09 / 09.exe / adynware.exe / perl / lib / site / Win32 / NetAdmin.pm < prev    next >
Encoding:
Perl POD Document  |  1999-12-28  |  4.7 KB  |  215 lines

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