Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 369599 | Differences between
and this patch

Collapse All | Expand All

(-)blender-2.60a.orig/source/blender/blenkernel/intern/blender.c (+1 lines)
Lines 145-150 void initglobals(void) Link Here
145
	G.f |= G_SCRIPT_AUTOEXEC;
145
	G.f |= G_SCRIPT_AUTOEXEC;
146
#else
146
#else
147
	G.f &= ~G_SCRIPT_AUTOEXEC;
147
	G.f &= ~G_SCRIPT_AUTOEXEC;
148
	G.f |= G_SCRIPT_OVERRIDE_PREF;  /* Disables turning G_SCRIPT_AUTOEXEC on from user prefs */
148
#endif
149
#endif
149
}
150
}
150
151
(-)blender-2.60a.orig/source/blender/makesrna/intern/rna_userdef.c (-3 / +13 lines)
Lines 116-124 static void rna_userdef_show_manipulator Link Here
116
116
117
static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
117
static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
118
{
118
{
119
	UserDef *userdef = (UserDef*)ptr->data;
119
	if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
120
	if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE)	G.f &= ~G_SCRIPT_AUTOEXEC;
120
		/* Blender run with --enable-autoexec */
121
	else												G.f |=  G_SCRIPT_AUTOEXEC;
121
		UserDef *userdef = (UserDef*)ptr->data;
122
		if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE)	G.f &= ~G_SCRIPT_AUTOEXEC;
123
		else												G.f |=  G_SCRIPT_AUTOEXEC;
124
	}
125
}
126
127
static int rna_userdef_script_autoexec_editable(Main *bmain, Scene *scene, PointerRNA *ptr) {
128
	/* Disable "Auto Run Python Scripts" checkbox unless Blender run with --enable-autoexec */
129
	return !(G.f & G_SCRIPT_OVERRIDE_PREF);
122
}
130
}
123
131
124
static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr)
132
static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr)
Lines 2630-2635 static void rna_def_userdef_system(Blend Link Here
2630
	                         "Allow any .blend file to run scripts automatically "
2638
	                         "Allow any .blend file to run scripts automatically "
2631
	                         "(unsafe with blend files from an untrusted source)");
2639
	                         "(unsafe with blend files from an untrusted source)");
2632
	RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
2640
	RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
2641
	/* Disable "Auto Run Python Scripts" checkbox unless Blender run with --enable-autoexec */
2642
	RNA_def_property_editable_func(prop, "rna_userdef_script_autoexec_editable");
2633
2643
2634
	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
2644
	prop= RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
2635
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
2645
	RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
(-)blender-2.60a.orig/source/blender/windowmanager/intern/wm_files.c (-1 / +6 lines)
Lines 285-296 static void wm_init_userdef(bContext *C) Link Here
285
285
286
	/* set the python auto-execute setting from user prefs */
286
	/* set the python auto-execute setting from user prefs */
287
	/* enabled by default, unless explicitly enabled in the command line which overrides */
287
	/* enabled by default, unless explicitly enabled in the command line which overrides */
288
	if((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
288
	if (! G.background && ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0)) {
289
		/* Blender run with --enable-autoexec */
289
		if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |=  G_SCRIPT_AUTOEXEC;
290
		if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |=  G_SCRIPT_AUTOEXEC;
290
		else											  G.f &= ~G_SCRIPT_AUTOEXEC;
291
		else											  G.f &= ~G_SCRIPT_AUTOEXEC;
291
	}
292
	}
292
	/* update tempdir from user preferences */
293
	/* update tempdir from user preferences */
293
	BLI_where_is_temp(btempdir, FILE_MAX, 1);
294
	BLI_where_is_temp(btempdir, FILE_MAX, 1);
295
296
	/* Workaround to fix default of "Auto Run Python Scripts" checkbox */
297
	if ((G.f & G_SCRIPT_OVERRIDE_PREF) && !(G.f & G_SCRIPT_AUTOEXEC))
298
		U.flag |= USER_SCRIPT_AUTOEXEC_DISABLE;
