Diff for /qemu/acl.c between versions 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2018/04/24 17:20:33 version 1.1.1.3, 2018/04/24 18:55:56
Line 24 Line 24
   
   
 #include "qemu-common.h"  #include "qemu-common.h"
 #include "sysemu.h"  
 #include "acl.h"  #include "acl.h"
   
 #ifdef HAVE_FNMATCH_H  #ifdef CONFIG_FNMATCH
 #include <fnmatch.h>  #include <fnmatch.h>
 #endif  #endif
   
Line 64  qemu_acl *qemu_acl_init(const char *acln Line 63  qemu_acl *qemu_acl_init(const char *acln
     acl->defaultDeny = 1;      acl->defaultDeny = 1;
   
     acl->nentries = 0;      acl->nentries = 0;
     TAILQ_INIT(&acl->entries);      QTAILQ_INIT(&acl->entries);
   
     acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1));      acls = qemu_realloc(acls, sizeof(*acls) * (nacls +1));
     acls[nacls] = acl;      acls[nacls] = acl;
Line 78  int qemu_acl_party_is_allowed(qemu_acl * Line 77  int qemu_acl_party_is_allowed(qemu_acl *
 {  {
     qemu_acl_entry *entry;      qemu_acl_entry *entry;
   
     TAILQ_FOREACH(entry, &acl->entries, next) {      QTAILQ_FOREACH(entry, &acl->entries, next) {
 #ifdef HAVE_FNMATCH_H  #ifdef CONFIG_FNMATCH
         if (fnmatch(entry->match, party, 0) == 0)          if (fnmatch(entry->match, party, 0) == 0)
             return entry->deny ? 0 : 1;              return entry->deny ? 0 : 1;
 #else  #else
Line 102  void qemu_acl_reset(qemu_acl *acl) Line 101  void qemu_acl_reset(qemu_acl *acl)
      * of "open access" while the user re-initializes the       * of "open access" while the user re-initializes the
      * access control list */       * access control list */
     acl->defaultDeny = 1;      acl->defaultDeny = 1;
     TAILQ_FOREACH(entry, &acl->entries, next) {      QTAILQ_FOREACH(entry, &acl->entries, next) {
         TAILQ_REMOVE(&acl->entries, entry, next);          QTAILQ_REMOVE(&acl->entries, entry, next);
         free(entry->match);          free(entry->match);
         free(entry);          free(entry);
     }      }
Line 121  int qemu_acl_append(qemu_acl *acl, Line 120  int qemu_acl_append(qemu_acl *acl,
     entry->match = qemu_strdup(match);      entry->match = qemu_strdup(match);
     entry->deny = deny;      entry->deny = deny;
   
     TAILQ_INSERT_TAIL(&acl->entries, entry, next);      QTAILQ_INSERT_TAIL(&acl->entries, entry, next);
     acl->nentries++;      acl->nentries++;
   
     return acl->nentries;      return acl->nentries;
Line 147  int qemu_acl_insert(qemu_acl *acl, Line 146  int qemu_acl_insert(qemu_acl *acl,
     entry->match = qemu_strdup(match);      entry->match = qemu_strdup(match);
     entry->deny = deny;      entry->deny = deny;
   
     TAILQ_FOREACH(tmp, &acl->entries, next) {      QTAILQ_FOREACH(tmp, &acl->entries, next) {
         i++;          i++;
         if (i == index) {          if (i == index) {
             TAILQ_INSERT_BEFORE(tmp, entry, next);              QTAILQ_INSERT_BEFORE(tmp, entry, next);
             acl->nentries++;              acl->nentries++;
             break;              break;
         }          }
Line 165  int qemu_acl_remove(qemu_acl *acl, Line 164  int qemu_acl_remove(qemu_acl *acl,
     qemu_acl_entry *entry;      qemu_acl_entry *entry;
     int i = 0;      int i = 0;
   
     TAILQ_FOREACH(entry, &acl->entries, next) {      QTAILQ_FOREACH(entry, &acl->entries, next) {
         i++;          i++;
         if (strcmp(entry->match, match) == 0) {          if (strcmp(entry->match, match) == 0) {
             TAILQ_REMOVE(&acl->entries, entry, next);              QTAILQ_REMOVE(&acl->entries, entry, next);
             return i;              return i;
         }          }
     }      }

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3


unix.superglobalmegacorp.com