From: Kai Blin Date: Fri, 8 Jul 2011 13:04:12 +0000 (+0200) Subject: s3 swat: Add XSRF protection to globals page X-Git-Tag: samba-3.5.10~6 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;ds=sidebyside;h=9482f46dd0e961145345bd2cdbb01fa35ec9f048;p=samba.git s3 swat: Add XSRF protection to globals page Signed-off-by: Kai Blin --- diff --git a/source3/web/swat.c b/source3/web/swat.c index b46aa261ec2..e204a3b5a4f 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -921,9 +921,14 @@ static void globals_page(void) { unsigned int parm_filter = FLAG_BASIC; int mode = 0; + const char form_name[] = "globals"; printf("

%s

\n", _("Global Parameters")); + if (!verify_xsrf_token(form_name)) { + goto output_page; + } + if (cgi_variable("Commit")) { commit_parameters(GLOBAL_SECTION_SNUM); save_reload(-1); @@ -936,7 +941,9 @@ static void globals_page(void) if ( cgi_variable("AdvMode")) mode = 1; +output_page: printf("
\n"); + print_xsrf_token(cgi_user_name(), cgi_user_pass(), form_name); ViewModeBoxes( mode ); switch ( mode ) {