Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #6

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e899c99
Show Login-Button when user+pw are autocompleted, fixes oc-1068
blizzz Aug 3, 2012
6b78ca1
LDAP: sanitize base, user and group trees. fixes oc-1302
blizzz Aug 3, 2012
0970a3c
Contacts: Fix no active Addressbooks
bartv2 Aug 3, 2012
758ae42
Calendar: remove double html encoding
bartv2 Aug 3, 2012
c32a99b
fix label for versioning in admin settings
Aug 4, 2012
e9e84b5
Merge branch 'stable4' of git://gitorious.org/owncloud/owncloud into …
blizzz Aug 5, 2012
2cfc7f7
fix for bug 879 - add parent directory to file cache if it does not e…
Aug 8, 2012
a366ba4
Fix for broken Mail App in OSX Mountain Lion. https://mail.kde.org/pi…
tanghus Aug 9, 2012
aae17d4
Sanitize user input
LukasReschke Aug 9, 2012
7581d55
Missed an "echo"
LukasReschke Aug 9, 2012
5192eec
Added XSRF check
LukasReschke Aug 9, 2012
baab13a
Validate cookie to prevent auth bypasses.
LukasReschke Aug 10, 2012
e9a6390
Don't return file handle if the mode supports writing and the file is…
Aug 8, 2012
2871896
Check if webfinger is enabled
LukasReschke Aug 10, 2012
6d94455
Fix OC_Connector_Sabre_Locks for SQLite
jakobsack Aug 12, 2012
2024d42
Disable listing of all users
LukasReschke Aug 12, 2012
4fd069b
Also check some other files
LukasReschke Aug 12, 2012
95ef80e
Check blacklist when renaming files
Aug 11, 2012
4682846
Disable user enumeration
LukasReschke Aug 14, 2012
526e704
4.0.7
Aug 14, 2012
f53dd22
backport 1bccc80996e270f928c207cdd3090f4284abaea5
Aug 4, 2012
4500359
Use SCRIPT_NAME instead of PHP_SELF which won't send the PATH_INFO, t…
LukasReschke Aug 18, 2012
4984a72
Add a missing exit();
LukasReschke Aug 18, 2012
2051a5d
Fix deletion for browser that do not support onBeforeUnload, fixes oc…
blizzz Aug 20, 2012
5afdfec
Sanitizing the user input to prevent a reflected XSS. Thanks to Nico …
LukasReschke Aug 21, 2012
49c17fc
I like TLS/SSL
LukasReschke Aug 25, 2012
a791753
Gitorious => Github
LukasReschke Aug 26, 2012
170da45
Update lib/base.php
zedascouves Aug 29, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions 3rdparty/Sabre/CardDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ public function beforeGetProperties($path, Sabre_DAV_INode $node, array &$reques

// 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;

}
}
Expand Down
9 changes: 4 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ http://ownCloud.org

Installation instructions: http://owncloud.org/support

Source code: http://gitorious.org/owncloud
Mailing list: http://mail.kde.org/mailman/listinfo/owncloud
IRC channel: http://webchat.freenode.net/?channels=owncloud
Source code: https://github.com/owncloud
Mailing list: https://mail.kde.org/mailman/listinfo/owncloud
IRC channel: https://webchat.freenode.net/?channels=owncloud
Diaspora: https://joindiaspora.com/u/owncloud
Identi.ca: http://identi.ca/owncloud

Identi.ca: https://identi.ca/owncloud
15 changes: 11 additions & 4 deletions apps/calendar/appinfo/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@
$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);
Expand Down
4 changes: 2 additions & 2 deletions apps/calendar/lib/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ public static function generateEventOutput($event, $start, $end){
$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;
Expand Down
14 changes: 10 additions & 4 deletions apps/contacts/appinfo/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@
$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);
Expand Down
1 change: 1 addition & 0 deletions apps/contacts/lib/addressbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ public static function active($uid){
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;
Expand Down
3 changes: 2 additions & 1 deletion apps/files/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
$dir = isset( $_GET['dir'] ) ? stripslashes($_GET['dir']) : '';
// Redirect if directory does not exist
if(!OC_Filesystem::is_dir($dir.'/')) {
header('Location: '.$_SERVER['PHP_SELF'].'');
header('Location: '.$_SERVER['SCRIPT_NAME'].'');
exit();
}

$files = array();
Expand Down
30 changes: 18 additions & 12 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,15 @@ FileList={
},
do_delete:function(files){
if(FileList.deleteFiles || !FileList.useUndo){//finish any ongoing deletes first
if(!FileList.deleteFiles) {
FileList.prepareDeletion(files);
}
FileList.finishDelete(function(){
FileList.do_delete(files);
});
return;
}
if(files.substr){
files=[files];
}
$.each(files,function(index,file){
var files = $('tr').filterAttr('data-file',file);
files.hide();
files.find('input[type="checkbox"]').removeAttr('checked');
files.removeClass('selected');
});
procesSelection();
FileList.deleteCanceled=false;
FileList.deleteFiles=files;
FileList.prepareDeletion(files);
$('#notification').text(t('files','undo deletion'));
$('#notification').data('deletefile',true);
$('#notification').fadeIn();
Expand All @@ -209,6 +201,20 @@ FileList={
}
});
}
},
prepareDeletion:function(files){
if(files.substr){
files=[files];
}
$.each(files,function(index,file){
var files = $('tr').filterAttr('data-file',file);
files.hide();
files.find('input[type="checkbox"]').removeAttr('checked');
files.removeClass('selected');
});
procesSelection();
FileList.deleteCanceled=false;
FileList.deleteFiles=files;
}
}

