Fix the Prevent problems
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 24 Jul 2013 07:20:52 +0000 (16:20 +0900)
committerWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 24 Jul 2013 08:56:39 +0000 (17:56 +0900)
[model] Redwood
[binary_type] AP
[customer] Open
[issue#] too many
[problem] from the Prevent
[cause] N/A
[solution] Fix the Prevent issue
[team] NFC
[request] N/A
[horizontal_expansion] N/A

Change-Id: I8a9633a3546a0ef1f31424febd5733433acdf518

client/Reader.cpp
client/Session.cpp
client/include/Session.h
common/GPARFACL.cpp
common/include/SessionHelper.h
server/ServerGDBus.cpp
server/ServerResource.cpp

index 38e3077..e218553 100644 (file)
@@ -43,8 +43,7 @@ namespace smartcard_service_api
        {
                _BEGIN();
 
-               if (context == NULL || name == NULL ||
-                       strlen(name) == 0 || handle == NULL)
+               if (context == NULL || handle == NULL)
                {
                        _ERR("invalid param");
 
index 63a57d0..e08abd1 100644 (file)
@@ -648,6 +648,8 @@ namespace smartcard_service_api
                                GPOINTER_TO_UINT(handle),
                                (guint)id, var_aid, NULL,
                                &Session::session_open_channel_cb, param);
+
+                       result = SCARD_ERROR_OK;
 #else
                        Message msg;
 
@@ -682,13 +684,15 @@ namespace smartcard_service_api
        }
 
        Channel *Session::openBasicChannelSync(const ByteArray &aid)
-               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
+               throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                       ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openChannelSync(0, aid);
        }
 
        Channel *Session::openBasicChannelSync(const unsigned char *aid, unsigned int length)
-               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
+               throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                       ErrorIllegalParameter &, ErrorSecurity &)
        {
                ByteArray temp(aid, length);
 
@@ -709,13 +713,15 @@ namespace smartcard_service_api
        }
 
        Channel *Session::openLogicalChannelSync(const ByteArray &aid)
-               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
+               throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                       ErrorIllegalParameter &, ErrorSecurity &)
        {
                return openChannelSync(1, aid);
        }
 
        Channel *Session::openLogicalChannelSync(const unsigned char *aid, unsigned int length)
-               throw (ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &)
+               throw (ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                       ErrorIllegalParameter &, ErrorSecurity &)
        {
                ByteArray temp(aid, length);
 
index fdff4fc..69df451 100644 (file)
@@ -87,19 +87,19 @@ namespace smartcard_service_api
                                ErrorIllegalState &, ErrorIllegalParameter &);
 
                Channel *openBasicChannelSync(const ByteArray &aid)
-                       throw(ErrorIO &, ErrorIllegalState &,
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
                                ErrorIllegalParameter &, ErrorSecurity &);
 
                Channel *openBasicChannelSync(const unsigned char *aid, unsigned int length)
-                       throw(ErrorIO &, ErrorIllegalState &,
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
                                ErrorIllegalParameter &, ErrorSecurity &);
 
                Channel *openLogicalChannelSync(const ByteArray &aid)
-                       throw(ErrorIO &, ErrorIllegalState &,
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
                                ErrorIllegalParameter &, ErrorSecurity &);
 
                Channel *openLogicalChannelSync(const unsigned char *aid, unsigned int length)
-                       throw(ErrorIO &, ErrorIllegalState &,
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
                                ErrorIllegalParameter &, ErrorSecurity &);
 
                size_t getChannelCount() const;
index 018473a..71cb37a 100644 (file)
@@ -255,6 +255,11 @@ namespace smartcard_service_api
        {
                SimpleTLV tlv(data);
 
+               if (rule == NULL) {
+                       _ERR("invalid parameter");
+                       return;
+               }
+
                if (tlv.decodeTLV() == true)
                {
                        switch (tlv.getTag())
@@ -304,6 +309,11 @@ namespace smartcard_service_api
 
        static void loadNFCAccessRule(AccessRule *rule, const ByteArray &data)
        {
+               if (rule == NULL) {
+                       _ERR("invalid parameter");
+                       return;
+               }
+
                rule->setNFCAccessRule(SimpleTLV::getBoolean(data));
        }
 
index 5d7128a..ead9c47 100644 (file)
@@ -74,16 +74,20 @@ namespace smartcard_service_api
                        ErrorIllegalState &, ErrorIllegalParameter &) = 0;
 
                virtual Channel *openBasicChannelSync(const ByteArray &aid)
-                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &) = 0;
 
                virtual Channel *openBasicChannelSync(const unsigned char *aid, unsigned int length)
-                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &) = 0;
 
                virtual Channel *openLogicalChannelSync(const ByteArray &aid)
-                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &) = 0;
 
                virtual Channel *openLogicalChannelSync(const unsigned char *aid, unsigned int length)
-                       throw(ErrorIO &, ErrorIllegalState &, ErrorIllegalParameter &, ErrorSecurity &) = 0;
+                       throw(ExceptionBase &, ErrorIO &, ErrorIllegalState &,
+                               ErrorIllegalParameter &, ErrorSecurity &) = 0;
        };
 
 } /* namespace smartcard_service_api */
index 7409a19..1f60e1e 100644 (file)
@@ -133,6 +133,11 @@ namespace smartcard_service_api
                const gchar *name, const gchar *old_owner,
                const gchar *new_owner, void *user_data)
        {
+               if (name == NULL || old_owner == NULL || new_owner == NULL) {
+                       _ERR("invalid parameter");
+                       return;
+               }
+
                if (strlen(new_owner) == 0) {
                        ClientInstance *client;
 
@@ -363,9 +368,12 @@ namespace smartcard_service_api
                                resource.createClient(name, pid);
 
                                instance = resource.getClient(name);
-
-                               /* generate certification hashes */
-                               instance->generateCertificationHashes();
+                               if (instance != NULL) {
+                                       /* generate certification hashes */
+                                       instance->generateCertificationHashes();
+                               } else {
+                                       _ERR("createClient failed");
+                               }
                        }
 
                        if (instance != NULL) {
index 549d2c6..1f093a0 100644 (file)
@@ -1507,7 +1507,9 @@ namespace smartcard_service_api
                                                        addAccessControlList(channel, acl);
                                                } else {
                                                        _ERR("unknown error, 0x%x", -ret);
+
                                                        delete acl;
+                                                       acl = NULL;
                                                }
                                        } else {
                                                _ERR("alloc failed");