Compare commits

...

20 Commits

Author SHA1 Message Date
Frank Karlitschek 526e704c9f 4.0.7
and remove some ^M while at it
2012-08-14 20:07:58 +02:00
Lukas Reschke 4682846d3e Disable user enumeration 2012-08-14 17:19:20 +02:00
Michael Gapczynski 95ef80e6db Check blacklist when renaming files 2012-08-13 01:29:32 +02:00
Lukas Reschke 4fd069b479 Also check some other files 2012-08-13 01:26:28 +02:00
Lukas Reschke 2024d424cd Disable listing of all users 2012-08-13 01:22:53 +02:00
Jakob Sack 6d94455540 Fix OC_Connector_Sabre_Locks for SQLite 2012-08-12 09:06:46 +02:00
Lukas Reschke 2871896d54 Check if webfinger is enabled 2012-08-10 16:38:32 +02:00
Michael Gapczynski e9a63900de Don't return file handle if the mode supports writing and the file is not writable
Conflicts:
	apps/files_sharing/sharedstorage.php
2012-08-10 09:46:44 -04:00
Lukas Reschke baab13ae13 Validate cookie to prevent auth bypasses. 2012-08-10 15:23:04 +02:00
Lukas Reschke 5192eecce2 Added XSRF check 2012-08-10 00:11:04 +02:00
Lukas Reschke 7581d55428 Missed an "echo" 2012-08-09 22:17:52 +02:00
Lukas Reschke aae17d4ae8 Sanitize user input 2012-08-09 22:14:48 +02:00
Thomas Tanghus a366ba4c0c Fix for broken Mail App in OSX Mountain Lion. https://mail.kde.org/pipermail/owncloud/2012-August/004649.html 2012-08-09 17:22:56 +02:00
Bjoern Schiessle 2cfc7f7454 fix for bug 879 - add parent directory to file cache if it does not exist yet.
For example this can happen if the sync client is used before the user created the root directory (e.g. through web login).
2012-08-08 11:47:23 +02:00
Arthur Schiwon e9e84b5c3b Merge branch 'stable4' of git://gitorious.org/owncloud/owncloud into stable4 2012-08-05 21:17:39 +02:00
Georg Ehrke c32a99b14c fix label for versioning in admin settings 2012-08-04 18:50:05 +02:00
Bart Visscher 758ae42df0 Calendar: remove double html encoding 2012-08-03 16:26:05 +02:00
Bart Visscher 0970a3c60e Contacts: Fix no active Addressbooks 2012-08-03 16:11:10 +02:00
Arthur Schiwon 6b78ca1a5a LDAP: sanitize base, user and group trees. fixes oc-1302 2012-08-03 15:51:25 +02:00
Arthur Schiwon e899c9989e Show Login-Button when user+pw are autocompleted, fixes oc-1068 2012-08-03 13:16:25 +02:00
20 changed files with 116 additions and 52 deletions
+3
View File
@@ -153,6 +153,9 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
// Taking out \r to not screw up the xml output
$returnedProperties[200][$addressDataProp] = str_replace("\r","", $val);
// The stripping of \r breaks the Mail App in OSX Mountain Lion
// this is fixed in master, but not backported. /Tanghus
$returnedProperties[200][$addressDataProp] = $val;
}
}
+11 -4
View File
@@ -21,10 +21,17 @@ $principalBackend = new OC_Connector_Sabre_Principal();
$caldavBackend = new OC_Connector_Sabre_CalDAV();
// Root nodes
$nodes = array(
new Sabre_CalDAV_Principal_Collection($principalBackend),
new Sabre_CalDAV_CalendarRootNode($principalBackend, $caldavBackend),
);
$Sabre_CalDAV_Principal_Collection = new Sabre_CalDAV_Principal_Collection($principalBackend);
$Sabre_CalDAV_Principal_Collection->disableListing = true; // Disable listening
$Sabre_CalDAV_CalendarRootNode = new Sabre_CalDAV_CalendarRootNode($principalBackend, $caldavBackend);
$Sabre_CalDAV_CalendarRootNode->disableListing = true; // Disable listening
$nodes = array(
$Sabre_CalDAV_Principal_Collection,
$Sabre_CalDAV_CalendarRootNode,
);
// Fire up server
$server = new Sabre_DAV_Server($nodes);
+2 -2
View File
@@ -383,8 +383,8 @@ class OC_Calendar_App{
$lastmodified = ($last_modified)?$last_modified->getDateTime()->format('U'):0;
$output = array('id'=>(int)$event['id'],
'title' => htmlspecialchars(($event['summary']!=NULL || $event['summary'] != '')?$event['summary']: self::$l10n->t('unnamed')),
'description' => isset($vevent->DESCRIPTION)?htmlspecialchars($vevent->DESCRIPTION->value):'',
'title' => ($event['summary']!=NULL || $event['summary'] != '')?$event['summary']: self::$l10n->t('unnamed'),
'description' => isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'',
'lastmodified'=>$lastmodified);
$dtstart = $vevent->DTSTART;
+10 -4
View File
@@ -36,10 +36,16 @@ $principalBackend = new OC_Connector_Sabre_Principal();
$carddavBackend = new OC_Connector_Sabre_CardDAV();
// Root nodes
$nodes = array(
new Sabre_CalDAV_Principal_Collection($principalBackend),
new Sabre_CardDAV_AddressBookRoot($principalBackend, $carddavBackend),
);
$Sabre_CalDAV_Principal_Collection = new Sabre_CalDAV_Principal_Collection($principalBackend);
$Sabre_CalDAV_Principal_Collection->disableListing = true; // Disable listening
$Sabre_CardDAV_AddressBookRoot = new Sabre_CardDAV_AddressBookRoot($principalBackend, $carddavBackend);
$Sabre_CardDAV_AddressBookRoot->disableListing = true; // Disable listening
$nodes = array(
$Sabre_CalDAV_Principal_Collection,
$Sabre_CardDAV_AddressBookRoot,
);
// Fire up server
$server = new Sabre_DAV_Server($nodes);
+1
View File
@@ -219,6 +219,7 @@ class OC_Contacts_Addressbook{
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OCP\Util::DEBUG);
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook:active, ids: '.join(',', $active),OCP\Util::DEBUG);
OCP\Util::writeLog('contacts','OC_Contacts_Addressbook::active, SQL:'.$prep,OCP\Util::DEBUG);
return array();
}
return $addressbooks;
+19
View File
@@ -416,6 +416,25 @@ class OC_Filestorage_Shared extends OC_Filestorage {
public function fopen($path, $mode) {
$source = $this->getSource($path);
if ($source) {
switch ($mode) {
case 'r+':
case 'rb+':
case 'w+':
case 'wb+':
case 'x+':
case 'xb+':
case 'a+':
case 'ab+':
case 'w':
case 'wb':
case 'x':
case 'xb':
case 'a':
case 'ab':
if (!$this->is_writable($path)) {
return false;
}
}
$storage = OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode);
}
+1 -1
View File
@@ -1,4 +1,4 @@
<form id="versions">
<form id="versionssettings">
<fieldset class="personalblock">
<input type="checkbox" name="versions" id="versions" value="1" <?php if (OCP\Config::getSystemValue('versions', 'true')=='true') echo ' checked="checked"'; ?> /> <label for="versions"><?php echo $l->t('Enable Files Versioning'); ?></label> <br/>
</fieldset>
+1 -1
View File
@@ -37,7 +37,7 @@ OCP\App::checkAppEnabled('gallery');
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="js/sharing.js" type="text/javascript"></script>
<script>
var TOKEN = '<?php echo $_GET['token']; ?>';
var TOKEN = '<?php echo htmlentities($_GET['token']); ?>';
</script>
</head>
<body>
+3 -3
View File
@@ -666,9 +666,9 @@ class OC_LDAP {
self::$ldapPort = OCP\Config::getAppValue('user_ldap', 'ldap_port', 389);
self::$ldapAgentName = OCP\Config::getAppValue('user_ldap', 'ldap_dn','');
self::$ldapAgentPassword = base64_decode(OCP\Config::getAppValue('user_ldap', 'ldap_agent_password',''));
self::$ldapBase = OCP\Config::getAppValue('user_ldap', 'ldap_base', '');
self::$ldapBaseUsers = OCP\Config::getAppValue('user_ldap', 'ldap_base_users',self::$ldapBase);
self::$ldapBaseGroups = OCP\Config::getAppValue('user_ldap', 'ldap_base_groups', self::$ldapBase);
self::$ldapBase = self::sanitizeDN(OCP\Config::getAppValue('user_ldap', 'ldap_base', ''));
self::$ldapBaseUsers = self::sanitizeDN(OCP\Config::getAppValue('user_ldap', 'ldap_base_users',self::$ldapBase));
self::$ldapBaseGroups = self::sanitizeDN(OCP\Config::getAppValue('user_ldap', 'ldap_base_groups', self::$ldapBase));
self::$ldapTLS = OCP\Config::getAppValue('user_ldap', 'ldap_tls',0);
self::$ldapNoCase = OCP\Config::getAppValue('user_ldap', 'ldap_nocase', 0);
self::$ldapUserDisplayName = strtolower(OCP\Config::getAppValue('user_ldap', 'ldap_display_name', 'uid'));
+4
View File
@@ -1,4 +1,8 @@
<?php
if (!OCP\App::isEnabled("user_webfinger")) {
return;
}
$hostMetaHeader = array(
'Access-Control-Allow-Origin' => '*',
'Content-Type' => 'application/xrd+json'
+5 -1
View File
@@ -1,4 +1,8 @@
<?php
if (!OCP\App::isEnabled("user_webfinger")) {
return;
}
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/xrd+json");
@@ -15,7 +19,7 @@ header("Content-Type: application/xrd+json");
* href="<?php echo WF_BASEURL; ?>/apps/myApp/profile.php?user=<?php echo WF_USER; ?>">
* </Link>
*
'* but can also use complex database queries to generate the webfinger result
* but can also use complex database queries to generate the webfinger result
**/
// calculate the documentroot
// modified version of the one in lib/base.php that takes the .well-known symlink into account
+1
View File
@@ -7,6 +7,7 @@
require_once ("../../lib/base.php");
OC_Util::checkAdminUser();
OCP\JSON::callCheck();
$action=isset($_POST['action'])?$_POST['action']:$_GET['action'];
$result=false;
+5 -6
View File
@@ -402,11 +402,7 @@ $(document).ready(function(){
//use infield labels
$("label.infield").inFieldLabels();
// hide log in button etc. when form fields not filled
$('#submit').hide();
$('#remember_login').hide();
$('#remember_login+label').hide();
$('input#user, input#password').keyup(function() {
checkShowCredentials = function() {
var empty = false;
$('input#user, input#password').each(function() {
if ($(this).val() == '') {
@@ -422,7 +418,10 @@ $(document).ready(function(){
$('#remember_login').show();
$('#remember_login+label').fadeIn();
}
});
}
// hide log in button etc. when form fields not filled
checkShowCredentials();
$('input#user, input#password').keyup(checkShowCredentials);
$('#settings #expand').keydown(function(event) {
if (event.which == 13 || event.which == 32) {
+1 -1
View File
@@ -77,7 +77,7 @@ elseif(OC_User::isLoggedIn()) {
}
// confirm credentials in cookie
if(isset($_COOKIE['oc_token']) && OC_User::userExists($_COOKIE['oc_username']) &&
OC_Preferences::getValue($_COOKIE['oc_username'], "login", "token") == $_COOKIE['oc_token']) {
OC_Preferences::getValue($_COOKIE['oc_username'], "login", "token") === $_COOKIE['oc_token']) {
OC_User::setUserId($_COOKIE['oc_username']);
OC_Util::redirectToDefaultPage();
}
+1
View File
@@ -434,6 +434,7 @@ class OC{
// Check for blacklisted files
OC_Hook::connect('OC_Filesystem','write','OC_Filesystem','isBlacklisted');
OC_Hook::connect('OC_Filesystem', 'rename', 'OC_Filesystem', 'isBlacklisted');
//make sure temporary files are cleaned up
register_shutdown_function(array('OC_Helper','cleanTmp'));
+4 -2
View File
@@ -41,8 +41,10 @@ class OC_Connector_Sabre_Locks extends Sabre_DAV_Locks_Backend_Abstract {
// NOTE: the following 10 lines or so could be easily replaced by
// pure sql. MySQL's non-standard string concatination prevents us
// from doing this though.
$query = 'SELECT * FROM *PREFIX*locks WHERE userid = ? AND (created + timeout) > ? AND ((uri = ?)';
$params = array(OC_User::getUser(),time(),$uri);
// Fix: sqlite does not insert time() as a number but as text, making
// the equation returning false all the time
$query = 'SELECT * FROM *PREFIX*locks WHERE userid = ? AND (created + timeout) > '.time().' AND ((uri = ?)';
$params = array(OC_User::getUser(),$uri);
// We need to check locks for every part in the uri.
$uriParts = explode('/',$uri);
+18 -9
View File
@@ -84,19 +84,28 @@ class OC_FileCache{
if($root=='/'){
$root='';
}
$path=$root.$path;
$parent=self::getParentId($path);
$id=self::getFileId($path);
if(isset(OC_FileCache::$savedData[$path])){
$data=array_merge(OC_FileCache::$savedData[$path],$data);
unset(OC_FileCache::$savedData[$path]);
$fullpath=$root.$path;
$parent=self::getParentId($fullpath);
$id=self::getFileId($fullpath);
if(isset(OC_FileCache::$savedData[$fullpath])){
$data=array_merge(OC_FileCache::$savedData[$fullpath],$data);
unset(OC_FileCache::$savedData[$fullpath]);
}
// add parent directory to the file cache if it does not exist yet.
if ($parent == -1 && $fullpath != $root) {
$parentDir = substr(dirname($path), 0, strrpos(dirname($path), DIRECTORY_SEPARATOR));
self::scanFile($parentDir);
$parent = self::getParentId($fullpath);
}
if($id!=-1){
self::update($id,$data);
return;
}
if(!isset($data['size']) or !isset($data['mtime'])){//save incomplete data for the next time we write it
self::$savedData[$path]=$data;
self::$savedData[$fullpath]=$data;
return;
}
if(!isset($data['encrypted'])){
@@ -113,9 +122,9 @@ class OC_FileCache{
$data['versioned']=(int)$data['versioned'];
$user=OC_User::getUser();
$query=OC_DB::prepare('INSERT INTO *PREFIX*fscache(parent, name, path, path_hash, size, mtime, ctime, mimetype, mimepart,`user`,writable,encrypted,versioned) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)');
$result=$query->execute(array($parent,basename($path),$path,md5($path),$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned']));
$result=$query->execute(array($parent,basename($fullpath),$fullpath,md5($fullpath),$data['size'],$data['mtime'],$data['ctime'],$data['mimetype'],$mimePart,$user,$data['writable'],$data['encrypted'],$data['versioned']));
if(OC_DB::isError($result)){
OC_Log::write('files','error while writing file('.$path.') to cache',OC_Log::ERROR);
OC_Log::write('files','error while writing file('.$fullpath.') to cache',OC_Log::ERROR);
}
}
+11 -3
View File
@@ -372,13 +372,21 @@ class OC_Filesystem{
/**
* checks if a file is blacklsited for storage in the filesystem
* Listens to write and rename hooks
* @param array $data from hook
*/
static public function isBlacklisted($data){
$blacklist = array('.htaccess');
$filename = strtolower(basename($data['path']));
if(in_array($filename,$blacklist)){
$data['run'] = false;
if (isset($data['path'])) {
$path = $data['path'];
} else if (isset($data['newpath'])) {
$path = $data['newpath'];
}
if (isset($path)) {
$filename = strtolower(basename($path));
if (in_array($filename, $blacklist)) {
$data['run'] = false;
}
}
}
+1 -1
View File
@@ -322,7 +322,7 @@ class OC_Migrate{
$objects = scandir( $path );
if( sizeof( $objects ) > 0 ){
foreach( $objects as $file ){
if( $file == "." || $file == ".." )
if( $file == "." || $file == ".." || $file == ".htaccess")
continue;
// go on
if( is_dir( $path . '/' . $file ) ){
+14 -14
View File
@@ -83,7 +83,7 @@ class OC_Util {
* @return array
*/
public static function getVersion(){
return array(4,00,6);
return array(4,00,7);
}
/**
@@ -91,7 +91,7 @@ class OC_Util {
* @return string
*/
public static function getVersionString(){
return '4.0.6';
return '4.0.7';
}
/**
@@ -408,18 +408,18 @@ class OC_Util {
}
}
/**
* @brief Public function to sanitize HTML
*
* This function is used to sanitize HTML and should be applied on any string or array of strings before displaying it on a web page.
*
* @param string or array of strings
* @return array with sanitized strings or a single sinitized string, depends on the input parameter.
*/
public static function sanitizeHTML( &$value ){
if (is_array($value) || is_object($value)) array_walk_recursive($value,'OC_Util::sanitizeHTML');
else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
return $value;
/**
* @brief Public function to sanitize HTML
*
* This function is used to sanitize HTML and should be applied on any string or array of strings before displaying it on a web page.
*
* @param string or array of strings
* @return array with sanitized strings or a single sinitized string, depends on the input parameter.
*/
public static function sanitizeHTML( &$value ){
if (is_array($value) || is_object($value)) array_walk_recursive($value,'OC_Util::sanitizeHTML');
else $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
return $value;
}