294
}
299
}
295
300
296
301
(-)blender-2.60a.orig/source/blender/windowmanager/intern/wm_operators.c (-4 / +12 lines)
Lines 1583-1594 static int wm_open_mainfile_exec(bContex Link Here
1583
		G.fileflags &= ~G_FILE_NO_UI;
1583
		G.fileflags &= ~G_FILE_NO_UI;
1584
	else
1584
	else
1585
		G.fileflags |= G_FILE_NO_UI;
1585
		G.fileflags |= G_FILE_NO_UI;
1586
		
1586
1587
	if(RNA_boolean_get(op->ptr, "use_scripts"))
1587
	/* Restrict "Trusted Source" mode to Blender in --enable-autoexec mode */
1588
	if(RNA_boolean_get(op->ptr, "use_scripts") && (!(G.f & G_SCRIPT_OVERRIDE_PREF)))
1588
		G.f |= G_SCRIPT_AUTOEXEC;
1589
		G.f |= G_SCRIPT_AUTOEXEC;
1589
	else
1590
	else
1590
		G.f &= ~G_SCRIPT_AUTOEXEC;
1591
		G.f &= ~G_SCRIPT_AUTOEXEC;
1591
	
1592
1592
	// XXX wm in context is not set correctly after WM_read_file -> crash
1593
	// XXX wm in context is not set correctly after WM_read_file -> crash
1593
	// do it before for now, but is this correct with multiple windows?
1594
	// do it before for now, but is this correct with multiple windows?
1594
	WM_event_add_notifier(C, NC_WINDOW, NULL);
1595
	WM_event_add_notifier(C, NC_WINDOW, NULL);
Lines 1600-1605 static int wm_open_mainfile_exec(bContex Link Here
1600
1601
1601
static void WM_OT_open_mainfile(wmOperatorType *ot)
1602
static void WM_OT_open_mainfile(wmOperatorType *ot)
1602
{
1603
{
1604
	PropertyRNA * use_scripts_checkbox = NULL;
1605
1603
	ot->name= "Open Blender File";
1606
	ot->name= "Open Blender File";
1604
	ot->idname= "WM_OT_open_mainfile";
1607
	ot->idname= "WM_OT_open_mainfile";
1605
	ot->description="Open a Blender file";
1608
	ot->description="Open a Blender file";
Lines 1611-1617 static void WM_OT_open_mainfile(wmOperat Link Here
1611
	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH);
1614
	WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH);
1612
1615
1613
	RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
1616
	RNA_def_boolean(ot->srna, "load_ui", 1, "Load UI", "Load user interface setup in the .blend file");
1614
	RNA_def_boolean(ot->srna, "use_scripts", 1, "Trusted Source", "Allow blend file execute scripts automatically, default available from system preferences");
1617
	use_scripts_checkbox = RNA_def_boolean(ot->srna, "use_scripts",
1618
			!!(G.f & G_SCRIPT_AUTOEXEC), "Trusted Source",
1619
			"Allow blend file execute scripts automatically, default available from system preferences");
1620
	/* Disable "Trusted Source" checkbox unless Blender run with --enable-autoexec */
1621
	if (use_scripts_checkbox && (G.f & G_SCRIPT_OVERRIDE_PREF))
1622
		RNA_def_property_clear_flag(use_scripts_checkbox, PROP_EDITABLE);
1615
}
1623
}
1616
1624
1617
/* **************** link/append *************** */
1625
/* **************** link/append *************** */
(-)blender-2.60a.orig/source/creator/creator.c (-4 / +6 lines)
Lines 258-263 static int print_help(int UNUSED(argc), Link Here
258
258
259
	printf("\n");
259
	printf("\n");
260
260
261
	BLI_argsPrintArgDoc(ba, "-666");
261
	BLI_argsPrintArgDoc(ba, "--enable-autoexec");
262
	BLI_argsPrintArgDoc(ba, "--enable-autoexec");
262
	BLI_argsPrintArgDoc(ba, "--disable-autoexec");
263
	BLI_argsPrintArgDoc(ba, "--disable-autoexec");
263
264
Lines 326-339 static int end_arguments(int UNUSED(argc Link Here
326
static int enable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
327
static int enable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
327
{
328
{
328
	G.f |= G_SCRIPT_AUTOEXEC;
329
	G.f |= G_SCRIPT_AUTOEXEC;
329
	G.f |= G_SCRIPT_OVERRIDE_PREF;
330
	G.f &= ~G_SCRIPT_OVERRIDE_PREF;  /* Enables turning G_SCRIPT_AUTOEXEC off from user prefs */
330
	return 0;
331
	return 0;
331
}
332
}
332
333
333
static int disable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
334
static int disable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
334
{
335
{
335
	G.f &= ~G_SCRIPT_AUTOEXEC;
336
	G.f &= ~G_SCRIPT_AUTOEXEC;
336
	G.f |= G_SCRIPT_OVERRIDE_PREF;
337
	G.f |= G_SCRIPT_OVERRIDE_PREF;  /* Disables turning G_SCRIPT_AUTOEXEC on from user prefs */
337
	return 0;
338
	return 0;
338
}
339
}
339
340
Lines 1055-1062 static void setupArguments(bContext *C, Link Here
1055
#  define 	PY_DISABLE_AUTO ", (compiled as non-standard default)"
1056
#  define 	PY_DISABLE_AUTO ", (compiled as non-standard default)"
1056
#endif
1057
#endif
1057
1058
1058
	BLI_argsAdd(ba, 1, "-y", "--enable-autoexec", "\n\tEnable automatic python script execution" PY_ENABLE_AUTO, enable_python, NULL);
1059
	BLI_argsAdd(ba, 1, NULL, "-666", "\n\tEnable automatic python script execution (port from CVE-2009-3850 patch to Blender 2.60a)" PY_ENABLE_AUTO, enable_python, NULL);
1059
	BLI_argsAdd(ba, 1, "-Y", "--disable-autoexec", "\n\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)" PY_DISABLE_AUTO, disable_python, NULL);
1060
	BLI_argsAdd(ba, 1, "-y", "--enable-autoexec", "\n\tEnable automatic python script execution" PY_ENABLE_AUTO, enable_python, NULL);
1061
	BLI_argsAdd(ba, 1, "-Y", "--disable-autoexec", "\n\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)" PY_DISABLE_AUTO, disable_python, NULL);
1060
1062
1061
#undef PY_ENABLE_AUTO
1063
#undef PY_ENABLE_AUTO
1062
#undef PY_DISABLE_AUTO
1064
#undef PY_DISABLE_AUTO

Return to bug 369599