"Fossies" - the Fresh Open Source Software Archive

Member "libisofs-1.5.4/libisofs/aaip-os-dummy.c" (8 Jul 2020, 3562 Bytes) of package /linux/misc/libisofs-1.5.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "aaip-os-dummy.c" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.5.0_vs_1.5.2.

    1 
    2 /*
    3 
    4  aaip-os-dummy.c
    5 
    6  Idle placeholder for:
    7  Arbitrary Attribute Interchange Protocol , system adapter for getting and
    8  setting of ACLs and xattr.
    9 
   10  See aaip-os-linux.c for a real implementation of this interface.
   11 
   12  To be included by aaip_0_2.c
   13 
   14  Copyright (c) 2009 - 2011 Thomas Schmitt
   15 
   16  This file is part of the libisofs project; you can redistribute it and/or
   17  modify it under the terms of the GNU General Public License version 2
   18  or later as published by the Free Software Foundation.
   19  See COPYING file for details.
   20 
   21 */
   22 
   23 #ifdef HAVE_CONFIG_H
   24 #include "../config.h"
   25 #endif
   26 
   27 #include <ctype.h>
   28 #include <sys/types.h>
   29 #include <unistd.h>
   30 #include <stdlib.h>
   31 #include <string.h>
   32 #include <stdio.h>
   33 #include <sys/stat.h>
   34 
   35 
   36 /* ------------------------------ Inquiry --------------------------------- */
   37 
   38 /* See also API iso_local_attr_support().
   39    @param flag
   40         Bitfield for control purposes
   41              bit0= inquire availability of ACL
   42              bit1= inquire availability of xattr
   43              bit2 - bit7= Reserved for future types.
   44                           It is permissibile to set them to 1 already now.
   45              bit8 and higher: reserved, submit 0
   46    @return
   47         Bitfield corresponding to flag.
   48              bit0= ACL adapter is enabled
   49              bit1= xattr adapter is enabled
   50              bit2 - bit7= Reserved for future types.
   51              bit8 and higher: reserved, do not interpret these
   52 */
   53 int aaip_local_attr_support(int flag)
   54 {
   55  return(0);
   56 }
   57 
   58 
   59 /* ------------------------------ Getters --------------------------------- */
   60 
   61 /* Obtain the ACL of the given file in long text form.
   62    @return          0 ACL support not enabled at compile time
   63 */
   64 int aaip_get_acl_text(char *path, char **text, int flag)
   65 {
   66  return(0);
   67 }
   68 
   69 
   70 /* Obtain the Extended Attributes and/or the ACLs of the given file in a form
   71    that is ready for aaip_encode().
   72    @return              1   ok
   73 */
   74 int aaip_get_attr_list(char *path, size_t *num_attrs, char ***names,
   75                        size_t **value_lengths, char ***values, int flag)
   76 {
   77  *num_attrs= 0;
   78  *names= NULL;
   79  *value_lengths= NULL;
   80  *values= NULL;
   81  return(1);
   82 }
   83 
   84 
   85 /* ------------------------------ Setters --------------------------------- */
   86 
   87 
   88 /* Set the ACL of the given file to a given list in long text form.
   89    @return              0 ACL support not enabled at compile time
   90 */
   91 int aaip_set_acl_text(char *path, char *text, int flag)
   92 {
   93  return(0);
   94 }
   95 
   96 
   97 /* Bring the given attributes and/or ACLs into effect with the given file.
   98    @param flag          Bitfield for control purposes
   99                         bit0= decode and set ACLs
  100                         bit1= first clear all existing attributes of the file
  101                         bit2= do not set attributes other than ACLs
  102    @return              1 success (there was nothing to do)
  103                        -6 support of xattr not enabled at compile time
  104                        -7 support of ACL not enabled at compile time
  105 */
  106 int aaip_set_attr_list(char *path, size_t num_attrs, char **names,
  107                        size_t *value_lengths, char **values, int *errnos,
  108                        int flag)
  109 {
  110  size_t i;
  111 
  112  for(i= 0; i < num_attrs; i++)
  113    errnos[i]= 0;
  114 
  115  for(i= 0; i < num_attrs; i++) {
  116    if(names[i] == NULL || values[i] == NULL)
  117  continue;
  118    if(names[i][0] == 0) { /* ACLs */
  119      if(flag & 1)
  120        return(-7);
  121  continue;
  122    }
  123    /* Extended Attribute */
  124    if(flag & 4)
  125  continue;
  126    if(!(flag & 8))
  127      if(strncmp(names[i], "user.", 5))
  128  continue;
  129    return(-6);
  130  }
  131  if(flag & 2)
  132    return(-6);
  133  return(1);
  134 }
  135 
  136