]> arthur.barton.de Git - netatalk.git/commitdiff
Fix check for unsupported attributes
authorRalph Boehme <sloowfranklin@gmail.com>
Mon, 4 Mar 2013 20:40:17 +0000 (21:40 +0100)
committerRalph Boehme <sloowfranklin@gmail.com>
Mon, 4 Mar 2013 20:40:17 +0000 (21:40 +0100)
etc/spotlight/slmod_sparql_parser.c
etc/spotlight/slmod_sparql_parser.y

index 252514d460a29b3141863e4cd81edbd00ee05213..9772b9ee604ebc1f5aa7065a9d1d90d8b9015def 100644 (file)
@@ -1932,7 +1932,11 @@ static const char *map_expr(const char *attr, char op, const char *val)
     bstring q = NULL, search = NULL, replace = NULL;
 
     for (p = spotlight_sparql_map; p->ssm_spotlight_attr; p++) {
-        if (p->ssm_sparql_attr && strcmp(p->ssm_spotlight_attr, attr) == 0) {
+        if (strcmp(p->ssm_spotlight_attr, attr) == 0) {
+            if (p->ssm_type != ssmt_type && p->ssm_sparql_attr == NULL) {
+                yyerror("unsupported Spotlight attribute");
+                EC_FAIL;
+            }
             switch (p->ssm_type) {
             case ssmt_bool:
                 result = talloc_asprintf(ssp_slq, "?obj %s '%s'", p->ssm_sparql_attr, val);
@@ -1978,7 +1982,6 @@ static const char *map_expr(const char *attr, char op, const char *val)
                 result = map_type_search(attr, op, val);
                 break;
             default:
-                yyerror("unknown Spotlight attribute type");
                 EC_FAIL;
             }
             break;
index 301129696dfa1fb77fd2ecfd0b4f88b2518ceb44..68d3d1013afd36fe2ed625ba1d764b737a4e1ed7 100644 (file)
@@ -206,7 +206,11 @@ static const char *map_expr(const char *attr, char op, const char *val)
     bstring q = NULL, search = NULL, replace = NULL;
 
     for (p = spotlight_sparql_map; p->ssm_spotlight_attr; p++) {
-        if (p->ssm_sparql_attr && strcmp(p->ssm_spotlight_attr, attr) == 0) {
+        if (strcmp(p->ssm_spotlight_attr, attr) == 0) {
+            if (p->ssm_type != ssmt_type && p->ssm_sparql_attr == NULL) {
+                yyerror("unsupported Spotlight attribute");
+                EC_FAIL;
+            }
             switch (p->ssm_type) {
             case ssmt_bool:
                 result = talloc_asprintf(ssp_slq, "?obj %s '%s'", p->ssm_sparql_attr, val);
@@ -252,7 +256,6 @@ static const char *map_expr(const char *attr, char op, const char *val)
                 result = map_type_search(attr, op, val);
                 break;
             default:
-                yyerror("unknown Spotlight attribute type");
                 EC_FAIL;
             }
             break;