アットウィキロゴ

vsftpd_1.2.1_prelogin.c_handle_user_command

source

prelogin.c

line

123 - 166

概要


static void handle_user_command(struct vsf_session* p_sess)

処理の流れ


    123 static void
   124 handle_user_command(struct vsf_session* p_sess)
   125 {
   126   /* SECURITY: If we're in anonymous only-mode, immediately reject
   127    * non-anonymous usernames in the hope we save passwords going plaintext
   128    * over the network
   129    */
   130   int is_anon = 1;
   131   str_copy(&p_sess->user_str, &p_sess->ftp_arg_str);
   132   str_upper(&p_sess->ftp_arg_str);
   133   if (!str_equal_text(&p_sess->ftp_arg_str, "FTP") &&
   134       !str_equal_text(&p_sess->ftp_arg_str, "ANONYMOUS"))
   135   {
   136     is_anon = 0;
   137   }
   138   if (!tunable_local_enable && !is_anon)
   139   {
   140     vsf_cmdio_write(p_sess, FTP_LOGINERR,
   141                     "This FTP server is anonymous only.");
   142     str_empty(&p_sess->user_str);
   143     return;
   144   }
   145   if (!str_isempty(&p_sess->userlist_str))
   146   {
   147     int located = str_contains_line(&p_sess->userlist_str, &p_sess->user_str);
   148     if ((located && tunable_userlist_deny) ||
   149         (!located && !tunable_userlist_deny))
   150     {
   151       vsf_cmdio_write(p_sess, FTP_LOGINERR, "Permission denied.");
   152       str_empty(&p_sess->user_str);
   153       return;
   154     }
   155   }
   156   if (is_anon && tunable_no_anon_password)
   157   {
   158     /* Fake a password */
   159     str_alloc_text(&p_sess->ftp_arg_str, "<no password>");
   160     handle_pass_command(p_sess);
   161   }
   162   else
   163   {
   164     vsf_cmdio_write(p_sess, FTP_GIVEPWORD, "Please specify the password.");
   165   }
   166 }

function


   123 static void
   124 handle_user_command(struct vsf_session* p_sess)
   125 {
   126   /* SECURITY: If we're in anonymous only-mode, immediately reject
   127    * non-anonymous usernames in the hope we save passwords going plaintext
   128    * over the network
   129    */
   130   int is_anon = 1;
   131   str_copy(&p_sess->user_str, &p_sess->ftp_arg_str);
   132   str_upper(&p_sess->ftp_arg_str);
   133   if (!str_equal_text(&p_sess->ftp_arg_str, "FTP") &&
   134       !str_equal_text(&p_sess->ftp_arg_str, "ANONYMOUS"))
   135   {
   136     is_anon = 0;
   137   }
   138   if (!tunable_local_enable && !is_anon)
   139   {
   140     vsf_cmdio_write(p_sess, FTP_LOGINERR,
   141                     "This FTP server is anonymous only.");
   142     str_empty(&p_sess->user_str);
   143     return;
   144   }
   145   if (!str_isempty(&p_sess->userlist_str))
   146   {
   147     int located = str_contains_line(&p_sess->userlist_str, &p_sess->user_str);
   148     if ((located && tunable_userlist_deny) ||
   149         (!located && !tunable_userlist_deny))
   150     {
   151       vsf_cmdio_write(p_sess, FTP_LOGINERR, "Permission denied.");
   152       str_empty(&p_sess->user_str);
   153       return;
   154     }
   155   }
   156   if (is_anon && tunable_no_anon_password)
   157   {
   158     /* Fake a password */
   159     str_alloc_text(&p_sess->ftp_arg_str, "<no password>");
   160     handle_pass_command(p_sess);
   161   }
   162   else
   163   {
   164     vsf_cmdio_write(p_sess, FTP_GIVEPWORD, "Please specify the password.");
   165   }
   166 }
最終更新:2009年03月01日 16:31
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。