forked from quickshell/quickshell
		
	service/pipewire: fix metadata permission checks
This commit is contained in:
		
							parent
							
								
									fbaec141c0
								
							
						
					
					
						commit
						3ed39b2a79
					
				
					 2 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -193,6 +193,13 @@ bool PwDefaultTracker::setConfiguredDefault(const char* key, const QString& valu
 | 
			
		|||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!meta->hasSetPermission()) {
 | 
			
		||||
		qCCritical(logDefaults
 | 
			
		||||
		) << "Cannot set default node as write+execute permissions are missing for"
 | 
			
		||||
		  << meta;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (value.isEmpty()) {
 | 
			
		||||
		meta->setProperty(key, "Spa:String:JSON", nullptr);
 | 
			
		||||
	} else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,13 +2,13 @@
 | 
			
		|||
 | 
			
		||||
#include <pipewire/core.h>
 | 
			
		||||
#include <pipewire/extensions/metadata.h>
 | 
			
		||||
#include <pipewire/permission.h>
 | 
			
		||||
#include <qlogging.h>
 | 
			
		||||
#include <qloggingcategory.h>
 | 
			
		||||
#include <qobject.h>
 | 
			
		||||
#include <qstringview.h>
 | 
			
		||||
#include <qtmetamacros.h>
 | 
			
		||||
#include <qtypes.h>
 | 
			
		||||
#include <spa/param/param.h>
 | 
			
		||||
#include <spa/utils/dict.h>
 | 
			
		||||
 | 
			
		||||
#include "registry.hpp"
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ int PwMetadata::onProperty(
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
bool PwMetadata::hasSetPermission() const {
 | 
			
		||||
	return (this->perms & SPA_PARAM_INFO_WRITE) == SPA_PARAM_INFO_WRITE;
 | 
			
		||||
	return (this->perms & (PW_PERM_W | PW_PERM_X)) == (PW_PERM_W | PW_PERM_X);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PwMetadata::setProperty(const char* key, const char* type, const char* value) {
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,8 @@ void PwMetadata::setProperty(const char* key, const char* type, const char* valu
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	if (!this->hasSetPermission()) {
 | 
			
		||||
		qCCritical(logMeta) << "Tried to change property of" << this << "which is read-only.";
 | 
			
		||||
		qCCritical(logMeta) << "Tried to change property of" << this
 | 
			
		||||
		                    << "which is missing write+execute permissions.";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pw_metadata_set_property(this->proxy(), PW_ID_CORE, key, type, value);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue