Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2709 connectés 

  FORUM HardWare.fr
  Programmation
  Perl

  [Perl] Fonction find, en plus d'utilisation de simili-objet

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[Perl] Fonction find, en plus d'utilisation de simili-objet

n°675119
burgergold
5$? va chez l'diable!
Posté le 16-03-2004 à 15:09:52  profilanswer
 

J'ai la structure suivante:
 
Appel de httpd_cops::Identification
Dans lequel j'appel $self->ServerRoot ($self étant un bless de mon httpd_cops::Identification)
Dans lequel j'aimerais bien faire un find, avec en utilisant la fonction httpd_cops::Identification::ServerRoot::files_owner
 
1: find a pas l'air à aimer, il demande un CODE reference
2: j'ai pas l'air d'être en mesure d'apperler mon httpd_cops::Identification::ServerRoot::files_owner à l'aide de $self
 
merci
 

Code :
  1. ########################################
  2. # Fonction:
  3. # Description: 1. Identification
  4. # Date du dernier changement:
  5. # Utilisé dans:
  6. ########################################
  7. sub httpd_cops::Identification {
  8.   my $self = {};
  9.   bless($self, "httpd_cops::Identification" );
  10.   switch: {
  11.     if ($config->SERVER =~ m/apache/i) {
  12.       ################
  13.       # Web Server ID
  14.       ################
  15.       $self->system_administrator;
  16.       $self->system_privileges;
  17.       $self->ServerRoot;
  18.       $self->DocumentRoot;
  19.       $self->Configuration_files;
  20.       last switch;
  21.     }
  22.     if ($config->server =~ m/domino/i) {
  23.       ################
  24.       # Web Server ID
  25.       ################
  26.       $self->system_administrator;
  27.       $self->system_privileges;
  28.       $self->UserID;
  29.       ################
  30.       last switch;
  31.     }
  32.   }
  33. }
  34. ########################################
  35. # Fonction:
  36. # Description:
  37. # Date du dernier changement:
  38. # Utilisé dans:
  39. ########################################
  40. sub httpd_cops::Identification::ServerRoot {
  41.   my $self = shift;
  42.   ##########
  43.   # Make the ServerRoot and everything under it owned by the webserver administrator group
  44.   find (\$self->files_owner, $httpd_conf->ServerRoot);
  45.   ##########
  46.   ##########
  47.   # Never give read/write access to documents in the ServerRoot to the webserver userid
  48.   find (\$self->webserver_no_readwrite, $httpd_conf->ServerRoot);
  49.   ##########
  50.   ##########
  51.   # ServerRoot should allow the webserver administrator group read/write access
  52.   find (\$self->administrator_readwrite, $httpd_conf->ServerRoot);
  53.   ##########
  54. }
  55. ########################################
  56. # Fonction:
  57. # Description:
  58. # Date du dernier changement:
  59. # Utilisé dans:
  60. ########################################
  61. sub httpd_cops::Identification::ServerRoot::files_owner {
  62.   my $file = Security::File(file => $File::Find::name);
  63.   if (! -l $file->name && $file->group ne $config->WEBSERVER_ADMIN && $file->group ne $config->CONTENT_WEBMASTER) {
  64.     push(@report, "1.1 Make the ServerRoot and everything under it owned by the webserver administrator group." . " " . $file->name);
  65.   }
  66. }

mood
Publicité
Posté le 16-03-2004 à 15:09:52  profilanswer
 

n°675165
burgergold
5$? va chez l'diable!
Posté le 16-03-2004 à 16:15:38  profilanswer
 

j'en déduis que c'est simplement une utilisation non approprié d'un objet
 
code fonctionnel, moins jolie par contre
 

Code :
  1. ########################################
  2. # Fonction:
  3. # Description: 1. Identification
  4. # Date du dernier changement:
  5. # Utilisé dans:
  6. ########################################
  7. sub httpd_cops::Identification {
  8.   switch: {
  9.     if ($config->SERVER =~ m/apache/i) {
  10.       ################
  11.       # Web Server ID
  12.       ################
  13.       httpd_cops::Identification::system_administrator();
  14.       httpd_cops::Identification::system_privileges();
  15.       httpd_cops::Identification::ServerRoot();
  16.       httpd_cops::Identification::DocumentRoot();
  17.       httpd_cops::Identification::Configuration_files();
  18.       last switch;
  19.     }
  20.     if ($config->server =~ m/domino/i) {
  21.       ################
  22.       # Web Server ID
  23.       ################
  24.       httpd_cops::Identification::system_administrator();
  25.       httpd_cops::Identification::system_privileges();
  26.       httpd_cops::Identification::UserID();
  27.       ################
  28.       last switch;
  29.     }
  30.   }
  31. }
  32. ########################################
  33. # Fonction:
  34. # Description:
  35. # Date du dernier changement:
  36. # Utilisé dans:
  37. ########################################
  38. sub httpd_cops::Identification::ServerRoot {
  39.   ##########
  40.   # Make the ServerRoot and everything under it owned by the webserver administrator group
  41.   find (\&httpd_cops::Identification::ServerRoot::files_owner, $httpd_conf->ServerRoot);
  42.   ##########
  43.   ##########
  44.   # Never give read/write access to documents in the ServerRoot to the webserver userid
  45.   find (\&httpd_cops::Identification::ServerRoot::webserver_no_readwrite, $httpd_conf->ServerRoot);
  46.   ##########
  47.   ##########
  48.   # ServerRoot should allow the webserver administrator group read/write access
  49.   find (\&httpd_cops::Identification::ServerRoot::administrator_readwrite, $httpd_conf->ServerRoot);
  50.   ##########
  51. }
  52. ########################################
  53. # Fonction:
  54. # Description:
  55. # Date du dernier changement:
  56. # Utilisé dans:
  57. ########################################
  58. sub httpd_cops::Identification::ServerRoot::files_owner {
  59.   my $file = Security::File(file => $File::Find::name);
  60.   if (! -l $file->name && $file->group ne $config->WEBSERVER_ADMIN && $file->group ne $config->CONTENT_WEBMASTER) {
  61.     push(@report, "1.1 Make the ServerRoot and everything under it owned by the webserver administrator group." . " " . $file->name);
  62.   }
  63. }


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Perl

  [Perl] Fonction find, en plus d'utilisation de simili-objet

 

Sujets relatifs
[perl-cgi] Passage de parametresProblème de design objet
utilisation de htmlentities en PHP/MySQLFonction associée à la croix pour fermer
Script perl qui convertit les fuseaux horairesenvoyer fomulaire par mail avec un objet
Utilisation de Visual Editor (VE) dans EclipseCherche aide sur GD librairie en perl
CVI probleme d'utilisation des API windowsFonction java
Plus de sujets relatifs à : [Perl] Fonction find, en plus d'utilisation de simili-objet


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR