[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kauth] src: Fix build on Mac OS X
From:       Harald Fernengel <harry () kdevelop ! org>
Date:       2014-02-05 12:01:31
Message-ID: E1WB1AZ-0000Bk-TH () scm ! kde ! org
[Download RAW message or body]

Git commit 5270fe3e750a0c3667367ff841080b3092473b8c by Harald Fernengel.
Committed on 05/02/2014 at 11:57.
Pushed by harald into branch 'master'.

Fix build on Mac OS X

M  +2    -2    src/ConfigureChecks.cmake
M  +7    -3    src/backends/mac/AuthServicesBackend.cpp
M  +5    -5    src/backends/mac/kauth-policy-gen-mac.cpp
M  +1    -0    src/policy-gen/policy-gen.cpp

http://commits.kde.org/kauth/5270fe3e750a0c3667367ff841080b3092473b8c

diff --git a/src/ConfigureChecks.cmake b/src/ConfigureChecks.cmake
index 8b0113a..f3dc6a6 100644
--- a/src/ConfigureChecks.cmake
+++ b/src/ConfigureChecks.cmake
@@ -124,7 +124,7 @@ if(KAUTH_BACKEND_NAME STREQUAL "OSX")
         backends/mac/AuthServicesBackend.cpp
     )
 
-    set(KAUTH_BACKEND_LIBS ${SECURITY_LIBRARY})
+    set(KAUTH_BACKEND_LIBS ${SECURITY_LIBRARY} Qt5::Core)
 elseif(KAUTH_BACKEND_NAME STREQUAL "POLKITQT")
 
     message(STATUS "Building PolkitQt KAuth backend")
@@ -173,7 +173,7 @@ set(KAUTH_POLICY_GEN_LIBRARIES)
 if(KAUTH_BACKEND_NAME STREQUAL "OSX")
    set(KAUTH_POLICY_GEN_SRCS ${KAUTH_POLICY_GEN_SRCS}
        backends/mac/kauth-policy-gen-mac.cpp)
-   set(KAUTH_POLICY_GEN_LIBRARIES ${KAUTH_POLICY_GEN_LIBRARIES} \
${CORE_FOUNDATION_LIBRARY} ${SECURITY_LIBRARY}) +   set(KAUTH_POLICY_GEN_LIBRARIES \
${KAUTH_POLICY_GEN_LIBRARIES} ${CORE_FOUNDATION_LIBRARY} ${SECURITY_LIBRARY} \
Qt5::Core)  elseif(KAUTH_BACKEND_NAME STREQUAL "POLKITQT")
    set(KAUTH_POLICY_GEN_SRCS ${KAUTH_POLICY_GEN_SRCS}
        backends/policykit/kauth-policy-gen-polkit.cpp )
diff --git a/src/backends/mac/AuthServicesBackend.cpp \
b/src/backends/mac/AuthServicesBackend.cpp index 25adc1a..e832bfe 100644
--- a/src/backends/mac/AuthServicesBackend.cpp
+++ b/src/backends/mac/AuthServicesBackend.cpp
@@ -58,8 +58,10 @@ Action::AuthStatus AuthServicesBackend::authorizeAction(const \
QString &action)  
 Action::AuthStatus AuthServicesBackend::actionStatus(const QString &action)
 {
+    const QByteArray actionName = action.toUtf8();
+
     AuthorizationItem item;
-    item.name = action.toUtf8();
+    item.name = actionName.constData();
     item.valueLength = 0;
     item.value = NULL;
     item.flags = 0;
@@ -105,8 +107,10 @@ bool AuthServicesBackend::isCallerAuthorized(const QString \
&action, QByteArray c  return false;
     }
 
+    const QByteArray actionName = action.toUtf8();
+
     AuthorizationItem item;
-    item.name = action.toUtf8();
+    item.name = actionName.constData();
     item.valueLength = 0;
     item.value = NULL;
     item.flags = 0;
@@ -128,7 +132,7 @@ bool AuthServicesBackend::isCallerAuthorized(const QString \
&action, QByteArray c  
 bool AuthServicesBackend::actionExists(const QString &action)
 {
-    OSStatus exists = AuthorizationRightGet(action.toUtf8(), NULL);
+    OSStatus exists = AuthorizationRightGet(action.toUtf8().constData(), NULL);
 
     return exists == errAuthorizationSuccess;
 }
diff --git a/src/backends/mac/kauth-policy-gen-mac.cpp \
b/src/backends/mac/kauth-policy-gen-mac.cpp index 13b6241..b8d3cfc 100644
--- a/src/backends/mac/kauth-policy-gen-mac.cpp
+++ b/src/backends/mac/kauth-policy-gen-mac.cpp
@@ -17,7 +17,7 @@
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .
 */
 
-#include <auth/policy-gen/policy-gen.h>
+#include "../../policy-gen/policy-gen.h"
 
 #include <iostream>
 #include <Security/Security.h>
@@ -33,7 +33,7 @@ void output(QList<Action> actions, QHash<QString, QString> domain)
 
     foreach (const Action &action, actions) {
 
-        err = AuthorizationRightGet(action.name.toLatin1(), NULL);
+        err = AuthorizationRightGet(action.name.toLatin1().constData(), NULL);
 
         if (err == errAuthorizationDenied) {
 
@@ -49,10 +49,10 @@ void output(QList<Action> actions, QHash<QString, QString> \
                domain)
                 rule = QString::fromLatin1(kAuthorizationRuleAuthenticateAsAdmin);
             }
 
-            CFStringRef cfRule = CFStringCreateWithCString(NULL, rule.toLatin1(), \
                kCFStringEncodingASCII);
-            CFStringRef cfPrompt = CFStringCreateWithCString(NULL, \
action.descriptions.value(QLatin1String("en")).toLatin1(), kCFStringEncodingASCII); + \
CFStringRef cfRule = CFStringCreateWithCString(NULL, rule.toLatin1().constData(), \
kCFStringEncodingASCII); +            CFStringRef cfPrompt = \
CFStringCreateWithCString(NULL, \
action.descriptions.value(QLatin1String("en")).toLatin1().constData(), \
kCFStringEncodingASCII);  
-            err = AuthorizationRightSet(auth, action.name.toLatin1(), cfRule, \
cfPrompt, NULL, NULL); +            err = AuthorizationRightSet(auth, \
action.name.toLatin1().constData(), cfRule, cfPrompt, NULL, NULL);  if (err != noErr) \
                {
                 cerr << "You don't have the right to edit the security database (try \
to run cmake with sudo): " << err << endl;  exit(1);
diff --git a/src/policy-gen/policy-gen.cpp b/src/policy-gen/policy-gen.cpp
index f93f667..99bb085 100644
--- a/src/policy-gen/policy-gen.cpp
+++ b/src/policy-gen/policy-gen.cpp
@@ -28,6 +28,7 @@
 #include <QDebug>
 
 #include <cstdio>
+#include <errno.h>
 
 using namespace std;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic