Editing Transfer user accounts from Another FTP Server
From FileZilla Wiki
Jump to navigationJump to searchWarning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 47: | Line 47: | ||
open FICHIER,"< users.ini" or die "File can t be read !"; | open FICHIER,"< users.ini" or die "File can t be read !"; | ||
− | + | ||
− | + | $motiflogin = 'Login='; | |
− | + | $motifpass = 'Pass='; | |
− | + | $motifdir='Dir'; | |
− | + | $motifattr='Attr'; | |
− | + | ||
− | + | $debut='<FileZillaServer> | |
− | + | <Settings> | |
− | + | <Item name="Admin port" type="numeric">14147</Item> | |
− | + | </Settings> | |
− | + | <Groups/> | |
− | + | <Users> | |
− | + | '; | |
− | + | ||
− | + | ||
− | + | $paramdivers = '<Option Name="Group"></Option> | |
− | + | <Option Name="Bypass server userlimit">0</Option> | |
− | + | <Option Name="User Limit">0</Option> | |
− | + | <Option Name="IP Limit">0</Option> | |
− | + | <Option Name="Enabled">1</Option> | |
− | + | <Option Name="Comments"></Option> | |
− | + | <Option Name="ForceSsl">0</Option> | |
− | + | <IpFilter> | |
− | + | <Disallowed /> | |
− | + | <Allowed /> | |
− | + | </IpFilter> | |
− | + | <Permissions>'; | |
− | + | ||
− | + | ||
− | + | $userfin= '</Permissions> | |
− | + | <SpeedLimits DlType="0" DlLimit="10" ServerDlLimitBypass="0" UlType="0" UlLimit="10" ServerUlLimitBypass="0"> | |
− | + | <Download /> | |
− | + | <Upload /> | |
− | + | </SpeedLimits> | |
− | + | </User>'; | |
− | + | ||
− | + | $fin = '</Users> | |
− | + | </FileZillaServer>'; | |
− | + | ||
− | + | $i=0; | |
− | + | $fz=$debut; | |
− | + | while ($ligne = <FICHIER>){ | |
− | + | ||
− | + | if ($ligne =~ /^$motiflogin[\.\w-]*/i) { | |
− | + | @tab=split(/=/,$&); | |
− | + | $fz.= "<User Name=\"".$tab[1]."\">\n"; | |
− | + | $i++; | |
− | + | $h=1; | |
− | + | } | |
− | + | elsif ($ligne =~ /^$motifpass[\w-]*/i) { | |
− | + | @tab=split(/=/,$&); | |
− | + | $fz.= "<Option Name=\"Pass\">".md5_hex($tab[1])."</Option>\n"; | |
− | + | $fz.= $paramdivers."\n"; | |
− | + | } | |
− | + | elsif ($ligne =~ /^$motifdir[\w\ \.\\:=]*/i) { | |
− | + | @tab=split(/=/,$&); | |
− | + | $fz.= "<Permission Dir=\"".$tab[1]."\">\n"; | |
− | + | } | |
− | + | elsif ($ligne =~ /^$motifattr[-\w=]*/i) { | |
− | + | @tab=split(/=/,$&); | |
− | + | @perm=split(//,$tab[1]); | |
− | + | $fz.= copyrights(@perm); | |
− | + | $fz.= '<Option Name="IsHome">'.$h.'</Option>'."\n"; | |
− | + | $fz.= '<Option Name="AutoCreate">0</Option>'."\n".'</Permission>'."\n"; | |
− | + | $h=0; | |
− | + | } | |
− | + | elsif ($ligne =~ /^\n/i) { | |
− | + | $fz.= $userfin."\n"; | |
− | + | } | |
− | + | } | |
− | + | $fz.= $userfin."\n"; | |
− | + | $fz.= $fin; | |
− | + | close FICHIER; | |
open WRITER,"> FileZilla Server.xml" or die "File can't be written !\n"; | open WRITER,"> FileZilla Server.xml" or die "File can't be written !\n"; |