This file is indexed.

/usr/include/x86_64-linux-gnu/zypp/CpeId.h is in libzypp-dev 14.29.1-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
/*---------------------------------------------------------------------\
|                          ____ _   __ __ ___                          |
|                         |__  / \ / / . \ . \                         |
|                           / / \ V /|  _/  _/                         |
|                          / /__ | | | | | |                           |
|                         /_____||_| |_| |_|                           |
|                                                                      |
\---------------------------------------------------------------------*/
/** \file	zypp/CpeId.h
 */
#ifndef ZYPP_CPEID_H
#define ZYPP_CPEID_H

#include <iosfwd>
#include <string>

#include "zypp/base/PtrTypes.h"
#include "zypp/base/Flags.h"
#include "zypp/base/EnumClass.h"
#include "zypp/base/SetRelationMixin.h"

///////////////////////////////////////////////////////////////////
namespace zypp
{
  ///////////////////////////////////////////////////////////////////
  /// \class CpeId
  /// \brief Common Platform Enumearation (2.3)
  /// See http://cpe.mitre.org/ for more information on the
  /// Common Platform Enumearation.
  ///////////////////////////////////////////////////////////////////
  class CpeId : public base::SetRelationMixin<CpeId>
  {
  public:
    /** WFN attribute value */
    class Value;

  public:
    /** WFN attributes (use like 'enum class \ref Attribute') */
    struct _AttributeDef {
      enum Enum {
	part,		//< attribute (2.2)
	vendor,		//< attribute (2.2)
	product,	//< attribute (2.2)
	version,	//< attribute (2.2)
	update,		//< attribute (2.2)
	edition,	//< attribute (2.2)
	language,	//< attribute (2.2)
	sw_edition,	//< extended attribute (2.3)
	target_sw,	//< extended attribute (2.3)
	target_hw,	//< extended attribute (2.3)
	other		//< extended attribute (2.3)
      };
      static constexpr unsigned numAttributes = other+1;	///< number of attributes
      static const std::string & asString( Enum val_r );	///< string representantion
    };
    typedef base::EnumClass<_AttributeDef> Attribute;	///< 'enum class Attribute'

  public:
    /** Indicator type for non-trowing ctor. */
    struct NoThrowType { static std::string lastMalformed; };
    /** Indicator argument for non-trowing ctor. */
    static constexpr NoThrowType noThrow = NoThrowType();

  public:
    /** Default ctor: ANY-Cpeid, all attribute values are ANY */
    CpeId();

    /** Ctor parsing from string representation (empty or URI or FS)
     * \throws std::invalid_argument if string is malformed
     */
    explicit CpeId( const std::string & cpe_r );

    /** Ctor parsing from string representation (empty or URI or FS)
     * \throws std::invalid_argument if string is malformed
     */
    explicit CpeId( const char * cpe_r )
      : CpeId( std::string( cpe_r ? cpe_r : "" ) )
    {}

    /** Ctor parsing from string (empty or URI or FS, non throwing)
     * Creates an empty CpeId if string is malformed.
     */
    CpeId( const std::string & cpe_r, NoThrowType );

    /** Dtor */
    ~CpeId();

  public:
    /**  Evaluate in boolean context: not an ANY-CpeId */
    explicit operator bool() const;

    /** Default string representation [\ref asFS]. */
    std::string asString() const
    { return asFs(); }

    /** String representation as Formated-String (in/out).
     * \code
     * cpe:2.3:a:opensuse:libzypp:14.16.0:beta:*:*:*:*:*:*
     * \endcode
     */
    std::string asFs() const;

    /** String representation as URI (in/out).
     * \code
     * cpe:/a:opensuse:libzypp:14.16.0:beta
     * \endcode
     */
    std::string asUri() const;

    /** String representation as Well-Formed-Name (internal format, out only).
     * \code
     * wfn:[part="a",vendor="opensuse",product="libzypp", version="14\.16\.0",update="beta"]
     * \endcode
     */
    std::string asWfn() const;

  private:
    friend SetCompare base::SetRelationMixin<CpeId>::compare( const CpeId & ) const;
    /** CPE name matching hook for \ref SetRelationMixin */
    SetCompare setRelationMixinCompare( const CpeId & trg ) const;

  public:
    class Impl;                 ///< Implementation class.
  private:
    RWCOW_pointer<Impl> _pimpl; ///< Pointer to implementation.
  };

  SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( CpeId, const char * );
  SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( CpeId, const std::string & );

  /** \relates CpeId Stream output */
  inline std::ostream & operator<<( std::ostream & str, const CpeId & obj )
  { return str << obj.asString(); }

  /** \relates CpeId::Attribute Stream output */
  inline std::ostream & operator<<( std::ostream & str, const CpeId::Attribute & obj )
  { return str << CpeId::Attribute::asString( obj.asEnum() ); }


  ///////////////////////////////////////////////////////////////////
  /// \class CpeId::Value
  /// \brief WFN attribute value
  ///
  /// Valid WFN string values are not empty, contain alphanumeric chars, underscore,
  /// no whitespace, printable non-alphanumeric characters must be quoted by a
  /// backslash.
  ///
  /// Unescaped asterisk and question mark are special characters and may occur at
  /// the beginning and or end of the string. The asterisk must not be used more than
  /// once in asequense. The question mark may be used more than once in a sequence.
  ///
  /// A single asterisk must not be used as attribute value, nor a single quoted hyphen.
  ///
  /// A single question mark may be used as value.
  ///
  /// \see http://cpe.mitre.org/ for more information on the Common Platform Enumeration.
  ///////////////////////////////////////////////////////////////////
  class CpeId::Value : public base::SetRelationMixin<Value>
  {
  public:
    /** Logical value matching ANY value. */
    static const Value ANY;

    /** Logical value indicating “not applicable/not used" */
    static const Value NA;

  public:
    /** Indicator type for ctor arg in FS format. */
    struct FsFormatType {};
    /** Indicator argument for ctor arg in FS format. */
    static constexpr FsFormatType fsFormat = FsFormatType();

    /** Indicator type for ctor arg in URI format. */
    struct UriFormatType {};
    /** Indicator argument for ctor arg in URI format. */
    static constexpr UriFormatType uriFormat = UriFormatType();

  public:
    /** Default ctor: ANY */
    Value()
    {}

    /** Ctor from string (WFN format; \c "*" represents ANY; \c "" represents NA)
     * \throws std::invalid_argument if string is malformed (\see \ref isValidWfn).
     */
    explicit Value( const std::string & value_r );

    /** Ctor from char* (WFN format; \c nullptr or \c "*" represent ANY; \c "" represents NA)
     * \throws std::invalid_argument if string is malformed (\see \ref isValidWfn).
     */
    explicit Value( const char * value_r )
    : Value( std::string( value_r ? value_r : "*" ) )
    {}

    /** Ctor from string (FS format, \c "*" represents ANY; \c "-" represents NA)
     * \throws std::invalid_argument if string is malformed.
     */
     Value( const std::string & encoded_r, FsFormatType );

    /** Ctor from string (URI format, \c "" represents ANY; \c "-" represents NA)
     * \throws std::invalid_argument if string is malformed.
     */
     Value( const std::string & encoded_r, UriFormatType );

  public:
    /** Classification of \ref Value types mostly for \ref match (use like 'enum class \ref Type') */
    struct _TypeDef {
      enum Enum {
	ANY,
	NA,
	wildcardfree,
	wildcarded,
      };
    };
    typedef base::EnumClass<_TypeDef> Type;	///< 'enum class Type'

    /** Return the \ref Type of this \ref Value. */
    Type type() const
    {
      if ( !_value ) return Type::ANY;
      if ( _value->empty() ) return Type::NA;
      return( isWildcarded() ? Type::wildcarded : Type::wildcardfree );
    }

    /** Whether value is ANY. ) */
    bool isANY() const
    { return !_value; }

    /** Whether value is NA. ) */
    bool isNA() const
    { return _value && _value->empty(); }

    /** Whether it's a logical value (ANY|NA). */
    bool isLogical() const
    { return !_value || _value->empty(); }
    /** \overload for Type */
    bool isLogical( Type type_r ) const
    { return( type_r == Type::ANY || type_r == Type::NA ); }

    /** Whether it's an attribute value string (not logical value). */
    bool isString() const
    { return _value && !_value->empty(); }
    /** \overload for Type */
    bool isString( Type type_r ) const
    { return( type_r == Type::wildcardfree || type_r == Type::wildcarded ); }

    /** An attribute value string without wildcards (<tt>[*?]</tt> at begin and/or end) */
    bool isWildcardfree() const
    { return isString() && ! containsWildcard(); }

    /** An attribute value string with wildcards (<tt>[*?]</tt> at begin and/or end) */
    bool isWildcarded() const
    { return isString() && containsWildcard(); }

  public:
    /** Default string representation [\ref asWfn]. */
    std::string asString() const
    { return asWfn(); }

    /** String representation as in Well-Formed-Name (ANY:"*", NA:"").
     * \code
     * wfn:[part="a",vendor="opensuse",product="libzypp", version="14\.16\.0",update="beta"]
     * \endcode
     */
    std::string asWfn() const;

    /** String representation as in Formated-String (ANY:"*", NA:"-")
     * \code
     * cpe:2.3:a:opensuse:libzypp:14.16.0:beta:*:*:*:*:*:*
     * \endcode
     */
    std::string asFs() const;

    /** String representation as in URI (ANY:"", NA:"-")
     * \code
     * cpe:/a:opensuse:libzypp:14.16.0:beta
     * \endcode
     */
    std::string asUri() const;

  private:
    friend SetCompare base::SetRelationMixin<Value>::compare( const Value & ) const;
    /** CPE name matching hook for \ref SetRelationMixin */
    SetCompare setRelationMixinCompare( const Value & trg ) const;

    /** HAs unquoted <tt>[*?]</tt> at begin and/or end of value.
     * \note \ref isString() must be asserted!
     */
    bool containsWildcard() const;

  private:
    RWCOW_pointer<std::string> _value;
  };

  SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( CpeId::Value, const char * );
  SETRELATIONMIXIN_DEFINE_COMPARE_BETWEEN( CpeId::Value, const std::string & );

  /** \relates CpeId::Value Stream output */
  std::ostream & operator<<( std::ostream & str, const CpeId::Value & obj );

} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_CPEID_H