From 2631525040d8d8dac3e996eb56d24b870eeda53a Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Mon, 2 Oct 2006 21:57:55 +0000 Subject: [PATCH] Make sure users has rights to directory on export. --- CASA/gui/ExportSecrets.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CASA/gui/ExportSecrets.cs b/CASA/gui/ExportSecrets.cs index 889e6310..77462ae5 100644 --- a/CASA/gui/ExportSecrets.cs +++ b/CASA/gui/ExportSecrets.cs @@ -92,7 +92,21 @@ namespace Novell.CASA.GUI string sFileName = GetStorageFileName(sHintDir, sHintFile); if (sFileName != null) - { + { + +#if LINUX + // make sure user has 'Write' rights to this directory + string sDir = sFileName.Substring(0, sFileName.LastIndexOf("/")); + int rcode = Mono.Unix.Native.Syscall.access(sDir, + Mono.Unix.Native.AccessModes.R_OK | + Mono.Unix.Native.AccessModes.W_OK ); + if (rcode != 0) + { + CommonGUI.DisplayMessage(Gtk.MessageType.Error, "You do not have rights to export your files here.\r\n"+sDir); + return; + } +#endif + //Store off this location for next export int iLastSlash = sFileName.LastIndexOf("/");