Expand Down
19 changes: 19 additions & 0 deletions apps/files_sharing/sharedstorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,25 @@ public function copy($path1, $path2) {
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);
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_versions/templates/settings.php
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion apps/gallery/sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<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>
Expand Down
76 changes: 38 additions & 38 deletions apps/gallery/templates/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</style>
<script type="text/javascript">

var root = "<?php echo $root; ?>";
var root = "<?php echo htmlentities($root); ?>";

function explode(element) {
$('div', element).each(function(index, elem) {
Expand Down Expand Up @@ -83,56 +83,56 @@ function openNewGal(album_name) {
$ts = new \OC\Pictures\TileStack(array(), '');
$previous_element = @$images[0];

$root_images = array();
$second_level_images = array();
$root_images = array();
$second_level_images = array();

$fallback_images = array(); // if the folder only cotains subfolders with images -> these are taken for the stack preview

for($i = 0; $i < count($images); $i++) {
$prev_dir_arr = explode('/', $previous_element);
$dir_arr = explode('/', $images[$i]);

if(count($dir_arr) == 1) { // getting the images in this directory
$root_images[] = $root.$images[$i];
} else {
if(strcmp($prev_dir_arr[0], $dir_arr[0]) != 0) { // if we entered a new directory
if(count($second_level_images) == 0) { // if we don't have images in this directory
if(count($fallback_images) != 0) { // but have fallback_images
$tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
$fallback_images = array();
}
} else { // if we collected images for this directory
$tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
$fallback_images = array();
$second_level_images = array();
}
}
if (count($dir_arr) == 2) { // These are the pics in our current subdir
$second_level_images[] = $root.$images[$i];
$fallback_images = array();
} else { // These are images from the deeper directories
if(count($second_level_images) == 0) {
$fallback_images[] = $root.$images[$i];
}
}
// have us a little something to compare against
$previous_element = $images[$i];
if(count($dir_arr) == 1) { // getting the images in this directory
$root_images[] = $root.$images[$i];
} else {
if(strcmp($prev_dir_arr[0], $dir_arr[0]) != 0) { // if we entered a new directory
if(count($second_level_images) == 0) { // if we don't have images in this directory
if(count($fallback_images) != 0) { // but have fallback_images
$tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
$fallback_images = array();
}
} else { // if we collected images for this directory
$tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
$fallback_images = array();
$second_level_images = array();
}
}
if (count($dir_arr) == 2) { // These are the pics in our current subdir
$second_level_images[] = $root.$images[$i];
$fallback_images = array();
} else { // These are images from the deeper directories
if(count($second_level_images) == 0) {
$fallback_images[] = $root.$images[$i];
}
}
// have us a little something to compare against
$previous_element = $images[$i];
}
}

// if last element in the directory was a directory we don't want to miss it :)
if(count($second_level_images)>0) {
$tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
// if last element in the directory was a directory we don't want to miss it :)
if(count($second_level_images)>0) {
$tl->addTile(new \OC\Pictures\TileStack($second_level_images, $prev_dir_arr[0]));
}

// if last element in the directory was a directory with no second_level_images we also don't want to miss it ...
if(count($fallback_images)>0) {
$tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
// if last element in the directory was a directory with no second_level_images we also don't want to miss it ...
if(count($fallback_images)>0) {
$tl->addTile(new \OC\Pictures\TileStack($fallback_images, $prev_dir_arr[0]));
}

// and finally our images actually stored in the root folder
for($i = 0; $i<count($root_images); $i++) {
$tl->addTile(new \OC\Pictures\TileSingle($root_images[$i]));
// and finally our images actually stored in the root folder
for($i = 0; $i<count($root_images); $i++) {
$tl->addTile(new \OC\Pictures\TileSingle($root_images[$i]));
}

echo $tl->get();
Expand Down
6 changes: 3 additions & 3 deletions apps/user_ldap/lib_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,9 @@ static private function readConfiguration($force = false) {
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'));
Expand Down
4 changes: 4 additions & 0 deletions apps/user_webfinger/host-meta.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
if (!OCP\App::isEnabled("user_webfinger")) {
return;
}

$hostMetaHeader = array(
'Access-Control-Allow-Origin' => '*',
'Content-Type' => 'application/xrd+json'
Expand Down
6 changes: 5 additions & 1 deletion apps/user_webfinger/webfinger.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?php
if (!OCP\App::isEnabled("user_webfinger")) {
return;
}

header("Access-Control-Allow-Origin: *");
header("Content-Type: application/xrd+json");

Expand All @@ -15,7 +19,7 @@
* 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
Expand Down
1 change: 1 addition & 0 deletions core/ajax/appconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 5 additions & 6 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() == '') {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
// 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();
}
Expand Down
5 changes: 5 additions & 0 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@ public static function detectFormfactor(){
if(isset($_SERVER['HTTP_USER_AGENT'])){
if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) {
$mode='tablet';
}elseif(stripos($_SERVER['HTTP_USER_AGENT'],'Android')>0){
$mode='tablet';
}elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){
$mode='mobile';
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){
$mode='mobile';
}elseif((stripos($_SERVER['HTTP_USER_AGENT'],'Android')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'Mobile')>0)){
$mode='mobile';
}else{
$mode='default';
}
Expand Down Expand Up @@ -434,6 +438,7 @@ public static function init(){

// 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'));
Expand Down
Loading