diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-25 21:47:16 +0200 |
commit | 0a266bd33b8786869cdeab8325f8f1b1900533ad (patch) | |
tree | 137ba378aaae9e8f0765fabbbf5035131f250781 /shell/source | |
parent | 6a1e797fa4b432841708545272e13e8f6ab4bd39 (diff) | |
parent | ab33e14647ada2a32624fa39ec0ddbbbdc694df5 (diff) |
merge commit
Diffstat (limited to 'shell/source')
-rw-r--r-- | shell/source/aqua/sysshell/makefile.mk | 1 | ||||
-rw-r--r-- | shell/source/aqua/sysshell/systemshell.cxx | 36 | ||||
-rw-r--r-- | shell/source/backends/macbe/makefile.mk | 3 | ||||
-rw-r--r-- | shell/source/unix/exec/shellexec.cxx | 21 | ||||
-rw-r--r-- | shell/source/unix/misc/open-url.c | 40 | ||||
-rw-r--r-- | shell/source/unix/misc/senddoc.c | 40 |
6 files changed, 83 insertions, 58 deletions
diff --git a/shell/source/aqua/sysshell/makefile.mk b/shell/source/aqua/sysshell/makefile.mk index a748e00c154e..b3cf3abdec36 100644 --- a/shell/source/aqua/sysshell/makefile.mk +++ b/shell/source/aqua/sysshell/makefile.mk @@ -40,7 +40,6 @@ ENABLE_EXCEPTIONS=TRUE .INCLUDE : settings.mk -OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) # --- Files -------------------------------------------------------- diff --git a/shell/source/aqua/sysshell/systemshell.cxx b/shell/source/aqua/sysshell/systemshell.cxx index a9b4afe1a966..a9535c849f77 100644 --- a/shell/source/aqua/sysshell/systemshell.cxx +++ b/shell/source/aqua/sysshell/systemshell.cxx @@ -71,17 +71,49 @@ static rtl::OUString translateToExternalUrl(const rtl::OUString& internalUrl) return extUrl; } +// #i104525# many versions of OSX have problems with some URLs: +// when an app requests OSX to add one of these URLs to the "Recent Items" list +// then this app gets killed (TextEdit, Preview, etc. and also OOo) +static bool isDangerousUrl( const rtl::OUString& rUrl) +{ + // use a heuristic that detects all known cases since there is no official comment + // on the exact impact and root cause of the OSX bug + const int nLen = rUrl.getLength(); + const sal_Unicode* p = rUrl.getStr(); + for( int i = 0; i < nLen-3; ++i, ++p) { + if( p[0] != '%') + continue; + // escaped percent? + if( (p[1] == '2') && (p[2] == '5')) + return true; + // escapes are considered to be UTF-8 encoded + // => check for invalid UTF-8 leading byte + if( (p[1] != 'f') && (p[1] != 'F')) + continue; + int cLowNibble = p[2]; + if( (cLowNibble >= '0') && (cLowNibble <= '9')) + return false; + if( cLowNibble >= 'a') + cLowNibble -= 'a' - 'A'; + if( (cLowNibble < 'A') || (cLowNibble >= 'C')) + return true; + } + + return false; +} + namespace SystemShell { //############################## - void AddToRecentDocumentList(const rtl::OUString& aFileUrl, const rtl::OUString& aMimeType) + void AddToRecentDocumentList(const rtl::OUString& aFileUrl, const rtl::OUString& /*aMimeType*/) { // Convert file URL for external use (see above) rtl::OUString externalUrl = translateToExternalUrl(aFileUrl); if( 0 == externalUrl.getLength() ) externalUrl = aFileUrl; - if( externalUrl.getLength() ) + if( externalUrl.getLength() + && !isDangerousUrl( externalUrl)) { NSString* pString = [[NSString alloc] initWithCharacters: externalUrl.getStr() length: externalUrl.getLength()]; NSURL* pURL = [NSURL URLWithString: pString]; diff --git a/shell/source/backends/macbe/makefile.mk b/shell/source/backends/macbe/makefile.mk index dd2b166ce1ce..c8f6891d6f87 100644 --- a/shell/source/backends/macbe/makefile.mk +++ b/shell/source/backends/macbe/makefile.mk @@ -50,11 +50,10 @@ DLLPRE = .IF "$(OS)" != "MACOSX" dummy: - @echo "Nothing to build for OS $(OS)." + @echo "Nothing to build for OS $(OS)." .ELSE -OBJCXXFLAGS=-x objective-c++ -fobjc-exceptions CFLAGSCXX+=$(OBJCXXFLAGS) SLOFILES= \ diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 315f78c517ff..4ee0f32eb072 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -97,12 +97,10 @@ void escapeForShell( rtl::OStringBuffer & rBuffer, const rtl::OString & rURL) { // escape every non alpha numeric characters (excluding a few "known good") by prepending a '\' sal_Char c = rURL[n]; - if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) -#ifdef OS2 // YD we don't need to escape ':', '-', '\\', '_' - && c != ':' && c != '-' && c != '\\' && c != '_' -#endif - && c != '/' && c != '.' ) +#ifndef OS2 // YD shell does not support escaped chars + if( ( c < 'A' || c > 'Z' ) && ( c < 'a' || c > 'z' ) && ( c < '0' || c > '9' ) && c != '/' && c != '.' ) rBuffer.append( '\\' ); +#endif rBuffer.append( c ); } @@ -210,6 +208,19 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar static_cast < XSystemShellExecute * > (this), ENOENT ); } +#ifdef OS2 + OStringBuffer aProg = OUStringToOString(aProgram, osl_getThreadTextEncoding()); + aProg.append("open-url.exe"); + OString aUrl = OUStringToOString(aURL, osl_getThreadTextEncoding()); + if ( -1 == spawnl(P_NOWAIT, aProg.getStr(), aProg.getStr(), aUrl.getStr() , NULL) ) + { + int nerr = errno; + throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ), + static_cast < XSystemShellExecute * > (this), nerr ); + } + return; +#endif + OString aTmp = OUStringToOString(aProgram, osl_getThreadTextEncoding()); escapeForShell(aBuffer, aTmp); diff --git a/shell/source/unix/misc/open-url.c b/shell/source/unix/misc/open-url.c index 00a2e3bff774..f8e76f26ec5d 100644 --- a/shell/source/unix/misc/open-url.c +++ b/shell/source/unix/misc/open-url.c @@ -1,35 +1,27 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile:$ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision:$ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author:$ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. * ************************************************************************/ diff --git a/shell/source/unix/misc/senddoc.c b/shell/source/unix/misc/senddoc.c index e918ba69c86d..bbe96420699d 100644 --- a/shell/source/unix/misc/senddoc.c +++ b/shell/source/unix/misc/senddoc.c @@ -1,35 +1,27 @@ /************************************************************************* * - * OpenOffice.org - a multi-platform office productivity suite + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * $RCSfile:$ + * Copyright 2008 by Sun Microsystems, Inc. * - * $Revision:$ + * OpenOffice.org - a multi-platform office productivity suite * - * last change: $Author:$ + * This file is part of OpenOffice.org. * - * The Contents of this file are made available subject to - * the terms of GNU Lesser General Public License Version 2.1. + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2005 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. * ************************************************************************/ |