Subversion Repositories oidplus

Compare Revisions

No changes between revisions

Regard whitespace Rev 225 → Rev 226

/trunk_oldversion/INFO
0,0 → 1,20
 
This is the first (and last) public release of OIDplus 1.0
 
The project OIDplus 1.0 was used internally at ViaThinkSoft
and was eventually replaced by OIDplus 2.0
 
OIDplus 1.0 is not developed anymore, so please use OIDplus 2.0 instead:
https://oidplus.viathinksoft.com/
 
This code was released after OIDplus 1.0 has already been deprecated for a long time,
because we think that parts of the codes might be still interesting
and we don't want to simply throw it away.
 
OIDplus 1.0 comes with test data that was actually the real ViaThinkSoft database,
but a few confidential things have been removed and some example stuff has been added.
The data was included in the public release to help you better understand
how the database structure and macros work.
 
-- Daniel Marschall 20 March 2020
 
/trunk_oldversion/LICENSE
0,0 → 1,202
 
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
 
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 
1. Definitions.
 
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
 
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
 
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
 
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
 
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
 
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
 
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
 
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
 
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
 
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
 
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
 
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
 
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
 
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
 
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
 
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
 
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
 
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
 
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
 
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
 
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
 
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
 
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
 
END OF TERMS AND CONDITIONS
 
APPENDIX: How to apply the Apache License to your work.
 
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
 
Copyright 2018 Daniel Marschall, ViaThinkSoft
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
/trunk_oldversion/_private/.htaccess
0,0 → 1,25
# https://stackoverflow.com/a/26155051/488539
 
# Redirect to HTTPS
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
 
# Authenticate users only when using HTTPS
<If "%{HTTPS} == 'on'">
AuthType Basic
AuthName "ViaThinkSoft"
AuthUserFile /home/daniel-marschall/.htpasswd
# Prevent this 'Require' directive from overriding any merged previously
<IfVersion >= 2.4>
AuthMerging And
</IfVersion>
Require valid-user
</If>
 
# ---
 
RewriteEngine Off
RewriteOptions Inherit
Options +Indexes
 
/trunk_oldversion/_private/2012todo
0,0 → 1,91
*invisible_when_not_auth
 
auth token anzahl begrenzen um abuse zu verhindern?
 
unicode-identifiers + verifizieren
 
showSource() anders benennen
 
OID line: anzeigen wie viele kinder es darunter gibt
 
Configs
- oidInsivibleWhenAllAttribsAreCondiential
 
[in]*noauth-invisible:yes
 
*described:no
 
< > = link empfehlung?
 
# todo: "father" anzeige bei einer undescribed oid? auch väter die nicht existieren?
# todo: fahter(1) father(2) etc machen bis zu "." beschreiben im baum
# todo: --> aber dann sollte man eine OID als "not described" markieren können, damit meine PEN der ROOT bleibt und nicht "." .
 
viele dinge wie felder oder auch macro-namen sollen case insensitive sein
 
*soa ? soll heißen dass alle auths verloren gehen
# write-auth(dummy) .... geht das auch anders als dummy, z.b. wenn neue ...-auth hinzukommen gibts probleme
 
# todo: kann man '#' auch hinter eine zeile setzen? nö.
 
clsid vererbbar?
 
flags (auch für gui)
- canelled oid
- leaf oid
- draft oid (!)
- invisible (secret) oid
- type: ipv6 etc != index-search-algorithm
 
ein index term soll auch mit "." beginnen dürfen
 
$oid vs $handle (macro) namen ... macros generell ausschließen
 
ascii art possible in den comments?
 
illegale oids (z.b. 3.1) und illegale identifier namen (z.b. 1and1) -- wird überall die OID geprüft (sanitize?)
 
eine oid mit nur [co] oids -- funktioniert da alles?
 
case insensitive attributes? und commandos
 
handel soll nicht als oid gewertet werden in den funktionen
handle soll nun macro heißen
html core
 
derzeit überschreibt ra(2) ra(1). ist das gut? ja!
 
antispam
 
!roots -- listen der wurzeln
 
dyndns auth
 
vts test datenbank erschaffen
 
format dokumentieren und referenzimplementierung veröffenltlichen (todos sammeln)
 
MACROS mit parametern. ?? ist der attrib_name, __1__ ist der erste parameter, __2__ der zweite usw
 
{...} empfehlung für eine oidplus: verknüpfung (html view)
<...> empfehlung für eine externe http verknüpfung (html view)
 
list all: listet auch alle index() felder
 
2.999.1 durch neues format ersetzen
 
::192.168.69.1 soll akzeptiert werden
 
alle eingabebefehle sollen case sensitive sein
 
vts oid admin
 
 
 
htmlview: tokens in cookie
oid:... notation auch erlauben
 
nutzt man die weiterleitungen (rwhois), dann bekommt die superior RA mit, welche authtokens verwendet werden...
 
write auth
 
/trunk_oldversion/_private/2012todo-fut
0,0 → 1,0
oidplus:.2.999.* = alles anziegen?
/trunk_oldversion/_private/TODO_IMP
0,0 → 1,10
 
- mapping übearbeiten. innerhalb der eigenen ra doi und other unterscheiden .und alle oids beschreiben in _genroot.db
 
- <SYSID_INT> und <SYSID_UUID> und <GENROOT> auch in der kompletten zeile ersetzen, sodass man es in texten verwenden kann
 
eingabefehler im request beim webinterface darf nicht in "internal db error" volcanoexception enden
 
95.211.38.42 wird nicht erkannt... warum? man muss "ipv4" davor machen
--> das liegt daran, dass der eigentliche index /32 am ende noch hat
 
/trunk_oldversion/_private/_old_db_design/wip1/oiddb.htm
0,0 → 1,348
<html>
 
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>OIDDB Format</title>
</head>
 
<body>
 
<h1>&quot;OIDDB/0.1&quot; <font color="red">DRAFT</font> file format description and examples</h1>
 
<p>(C) 2012 ViaThinkSoft, Daniel Marschall</p>
 
<h2>Intended purpose</h2>
 
<ul>
<li>This format describes an OID tree resp. a part of an OID
tree</li>
<li>Main purpose: Format for the OID tree viewer &quot;OID
Plus&quot; by ViaThinkSoft, which is intended for smaller
registration authorities who need a simply way to manage
their OID allocations as well as present their tree to
the public</li>
<li>Another purpose can be to create a more simple
alternative to ORS</li>
<li>Maybe the format could be globally describe OIDs as an
open and human readable format, maybe also for
interchanging informations</li>
</ul>
 
<h2>Use cases</h2>
 
<ul>
<li>Easily administrate, delegate and display the tree for a
specific RA</li>
<li>Look up an OID by identifier, unicode label (like ORS) or
by numerical value =&gt; Alternative to ORS</li>
</ul>
 
<h2>Advantages</h2>
 
<ul>
<li>Highly scaleable: No database needed. The &quot;zones&quot;
are working fine just with textfiles, but dynamic
generated records are also OK!</li>
<li>Node can be delegated, which makes this format also
suitable as an alternative to the complex ORS</li>
<li>Format can be extended easily</li>
<li>No individual name server necessary for ORS functionality</li>
<li>HTTPS connections are no problem</li>
<li>File can be easily filtered by &quot;grep&quot; because
every line contains just 1 attribute and contains the OID
&quot;zone&quot;</li>
<li>Simplyness: The main format is simply: &lt;root zone&gt;
&lt;attribute&gt; &lt;params&gt;</li>
</ul>
 
<h2>Disadvantages</h2>
 
<ul>
<li>The FORMAT itself allows also illegal labels etc. The OID
viewer has to check all data for validity</li>
</ul>
 
<h2>Format</h2>
 
<ul>
<li>Each zone file begins with &quot;[OIDDB/0.1]&quot; in the
first line.</li>
<li>Whitespaces at the beginning or end of every line (except
first line) are tolerated</li>
<li>Every line contains either '#' (comment line) or a &lt;zone
record&gt;</li>
<li>Comments cannot be in the same line as a zone record!
They need an separate line.</li>
<li>&lt;zone record&gt; is defined as &lt;zone&gt; &lt;attribute&gt;
&lt;parameters&gt;</li>
<li>&lt;zone&gt; is either an dot-notation OID or &quot;root&quot;
(root is the &quot;zone&quot; which delegates the OIDS 0,
1 and 2).</li>
<li>&lt;attribute&gt; is an attribute in uppercase (see below
for valid attributes and their &lt;parameters&gt;)</li>
<li>Between zone, attribute and parameters there are
whitespaces (but no line break)</li>
<li>If an attribute is unknown by the client, it will be
simply ignored</li>
</ul>
 
<h2>Current list of attributes</h2>
 
<table border="2">
<tr>
<td><strong>Attribute</strong></td>
<td><strong>Inherited from parent</strong></td>
<td><strong>Scope [1]</strong></td>
<td><strong>Parameters</strong></td>
<td><strong>Comments</strong></td>
</tr>
<tr>
<td>SOA (valid for all NIDs)</td>
<td>No</td>
<td>LOCAL RA</td>
<td>None</td>
<td>Place holder if no delegations or attributes are available for this object.</td>
</tr>
<tr>
<td>RA</td>
<td>If not set [3]</td>
<td>LOCAL RA</td>
<td>&quot;&lt;RA contact information, human-readable, '\n'
allowed&gt;&quot;</td>
<td>[7]</td>
</tr>
<tr>
<td>NAME</td>
<td>No</td>
<td>LOCAL RA</td>
<td>&quot;&lt;Single line name resp very short
description&gt;&quot;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>DESCRIPTION</td>
<td>No</td>
<td>LOCAL RA</td>
<td>&quot;&lt;Description and additional information,
human-readable, '\n' allowed&gt;&quot;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>DELEGATION</td>
<td>No</td>
<td>LOCAL RA</td>
<td>&lt;numeric child identifier&gt; &lt;zone file
location [2]&gt;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>PRIVATECHILD</td>
<td>No</td>
<td>LOCAL RA</td>
<td>&lt;numeric child identifier&gt;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>NUMSECRETCHILDREN</td>
<td>No</td>
<td>LOCAL RA</td>
<td>&lt;number of childnodes which are NOT listed as
CHILD or PRIVATECHILD (i.e. their numerical values are
secret)&gt;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>IDENTIFIER</td>
<td>No</td>
<td>SUPERIOR RA</td>
<td>&lt;identifier value, e.g. example&gt; &lt;numeric
child identifier, e.g. 999&gt;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>UNICODELABEL</td>
<td>No</td>
<td>SUPERIOR RA</td>
<td>&lt;Unicode label, e.g. ViaThinkSoft&gt; &lt;numeric
child identifier, e.g. 12345&gt;</td>
<td>[4]</td>
</tr>
<tr>
<td>FLAG-DRAFT</td>
<td>Yes, cannot be unset</td>
<td>SUPERIOR RA</td>
<td>&lt;numeric child identifier&gt;</td>
<td>[5]</td>
</tr>
<tr>
<td>FLAG-LEAF</td>
<td>Yes, cannot be unset</td>
<td>SUPERIOR RA</td>
<td>&lt;numeric child identifier&gt;</td>
<td>[6]</td>
</tr>
</table>
 
<p>Remarks:</p>
 
<ol>
<li>Defines who may change the attribute for a given OID<br>
LOCAL = (Attributes the local RA can change by itself)<br>
SUPERIOR RA = (Attributes only the superior RA can change)</li>
<li>Zone location. There are 3 possibilities:<br>
A) URL where the zone informations of the child are
stored.<br>
<font color="#FF8000">?? should local file references be
accepted ???</font><br>
Relative urls shall be accepted.<br>
Please note: IDNs (Unicode domain name which needs to be
translated into punycode first) shall be accepted by the
client.<br>
FTP URLs shall be accepted.<br>
HTTPS MUST be accepted by the client. Only with HTTPS,
informations can be ensured authorative.<br>
Also note that the URL can be a simple TXT file or a PHP
script which generates the record files from a database
etc. This makes delegation pretty flexible.<br>
B) &quot;&lt;here&gt;&quot; (without quotes), if the zone
informations are stored in the same file<br>
C) &quot;&lt;none&gt;&quot; (without quotes) if no zone
exists yet resp. if the child is a leaf node. But if you want to set a RA, description or name, you have to create a zone for this OID, since the superior OID cannot define these attributes.</li>
<li>If the RA attribute is NOT set locally, it will be
INHERITED from the superior OID! This makes it very easy
for companies who have many OIDs. They only need to
change the RA for children they delegate to another
person/department.</li>
<li>It could be also an longarc definition, e.g. &quot;root
UNICODELABEL Example 2.999&quot;</li>
<li>(Idea by Daniel Marschall) This indicates that the OID is
a draft resp reserved. It can be removed or changed at
ANY TIME. An OID viewer/resolver SHOULD NOT DISPLAY DRAFT-OIDS.
THESE ENTRIES ARE USUALLY PRIVATE FOR THE OID RA, e.g.
when they draft some new software which is needing an
amount of OIDs. An draft OID usually just reserves the
OID from accidently getting overwritten by another OID.</li>
<li>(Like seen at oid-info.com) This indicates that the OID
is a leaf. A parser will stop searching for children,
resp. children are locked</li>
<li>Note that since the TXT file is publicly available
through HTTP(S), the RA contact information cannot be
made private. If you'd like to be private, just don't
enter your address. You can also e.g. publish a handle
number which can be used to contact you resp. a URL to an
online contact form.</li>
</ol>
 
<h2>EXAMPLE 1: USING OID PLUS FOR MANAGING THE WHOLE OID TREE AS
AN ALTERNATIVE FOR ORS</h2>
 
<p>Making ORS easier would mean:</p>
 
<ul>
<li>People without an own nameserver could implement ORS (note
that nearly no public available DNS hosting company
allows customers to create NAPTR records!)</li>
<li>The easier, the faster it is implemented world wide</li>
</ul>
 
<p>In our example of an ORS-alternative, the resolution would start at https://root.ors.example.com/ with the entry "root". It does not matter if the first arc you want to resolve is an numeric identifier, or an alpha identifier or an non-numeric Unicode label.</p>
 
<pre><strong>[OIDDB/0.1]</strong>
 
<font color="#000080"># -------------------------
# ROOT ZONE FILE WHICH DEFINES THE ATTRIBUTES OF THE OIDS 0, 1 AND 2 AS WELL AS LONGARCS
# -------------------------</font>
 
oid: UNICODELABEL ISO 0
oid: IDENTIFIER iso 0
oid: DELEGATION 0 https://iso.example.com/zone_record.php?oid=0
 
oid: IDENTIFIER itu-t 1
oid: IDENTIFIER itu-r 1
oid: IDENTIFIER ccitt 1
oid: DELEGATION 1 https://itu.example.com/zone_1.txt
 
oid: IDENTIFIER joint-iso-itu-t 2
oid: IDENTIFIER joint-iso-ccitt 2
oid: DELEGATION 2 &lt;here&gt;
 
<font color="#000080"># Longarcs</font>
oid: UNICODELABEL Example 2.999
 
<font color="#000080"># -------------------------
# ZONE FILE FOR OID &quot;2&quot;
# -------------------------</font>
 
oid:2 RA &quot;RA information about Joint ISO/ITU-T&quot;
oid:2 DELEGATION 999 &lt;here&gt;
oid:2 FLAG-LEAF 999
 
<font color="#000080"># -------------------------
# ZONE FILE FOR OID &quot;2.999&quot;
# -------------------------</font>
 
oid:2.999 RA &quot;None&quot;
oid:2.999 NAME &quot;Example OID&quot;
oid:2.999 DESCRIPTION &quot;This OID is used as example&quot;</pre>
 
<h2>EXAMPLE 2: HOW A SMALL COMPANY WHICH OWNS THE OID 2.999.1.2.3
COULD MANAGE ITS OID TREE WITH A SINGLE TXT FILE</h2>
 
<p>They simply create this text file and tell &quot;OID Plus&quot;
to use this textfile as root for displaying/querying everything.
Also, the root OIDs have to be specified (2.999.1.2.3)</p>
 
<pre><strong>[OIDDB/0.1]</strong>
 
<font color="#000080"># -------------------------
# ZONE 2.999.1.2.3</font>
<font color="#000080"># -------------------------
</font>
oid:2.999.1.2.3 RA &quot;My company&quot;
oid:2.999.1.2.3 NAME &quot;My company Root OID&quot;
oid:2.999.1.2.3 DESCRIPTION &quot;This is the OID 2.999.1.2.3 owned by My Company!&quot;
oid:2.999.1.2.3 IDENTIFIER four 4
oid:2.999.1.2.3 IDENTIFIER vier 4
oid:2.999.1.2.3 IDENTIFIER quattro 4
oid:2.999.1.2.3 UNICODELABEL FOUR 4
oid:2.999.1.2.3 UNICODELABEL VIER 4
oid:2.999.1.2.3 UNICODELABEL QUATTRO 4
oid:2.999.1.2.3 DELEGATION 4 &lt;here&gt;
oid:2.999.1.2.3 FLAG-LEAF 4
oid:2.999.1.2.3 FLAG-DRAFT 4
 
oid:2.999.1.2.3 PRIVATECHILD 5
oid:2.999.1.2.3 PRIVATECHILD 6
oid:2.999.1.2.3 PRIVATECHILD 7
 
<font color="#000080"># There are 100 secret children, 3 private children (id 5, 6 and 7) and 1 public child (id 4), so 2.999.1.2.3 has 104 child nodes in total</font>
oid:2.999.1.2.3 NUMSECRETCHILDREN 100
 
<font color="#000080"># -------------------------
# ZONE 2.999.1.2.3.4</font>
<font color="#000080"># -------------------------
</font>
oid:2.999.1.2.3.4 NAME &quot;Cup of tea&quot;
oid:2.999.1.2.3.4 DESCRIPTION &quot;This is the OID 2.999.1.2.3.4!&quot;</pre>
 
<p>Beside "oid" there could be also other NIDs like e.g. "clsid" or "doi" which can be also delegated.
Note that the attribute IDs, e.g. unicodelabel are dependent to the NID oid, e.g. the attribute "unicodelabel"
should behave different on a oid than for a clsid.</p>
 
<h2>More ideas / TODO</h2>
 
<ul>
<li>Add more attributes. Research more use cases</li>
<li>Implement client &quot;OID Plus&quot; with real-world
example &quot;ViaThinkSoft RA&quot;</li>
<li>Attribute: Information how to obtain a child</li>
<li>Erweiterung um java-packagenamen auf die selbe weise zu
verwalten</li>
<li>Attributes as OIDs: vmd attribute? identified by attr-oid.
&quot;X&quot; am anfang bei fremden herstellern</li>
<li>Tool that checks the validity of everything (identifier, leaf status etc)</li>
</ul>
</body>
</html>
Property changes:
Added: svn:mime-type
+text/html
\ No newline at end of property
/trunk_oldversion/_private/_old_db_design/wip2/.volcano_db/.htaccess
0,0 → 1,2
Order Deny,Allow
Deny From All
/trunk_oldversion/_private/_old_db_design/wip2/.volcano_db/todo
0,0 → 1,6
# man müsste auch einzelne attribute durch pwd schützen können?
# z.b. ein "note" attribut
# read-auth, note-read-auth, write-auth :-s
 
# FITLER: kommentare filtern!
 
/trunk_oldversion/_private/_old_db_design/wip2/.volcano_db/viathinksoft
0,0 → 1,231
# VIATHINKSOFT CODENAME VOLCANO
# TEST DATABASE
# !!! PROVIDED DATA IS NOT AUTHORATIVE !!!
# !!! CONFIDENTIAL !!!
 
# TODO: oid:.1.3.6 ?
 
# TODO: irgendwie mit vmd merged?
# TODO: attribute irgendwie einzigartig machen? packagename/oid?
 
# --- ViaThinkSoft OIDs ---
oid:1.3.6.1.4.1.37476 delegation 9999 <here>
oid:1.3.6.1.4.1.37476 identifier example 9999
oid:1.3.6.1.4.1.37476 unicodelabel Example 9999
 
oid:1.3.6.1.4.1.37476 delegation 1 <here>
oid:1.3.6.1.4.1.37476 delegation 2 <here>
 
oid:1.3.6.1.4.1.37476.1 identifier members
oid:1.3.6.1.4.1.37476.1 description :Members of ViaThinkSoft
 
oid:1.3.6.1.4.1.37476.2 identifier products
oid:1.3.6.1.4.1.37476.2 description :Products of ViaThinkSoft
 
oid:1.3.6.1.4.1.37476.9999 delegation 1 <here>
oid:1.3.6.1.4.1.37476.9999.1 delegation 2 <here>
oid:1.3.6.1.4.1.37476.9999.1.2 delegation 3 <here>
oid:1.3.6.1.4.1.37476.9999.1.2.3 delegation 4 <here>
oid:1.3.6.1.4.1.37476.9999.1.2.3 description :hello world
oid:1.3.6.1.4.1.37476.9999.1.2.3 description : this is a test
oid:1.3.6.1.4.1.37476.9999.1.2.3 description : another test http://www.example.com/
#oid:1.3.6.1.4.1.37476.9999.1.2.3.4 delegation 5 <here>
 
# --- ViaThinkSoft CLSIDs ---
clsid:viathinksoft delegation decoder <here>
clsid:viathinksoft.decoder delegation {0001} <here>
 
# TODO: clsid:{0001} nicht möglich?
clsid:viathinksoft.decoder.{0001} name Test CLSID
 
# --- ViaThinkSoft Package names ---
packagename:de.viathinksoft delegation example <here>
packagename:de.viathinksoft.example soa
 
# --- ViaThinkSoft DOIs ---
 
# --- ViaThinkSoft MISC ---
misc:viathinksoft delegation members
misc:viathinksoft delegation az
misc:viathinksoft.members
misc:viathinksoft.az
misc:viathinksoft.az.a.2012
 
# --- ViaThinkSoft licenses ---
licmgr:viathinksoft delegation decoder
licmgr:viathinksoft.decoder delegation vclA
licmgr:viathinksoft.decoder license GPL
 
licmgr:viathinksoft.decoder.vclA license LGPL
 
# --- ViaThinkSoft IPv4 delegations ---
 
# TODO: datumsangaben
# TODO: cahost
# TODO: revdns
 
ipv4:de.viathinksoft delegation alpha
ipv4:de.viathinksoft.alpha status cancelled
 
ipv4:de.viathinksoft.alpha delegation 84.16.234.13
ipv4:de.viathinksoft.alpha.84.16.234.13 status cancelled
ipv4:de.viathinksoft.alpha.84.16.234.13 if eth0
ipv4:de.viathinksoft.alpha.84.16.234.13 type ipv4
ipv4:de.viathinksoft.alpha.84.16.234.13 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.234.13 network 84.16.234.0
ipv4:de.viathinksoft.alpha.84.16.234.13 network-cidr 84.16.234.0/24
ipv4:de.viathinksoft.alpha.84.16.234.13 broadcast 84.16.234.255
ipv4:de.viathinksoft.alpha.84.16.234.13 gateway 84.16.234.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 217.20.116.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 217.20.115.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 62.80.2.35
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 213.221.110.235
ipv4:de.viathinksoft.alpha.84.16.234.13 service www
ipv4:de.viathinksoft.alpha.84.16.234.13 service mail
 
ipv4:de.viathinksoft.alpha delegation 84.16.228.116
ipv4:de.viathinksoft.alpha.84.16.228.116 status cancelled
ipv4:de.viathinksoft.alpha.84.16.228.116 if eth0:0
ipv4:de.viathinksoft.alpha.84.16.228.116 type ipv4
ipv4:de.viathinksoft.alpha.84.16.228.116 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.228.116 network 84.16.228.0
ipv4:de.viathinksoft.alpha.84.16.228.116 network-cidr 84.16.228.0/24
ipv4:de.viathinksoft.alpha.84.16.228.116 broadcast 84.16.228.255
ipv4:de.viathinksoft.alpha.84.16.228.116 service ssh
ipv4:de.viathinksoft.alpha.84.16.228.116 service ftp
ipv4:de.viathinksoft.alpha.84.16.228.116 service www
 
ipv4:de.viathinksoft.alpha delegation 84.16.228.117
ipv4:de.viathinksoft.alpha.84.16.228.117 status cancelled
ipv4:de.viathinksoft.alpha.84.16.228.117 if eth0:1
ipv4:de.viathinksoft.alpha.84.16.228.117 type ipv4
ipv4:de.viathinksoft.alpha.84.16.228.117 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.228.117 network 84.16.228.0
ipv4:de.viathinksoft.alpha.84.16.228.117 network-cidr 84.16.228.0/24
ipv4:de.viathinksoft.alpha.84.16.228.117 broadcast 84.16.228.255
ipv4:de.viathinksoft.alpha.84.16.228.117 service www
 
ipv4:de.viathinksoft delegation beta
ipv4:de.viathinksoft.beta status cancelled
 
ipv4:de.viathinksoft.beta delegation 89.149.253.178
ipv4:de.viathinksoft.beta.89.149.253.178 status cancelled
ipv4:de.viathinksoft.beta.89.149.253.178 if eth1
ipv4:de.viathinksoft.beta.89.149.253.178 type ipv4
ipv4:de.viathinksoft.beta.89.149.253.178 netmask 255.255.255.0
ipv4:de.viathinksoft.beta.89.149.253.178 network 89.149.253.0
ipv4:de.viathinksoft.beta.89.149.253.178 network-cidr 89.149.253.0/24
ipv4:de.viathinksoft.beta.89.149.253.178 broadcast 89.149.253.255
ipv4:de.viathinksoft.beta.89.149.253.178 gateway 89.149.253.1
ipv4:de.viathinksoft.beta.89.149.253.178 dns-nameserver 217.20.116.1
ipv4:de.viathinksoft.beta.89.149.253.178 dns-nameserver 217.20.115.1
ipv4:de.viathinksoft.beta.89.149.253.178 service www
ipv4:de.viathinksoft.beta.89.149.253.178 service ftp
ipv4:de.viathinksoft.beta.89.149.253.178 service ssh
ipv4:de.viathinksoft.beta.89.149.253.178 service mail
 
ipv4:de.viathinksoft delegation gamma
ipv4:de.viathinksoft.gamma status active
 
ipv4:de.viathinksoft.gamma delegation 95.211.38.42
ipv4:de.viathinksoft.gamma.95.211.38.42 status active
ipv4:de.viathinksoft.gamma.95.211.38.42 if eth0
ipv4:de.viathinksoft.gamma.95.211.38.42 type ipv4
ipv4:de.viathinksoft.gamma.95.211.38.42 netmask 255.255.255.224
ipv4:de.viathinksoft.gamma.95.211.38.42 network 95.211.38.32
ipv4:de.viathinksoft.gamma.95.211.38.42 network-cidr 95.211.38.32/27
ipv4:de.viathinksoft.gamma.95.211.38.42 broadcast 95.211.38.63
ipv4:de.viathinksoft.gamma.95.211.38.42 gateway 95.211.38.62
ipv4:de.viathinksoft.gamma.95.211.38.42 dns-nameserver 62.212.65.123
ipv4:de.viathinksoft.gamma.95.211.38.42 dns-nameserver 62.212.64.122
ipv4:de.viathinksoft.gamma.95.211.38.42 revdns viathinksoft.de
ipv4:de.viathinksoft.gamma.95.211.38.42 service www
ipv4:de.viathinksoft.gamma.95.211.38.42 service mail
 
ipv4:de.viathinksoft.gamma delegation 95.211.38.108
ipv4:de.viathinksoft.gamma.95.211.38.108 status active
ipv4:de.viathinksoft.gamma.95.211.38.108 confidential
ipv4:de.viathinksoft.gamma.95.211.38.108 network-cidr 95.211.38.96/27
ipv4:de.viathinksoft.gamma.95.211.38.108 if eth0:1
ipv4:de.viathinksoft.gamma.95.211.38.108 type ipv4
ipv4:de.viathinksoft.gamma.95.211.38.108 netmask 255.255.255.224
ipv4:de.viathinksoft.gamma.95.211.38.108 network 95.211.38.96
ipv4:de.viathinksoft.gamma.95.211.38.108 broadcast 95.211.38.127
ipv4:de.viathinksoft.gamma.95.211.38.108 gateway 95.211.38.126
ipv4:de.viathinksoft.gamma.95.211.38.108 dns-nameserver 62.212.65.123
ipv4:de.viathinksoft.gamma.95.211.38.108 dns-nameserver 62.212.64.122
# TODO: ändern?
# ipv4:de.viathinksoft.gamma.95.211.38.108 revdns ssh.viathinksoft.de
ipv4:de.viathinksoft.gamma.95.211.38.108 revdns hosted-by.leaseweb.com
ipv4:de.viathinksoft.gamma.95.211.38.108 service ssh
 
# --- ViaThinkSoft IPv6 delegations ---
 
ipv6:de.viathinksoft.gamma delegation 2001:1af8:4100:a061:1::/112
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 name ViaThinkSoft IPv6 Rack address space (in 2001:1af8:4100:a061::/64 net)
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 type ipv6-net
 
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 delegation 2001:1af8:4100:a061:1::1337/128
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 status active
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 assignment daniel-marschall@viathinksoft.de 2012-02-22
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 if eth0
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 type ipv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 netmask 64
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 gateway 2001:1af8:4100:a061::1
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 name ViaThinkSoft Main IPv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 revdns ipv6.viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 service www
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 service mail
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 cahost viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 cahost www.viathinksoft.de
 
# TODO: read/write auth... multi auth entries ...? jedes element ein anderer auth.
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 delegation 2001:1af8:4100:a061:1::4041/128
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 read-auth plain:vierzig
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 read-auth MD5:
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 status active
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 confidential
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 assignment daniel-marschall@viathinksoft.de 2012-02-26
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 if eth0
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 type ipv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 netmask 64
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 gateway 2001:1af8:4100:a061::1
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 name ViaThinkSoft Auth IPv6
# TODO: ändern?
# ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 revdns ssh.viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 service ssh
 
# --- ViaThinkSoft domain managment ---
 
# TODO uvst
# TODO: projektorientierte anordnung
 
# 1&1
domain: delegation de.viathinksoft
 
# Speedbone
domain: delegation de.personal-webbase
domain: delegation de.md-technologie
domain: delegation de.md-technology
domain: delegation com.viathinksoft
domain: delegation com.personal-webbase
 
& United Domains
domain: delegation de.gegen-killerspiele
 
# --- ViaThinkSoft CA managment ---
 
# --- ViaThinkSoft Aktenzeichen ---
 
# --- Human Resources ---
 
hr:de.viathinksoft soa
hr:de.viathinksoft delegation marschall
hr:de.viathinksoft.marschall short ma
hr:de.viathinksoft delegation vn
 
 
# TODO: <here> optional?
# TODO: problem bei nicht-präfix delegation (z.b. clsid, ipv6)
# TODO: wie informationen geheim halten?
 
/trunk_oldversion/_private/_old_db_design/wip2/filter.php
0,0 → 1,122
<?php
 
# todo: via post erhalten
$cfg_auth_passwords = array();
$cfg_auth_passwords[] = 'marie,marie';
$cfg_auth_passwords[] = 'vierzig';
$cfg_auth_passwords[] = 'johnl17';
 
if (!headers_sent()) header('Content-Type: text/plain');
echo output(__DIR__ . '/.volcano_db/*', $cfg_auth_passwords);
 
# ---
 
# todo fut: oop
function check_auth($auth_passwords, $auth_objs) {
foreach ($auth_objs as &$auth_obj) {
$auth_method = $auth_obj[0];
$auth_data = $auth_obj[1];
 
$auth_method = strtolower($auth_method);
 
foreach ($auth_passwords as $p) {
if ($auth_method == 'plain') {
if ($p == $auth_data) return true;
} else if ($auth_method == 'md5') {
if (md5($p) == strtolower($auth_data)) return true;
} else if ($auth_method == 'md5-salt') {
$auth_data_ary = explode(':', $auth_data, 2);
$auth_data_salt = $auth_data_ary[0];
$auth_data_hash = $auth_data_ary[1];
if (md5($auth_data_salt.$p) == strtolower($auth_data_hash)) return true;
} else if ($auth_method == 'sha1') {
if (sha1($p) == strtolower($auth_data)) return true;
} else if ($auth_method == 'sha1-salt') {
$auth_data_ary = explode(':', $auth_data, 2);
$auth_data_salt = $auth_data_ary[0];
$auth_data_hash = $auth_data_ary[1];
if (sha1($auth_data_salt.$p) == strtolower($auth_data_hash)) return true;
} else {
# todo exception
}
}
unset($p);
}
 
return false;
}
 
function output($wildcard, $cfg_auth_passwords = array()) {
$file = file_glob($wildcard, FILE_IGNORE_NEW_LINES);
 
$auth_array = array();
foreach ($file as &$f) {
preg_match_all('@^\s*([^:\s]+):(\S*)(\.){0,1}([^.\s]*)\s+READ-AUTH\s+([^:\s]+):(\S+)\s*$@isU', $f, $m, PREG_SET_ORDER);
 
foreach ($m as $x) {
$nid = $x[1];
$parent = $x[2];
$dot = $x[3];
$child = $x[4];
$auth_method = $x[5];
$auth_data = $x[6];
 
$regex = '';
if ($parent == '' && $child == '') {
$regex = '@^\s*'.preg_quote($nid, '@').':(.*)$@isU';
$replace = '# CONFIDENTIAL MATERIAL REDACTED DUE TO MISSING AUTHENTIFICATION';
$auth_array[$regex][$replace][] = array($auth_method, $auth_data);
} else {
$regex = '@^\s*('.preg_quote($nid, '@').':'.preg_quote($parent, '@').')\s+(DELEGATION)\s+('.preg_quote($child, '@').')(|\s+.*)$@isU';
# todo option ob man delegation pub oder nicht pub machen will
$replace = '\1 \2 ???';
$auth_array[$regex][$replace][] = array($auth_method, $auth_data);
 
$regex = '@^\s*'.preg_quote($nid, '@').':'.preg_quote($parent.$dot.$child, '@').'\s+(.*)$@isU';
$replace = '# CONFIDENTIAL MATERIAL REDACTED DUE TO MISSING AUTHENTIFICATION';
$auth_array[$regex][$replace][] = array($auth_method, $auth_data);
}
}
}
 
global $cfg_auth_passwords;
 
$forbidden_regex = array();
foreach ($auth_array as $search => &$tmp1) {
foreach ($tmp1 as $replace => &$auth_objs) {
if (!check_auth($cfg_auth_passwords, $auth_objs)) {
$forbidden_regex[$search] = $replace;
}
}
}
 
var_dump($forbidden_regex);
 
foreach ($file as &$f) {
foreach ($forbidden_regex as $search => &$replace) {
$num = 0;
$f = preg_replace($search, $replace, $f, -1, $num);
if ($num > 0) {echo '!!!'; break;}
}
}
 
return implode("\n", $file);
}
 
function file_glob($wildcard, $flags = 0, $context = null) {
$files = glob($wildcard);
sort($files);
 
$res = array();
foreach ($files as $file) {
$bn = basename($file);
if ($bn[0] == '.') continue; // ., .., or .htaccess
$res = array_merge($res, file($file, $flags, $context));
}
unset($file);
unset($files);
 
return $res;
}
 
?>
/trunk_oldversion/_private/_old_db_design/wip2/index.php
0,0 → 1,119
<?php
 
# Volcano Format
 
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED);
 
class VOF_Category {
public $nid;
public $localrootElement;
public $localrootFile;
public $authrootElement;
public $authrootFile;
 
public function __construct($nid, $localrootElement, $localrootFile, $authrootElement, $authrootFile) {
$this->nid = $nid;
$this->localrootElement = $localrootElement;
$this->localrootFile = $localrootFile;
$this->authrootElement = $authrootElement;
$this->authrootFile = $authrootFile;
}
}
 
$categories = array();
include __DIR__ . '/local_config.inc.php';
 
 
 
# Aufruf:
# nid, obj, route[]
print_r(show_obj('1.3.6.1.4.1.37476.9999.1.2.3.4', 'oid', array(
'1.3.6.1.4.1.37476',
'1.3.6.1.4.1.37476.9999',
'1.3.6.1.4.1.37476.9999.1',
'1.3.6.1.4.1.37476.9999.1.2',
'1.3.6.1.4.1.37476.9999.1.2.3'
)));
die();
 
 
 
$req_cat = $_GET['cat']; # todo als hash (nid, localelement)
$req_obj = $_GET['obj'];
 
if ($req_cat == '') {
// List all categories
list_nids();
} else {
// List specific object
$cat = get_cat($req_cat);
$title = $cat->nid . ' - ' . $req_obj;
echo "<h1>$title</h1>";
$localRoot = $cat->localrootElement;
}
 
function list_nids($categories) {
echo '<ul>';
foreach ($categories as $x) {
$id = cat_id($x);
$desc = $x->nid;
echo '<li><a href="?cat='.$id.'">'.$desc.'</a></li>';
}
echo '</ul>';
}
 
function cat_id($cat) {
return sha1($cat->nid.':'.$cat->localrootElement);
}
 
function get_cat($categoryId, $categories) {
foreach ($categories as $cat) {
if ($categoryId == cat_id($cat)) return $cat;
}
return false;
}
 
 
function show_obj($obj, $nid, $route) {
global $categories;
foreach ($categories as $c) {
if (($c->nid == $nid) && ($c->localrootElement == $route[0])) {
$cur_obj = $c->localrootElement;
$cur_fil = $c->localrootFile;
}
}
if (!isset($cur_obj)) return false;
if (!isset($cur_fil)) return false;
 
foreach ($route as $i => $r) {
if ($i == 0) continue;
$x = search_delegation_file($cur_fil, $nid, $cur_obj, $r);
if ($x === false) return false;
if ($x != '') $cur_file = $x;
$cur_obj = $r;
}
 
return array($cur_fil, $cur_obj);
}
 
function search_delegation_file($file, $nid, $rootobj, $childobj) {
$cont = file($file); # todo: cache
 
echo "R=$rootobj, C=$childobj => ";
if (substr($childobj.'.', 0, strlen($rootobj)+1) == $rootobj.'.') {
$childobj = substr($childobj, strlen($rootobj)+1);
}
echo "$childobj\n";
 
foreach ($cont as $c) {
preg_match_all("@^\s*$nid:$rootobj\s+delegation\s+$childobj\s*(.+)\$@", $c, $m);
if (!isset($m[1][0])) continue;
$x = $m[1][0];
$x = trim($x);
if ($x == '<here>') $x = '';
return $x;
}
return false;
}
 
?>
/trunk_oldversion/_private/_old_db_design/wip2/local_config.inc.php
0,0 → 1,6
<?php
 
$categories = array();
$categories[] = new VOF_Category('oid', '1.3.6.1.4.1.37476', __DIR__.'/viathinksoft', '', 'http://www.example.com/optional_auth_dummy');
 
?>
/trunk_oldversion/_private/_old_db_design/wip3/db
0,0 → 1,266
# VIATHINKSOFT CODENAME VOLCANO
# TEST DATABASE
# !!! PROVIDED DATA IS NOT AUTHORATIVE !!!
# !!! CONFIDENTIAL !!!
 
# TODO: feldtest, attribute auch mit oids / mergen mit vmd?
 
 
 
 
 
 
.1.3.6.1.4.1.37476 desc:ViaThinkSoft Root
 
.1.3.6.1.4.1.37476.30 identifier:oidplus
.1.3.6.1.4.1.37476.30 desc:OID+ Information Objects for ViaThinkSoft
 
.1.3.6.1.4.1.37476.30.1 type:domains
.1.3.6.1.4.1.37476.30.1 desc:Domains controlled by ViaThinkSoft
 
.1.3.6.1.4.1.37476.30.1.1 desc:Registered at prosite.de
 
.1.3.6.1.4.1.37476.30.1.1.1 desc:Account viathinksoft.com
 
.1.3.6.1.4.1.37476.30.1.1.1.1 desc:ViaThinkSoft
 
.1.3.6.1.4.1.37476.30.1.1.1.1.1 desc:viathinksoft.com
.1.3.6.1.4.1.37476.30.1.1.1.1.1 price(eur/month):1
.1.3.6.1.4.1.37476.30.1.1.1.1.1 search(str):viathinksoft.com
.1.3.6.1.4.1.37476.30.1.1.1.1.1 ssl
 
 
.1.3.6.1.4.1.37476.30.2 type:ipv4
 
 
 
2.999.0 id:IPv4 192.168.69.0/24
2.999.0.1 id:IPv4 192.168.69.1/32
 
2.999.0 desc product A
2.999.0.1 id:CLSID {abc}
2.999.0.2 id:CLSID {def}
2.999.0.2 ref whois://vts.de
 
 
 
 
 
# --- ViaThinkSoft OIDs ---
1.3.6.1.4.1.37476 delegation 9999 <here>
1.3.6.1.4.1.37476 identifier example 9999
1.3.6.1.4.1.37476 unicodelabel Example 9999
 
1.3.6.1.4.1.37476 delegation 1 <here>
1.3.6.1.4.1.37476 delegation 2 <here>
 
1.3.6.1.4.1.37476.1 identifier members
1.3.6.1.4.1.37476.1 description :Members of ViaThinkSoft
 
1.3.6.1.4.1.37476.2 identifier products
1.3.6.1.4.1.37476.2 description :Products of ViaThinkSoft
 
1.3.6.1.4.1.37476.9999 delegation 1 <here>
1.3.6.1.4.1.37476.9999.1 delegation 2 <here>
1.3.6.1.4.1.37476.9999.1.2 delegation 3 <here>
1.3.6.1.4.1.37476.9999.1.2.3 delegation 4 <here>
1.3.6.1.4.1.37476.9999.1.2.3 description :hello world
1.3.6.1.4.1.37476.9999.1.2.3 description : this is a test
1.3.6.1.4.1.37476.9999.1.2.3 description : another test http://www.example.com/
#1.3.6.1.4.1.37476.9999.1.2.3.4 delegation 5 <here>
 
# --- ViaThinkSoft CLSIDs ---
clsid:viathinksoft delegation decoder <here>
clsid:viathinksoft.decoder delegation {0001} <here>
 
# TODO: clsid:{0001} nicht möglich?
clsid:viathinksoft.decoder.{0001} name Test CLSID
 
# --- ViaThinkSoft Package names ---
packagename:de.viathinksoft delegation example <here>
packagename:de.viathinksoft.example soa
 
# --- ViaThinkSoft DOIs ---
 
# --- ViaThinkSoft MISC ---
misc:viathinksoft delegation members
misc:viathinksoft delegation az
misc:viathinksoft.members
misc:viathinksoft.az
misc:viathinksoft.az.a.2012
 
# --- ViaThinkSoft licenses ---
licmgr:viathinksoft delegation decoder
licmgr:viathinksoft.decoder delegation vclA
licmgr:viathinksoft.decoder license GPL
 
licmgr:viathinksoft.decoder.vclA license LGPL
 
# --- ViaThinkSoft IPv4 delegations ---
 
# TODO: datumsangaben
# TODO: cahost
# TODO: revdns
 
ipv4:de.viathinksoft delegation alpha
ipv4:de.viathinksoft.alpha status cancelled
 
ipv4:de.viathinksoft.alpha delegation 84.16.234.13
ipv4:de.viathinksoft.alpha.84.16.234.13 status cancelled
ipv4:de.viathinksoft.alpha.84.16.234.13 if eth0
ipv4:de.viathinksoft.alpha.84.16.234.13 type ipv4
ipv4:de.viathinksoft.alpha.84.16.234.13 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.234.13 network 84.16.234.0
ipv4:de.viathinksoft.alpha.84.16.234.13 network-cidr 84.16.234.0/24
ipv4:de.viathinksoft.alpha.84.16.234.13 broadcast 84.16.234.255
ipv4:de.viathinksoft.alpha.84.16.234.13 gateway 84.16.234.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 217.20.116.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 217.20.115.1
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 62.80.2.35
ipv4:de.viathinksoft.alpha.84.16.234.13 dns-nameserver 213.221.110.235
ipv4:de.viathinksoft.alpha.84.16.234.13 service www
ipv4:de.viathinksoft.alpha.84.16.234.13 service mail
 
ipv4:de.viathinksoft.alpha delegation 84.16.228.116
ipv4:de.viathinksoft.alpha.84.16.228.116 status cancelled
ipv4:de.viathinksoft.alpha.84.16.228.116 if eth0:0
ipv4:de.viathinksoft.alpha.84.16.228.116 type ipv4
ipv4:de.viathinksoft.alpha.84.16.228.116 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.228.116 network 84.16.228.0
ipv4:de.viathinksoft.alpha.84.16.228.116 network-cidr 84.16.228.0/24
ipv4:de.viathinksoft.alpha.84.16.228.116 broadcast 84.16.228.255
ipv4:de.viathinksoft.alpha.84.16.228.116 service ssh
ipv4:de.viathinksoft.alpha.84.16.228.116 service ftp
ipv4:de.viathinksoft.alpha.84.16.228.116 service www
 
ipv4:de.viathinksoft.alpha delegation 84.16.228.117
ipv4:de.viathinksoft.alpha.84.16.228.117 status cancelled
ipv4:de.viathinksoft.alpha.84.16.228.117 if eth0:1
ipv4:de.viathinksoft.alpha.84.16.228.117 type ipv4
ipv4:de.viathinksoft.alpha.84.16.228.117 netmask 255.255.255.0
ipv4:de.viathinksoft.alpha.84.16.228.117 network 84.16.228.0
ipv4:de.viathinksoft.alpha.84.16.228.117 network-cidr 84.16.228.0/24
ipv4:de.viathinksoft.alpha.84.16.228.117 broadcast 84.16.228.255
ipv4:de.viathinksoft.alpha.84.16.228.117 service www
 
ipv4:de.viathinksoft delegation beta
ipv4:de.viathinksoft.beta status cancelled
 
ipv4:de.viathinksoft.beta delegation 89.149.253.178
ipv4:de.viathinksoft.beta.89.149.253.178 status cancelled
ipv4:de.viathinksoft.beta.89.149.253.178 if eth1
ipv4:de.viathinksoft.beta.89.149.253.178 type ipv4
ipv4:de.viathinksoft.beta.89.149.253.178 netmask 255.255.255.0
ipv4:de.viathinksoft.beta.89.149.253.178 network 89.149.253.0
ipv4:de.viathinksoft.beta.89.149.253.178 network-cidr 89.149.253.0/24
ipv4:de.viathinksoft.beta.89.149.253.178 broadcast 89.149.253.255
ipv4:de.viathinksoft.beta.89.149.253.178 gateway 89.149.253.1
ipv4:de.viathinksoft.beta.89.149.253.178 dns-nameserver 217.20.116.1
ipv4:de.viathinksoft.beta.89.149.253.178 dns-nameserver 217.20.115.1
ipv4:de.viathinksoft.beta.89.149.253.178 service www
ipv4:de.viathinksoft.beta.89.149.253.178 service ftp
ipv4:de.viathinksoft.beta.89.149.253.178 service ssh
ipv4:de.viathinksoft.beta.89.149.253.178 service mail
 
ipv4:de.viathinksoft delegation gamma
ipv4:de.viathinksoft.gamma status active
 
ipv4:de.viathinksoft.gamma delegation 95.211.38.42
ipv4:de.viathinksoft.gamma.95.211.38.42 status active
ipv4:de.viathinksoft.gamma.95.211.38.42 if eth0
ipv4:de.viathinksoft.gamma.95.211.38.42 type ipv4
ipv4:de.viathinksoft.gamma.95.211.38.42 netmask 255.255.255.224
ipv4:de.viathinksoft.gamma.95.211.38.42 network 95.211.38.32
ipv4:de.viathinksoft.gamma.95.211.38.42 network-cidr 95.211.38.32/27
ipv4:de.viathinksoft.gamma.95.211.38.42 broadcast 95.211.38.63
ipv4:de.viathinksoft.gamma.95.211.38.42 gateway 95.211.38.62
ipv4:de.viathinksoft.gamma.95.211.38.42 dns-nameserver 62.212.65.123
ipv4:de.viathinksoft.gamma.95.211.38.42 dns-nameserver 62.212.64.122
ipv4:de.viathinksoft.gamma.95.211.38.42 revdns viathinksoft.de
ipv4:de.viathinksoft.gamma.95.211.38.42 service www
ipv4:de.viathinksoft.gamma.95.211.38.42 service mail
 
ipv4:de.viathinksoft.gamma delegation 95.211.38.108
ipv4:de.viathinksoft.gamma.95.211.38.108 status active
ipv4:de.viathinksoft.gamma.95.211.38.108 confidential
ipv4:de.viathinksoft.gamma.95.211.38.108 network-cidr 95.211.38.96/27
ipv4:de.viathinksoft.gamma.95.211.38.108 if eth0:1
ipv4:de.viathinksoft.gamma.95.211.38.108 type ipv4
ipv4:de.viathinksoft.gamma.95.211.38.108 netmask 255.255.255.224
ipv4:de.viathinksoft.gamma.95.211.38.108 network 95.211.38.96
ipv4:de.viathinksoft.gamma.95.211.38.108 broadcast 95.211.38.127
ipv4:de.viathinksoft.gamma.95.211.38.108 gateway 95.211.38.126
ipv4:de.viathinksoft.gamma.95.211.38.108 dns-nameserver 62.212.65.123
ipv4:de.viathinksoft.gamma.95.211.38.108 dns-nameserver 62.212.64.122
# TODO: ändern?
# ipv4:de.viathinksoft.gamma.95.211.38.108 revdns ssh.viathinksoft.de
ipv4:de.viathinksoft.gamma.95.211.38.108 revdns hosted-by.leaseweb.com
ipv4:de.viathinksoft.gamma.95.211.38.108 service ssh
 
# --- ViaThinkSoft IPv6 delegations ---
 
ipv6:de.viathinksoft.gamma delegation 2001:1af8:4100:a061:1::/112
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 name ViaThinkSoft IPv6 Rack address space (in 2001:1af8:4100:a061::/64 net)
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 type ipv6-net
 
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 delegation 2001:1af8:4100:a061:1::1337/128
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 status active
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 assignment daniel-marschall@viathinksoft.de 2012-02-22
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 if eth0
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 type ipv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 netmask 64
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 gateway 2001:1af8:4100:a061::1
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 name ViaThinkSoft Main IPv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 revdns ipv6.viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 service www
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 service mail
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 cahost viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::1337/128 cahost www.viathinksoft.de
 
# TODO: read/write auth... multi auth entries ...? jedes element ein anderer auth.
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112 delegation 2001:1af8:4100:a061:1::4041/128
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 read-auth plain:vierzig
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 read-auth MD5:
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 status active
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 confidential
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 assignment daniel-marschall@viathinksoft.de 2012-02-26
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 if eth0
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 type ipv6
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 netmask 64
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 gateway 2001:1af8:4100:a061::1
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 name ViaThinkSoft Auth IPv6
# TODO: ändern?
# ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 revdns ssh.viathinksoft.de
ipv6:de.viathinksoft.gamma.2001:1af8:4100:a061:1::/112.2001:1af8:4100:a061:1::4041/128 service ssh
 
# --- ViaThinkSoft domain managment ---
 
# TODO uvst
# TODO: projektorientierte anordnung
 
# 1&1
domain: delegation de.viathinksoft
 
# Speedbone
domain: delegation de.personal-webbase
domain: delegation de.md-technologie
domain: delegation de.md-technology
domain: delegation com.viathinksoft
domain: delegation com.personal-webbase
 
# --- ViaThinkSoft CA managment ---
 
# --- ViaThinkSoft Aktenzeichen ---
 
# --- Human Resources ---
 
hr:de.viathinksoft soa
hr:de.viathinksoft delegation marschall
hr:de.viathinksoft.marschall short ma
hr:de.viathinksoft delegation vn
 
 
# TODO: <here> optional?
# TODO: problem bei nicht-präfix delegation (z.b. clsid, ipv6)
# TODO: wie informationen geheim halten?
 
/trunk_oldversion/_private/_old_db_design/wip4/db
0,0 → 1,254
# VIATHINKSOFT CODENAME VOLCANO
# TEST DATABASE
# !!! PROVIDED DATA IS NOT AUTHORATIVE !!!
# !!! CONFIDENTIAL !!!
 
# TODO alles updaten und mit offiziellen VTS daten bestücken
 
# todo domain ssl datasets
 
.1.3.6.1.4.1.37476 description:ViaThinkSoft Root
 
.1.3.6.1.4.1.37476.30 identifier:oidplus
.1.3.6.1.4.1.37476.30 description:OID+ Information Objects for ViaThinkSoft
 
# --- DOMAINS
 
.1.3.6.1.4.1.37476.30.1 type:domains
.1.3.6.1.4.1.37476.30.1 description:Domains controlled by ViaThinkSoft
 
.1.3.6.1.4.1.37476.30.1.1 description:Registered at prosite.de
.1.3.6.1.4.1.37476.30.1.1.1 description:Account viathinksoft.com
.1.3.6.1.4.1.37476.30.1.1.1.1 identifier:de
.1.3.6.1.4.1.37476.30.1.1.1.1 description:Sub-identifiers are the crc32 values of the full domain name. In case of a conflict, the next free available OID is used.
.1.3.6.1.4.1.37476.30.1.1.1.1 allocation-mech:crc32(domain)/conflict=+1
.1.3.6.1.4.1.37476.30.1.1.1.2 identifier:com
.1.3.6.1.4.1.37476.30.1.1.1.2 description:Sub-identifiers are the crc32 values of the full domain name. In case of a conflict, the next free available OID is used.
.1.3.6.1.4.1.37476.30.1.1.1.2 allocation-mech:crc32(domain)/conflict=+1
 
.1.3.6.1.4.1.37476.30.1.2 description:Registered at Strato
.1.3.6.1.4.1.37476.30.1.2.1 description:Account of Michael Düpjohann
.1.3.6.1.4.1.37476.30.1.2.1.1 identifier:de
.1.3.6.1.4.1.37476.30.1.2.1.1 description:Sub-identifiers are the crc32 values of the full domain name. In case of a conflict, the next free available OID is used.
.1.3.6.1.4.1.37476.30.1.2.1.1 allocation-mech:crc32(domain)/conflict=+1
 
.1.3.6.1.4.1.37476.30.1.3 description:Registered at United Domains
.1.3.6.1.4.1.37476.30.1.3.1 description:Account of ViaThinkSoft
.1.3.6.1.4.1.37476.30.1.3.1.1 identifier:de
.1.3.6.1.4.1.37476.30.1.3.1.1 description:Sub-identifiers are the crc32 values of the full domain name. In case of a conflict, the next free available OID is used.
.1.3.6.1.4.1.37476.30.1.3.1.1 allocation-mech:crc32(domain)/conflict=+1
 
.1.3.6.1.4.1.37476.30.1.4 description:Registered at 1&1
.1.3.6.1.4.1.37476.30.1.4.1 description:Account of ViaThinkSoft
.1.3.6.1.4.1.37476.30.1.4.1.1 identifier:de
.1.3.6.1.4.1.37476.30.1.4.1.1 description:Sub-identifiers are the crc32 values of the full domain name. In case of a conflict, the next free available OID is used.
.1.3.6.1.4.1.37476.30.1.4.1.1 allocation-mech:crc32(domain)/conflict=+1
 
# --- Network (IPv4, IPv6)
 
.1.3.6.1.4.1.37476.30.2 type:network
 
# --- ViaThinkSoft OIDs ---
 
.1.3.6.1.4.1.37476.1 identifier:members
.1.3.6.1.4.1.37476.1 description:Members of ViaThinkSoft
 
.1.3.6.1.4.1.37476.2 identifier:products
.1.3.6.1.4.1.37476.2 description:Products of ViaThinkSoft
 
.1.3.6.1.4.1.37476.9999 identifier:example
.1.3.6.1.4.1.37476.9999 unicodelabel:Example
 
# --- ViaThinkSoft CLSIDs ---
 
.1.3.6.1.4.1.37476.30.3 type:clsid
 
.1.3.6.1.4.1.37476.30.3.999 identifier:example
 
.1.3.6.1.4.1.37476.30.3.999.1 identifier:myclsid
.1.3.6.1.4.1.37476.30.3.999.1 search(clsid):{0001}
 
# --- ViaThinkSoft Package names ---
#packagename:de.viathinksoft delegation example
#packagename:de.viathinksoft.example soa
 
# --- ViaThinkSoft DOIs ---
 
# --- ViaThinkSoft Package names ---
 
# --- ViaThinkSoft MISC ---
#misc:viathinksoft.members
#misc:viathinksoft.az
#misc:viathinksoft.az.a.2012
 
# --- ViaThinkSoft licenses ---
#licmgr:viathinksoft delegation decoder
#licmgr:viathinksoft.decoder license:GPL
 
#licmgr:viathinksoft.decoder.vclA license LGPL
 
# --- ViaThinkSoft IPv4 delegations ---
 
# TODO: datumsangaben
# TODO: cahost
# TODO: revdns
 
.1.3.6.1.4.1.37476.30.2.1 description:netdirekt e.K.
.1.3.6.1.4.1.37476.30.2.1.1 description:Customer ViaThinkSoft
.1.3.6.1.4.1.37476.30.2.1.1.1 description:Server Alpha
.1.3.6.1.4.1.37476.30.2.1.1.1 status:cancelled
 
.1.3.6.1.4.1.37476.30.2.1.1.1.4 identifier:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.1.4 allocation-mech:crc32(cidr)/conflict=+1
 
# TODO network cidr unterkategorie
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 cidr:84.16.234.13/32
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 status:cancelled
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 if:eth0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 type:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 netmask:255.255.255.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 network:84.16.234.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 network-cidr:84.16.234.0/24
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 broadcast:84.16.234.255
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 gateway:84.16.234.1
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 dns-nameserver:217.20.116.1
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 dns-nameserver:217.20.115.1
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 dns-nameserver:62.80.2.35
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 dns-nameserver:213.221.110.235
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 service:www
.1.3.6.1.4.1.37476.30.2.1.1.1.4.715489493 service:mail
 
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 cidr:84.16.228.116/32
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 status:cancelled
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 if:eth0:0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 type:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 netmask:255.255.255.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 network:84.16.228.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 network-cidr:84.16.228.0/24
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 broadcast:84.16.228.255
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 service:ssh
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 service:ftp
.1.3.6.1.4.1.37476.30.2.1.1.1.4.4150533370 service:www
 
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 cidr:84.16.228.117/32
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 status:cancelled
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 if:eth0:1
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 type:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 netmask:255.255.255.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 network:84.16.228.0
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 network-cidr:84.16.228.0/24
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 broadcast:84.16.228.255
.1.3.6.1.4.1.37476.30.2.1.1.1.4.1339587487 service:www
 
.1.3.6.1.4.1.37476.30.2.1.1.2 description:Server Beta
.1.3.6.1.4.1.37476.30.2.1.1.2 status:cancelled
 
.1.3.6.1.4.1.37476.30.2.1.1.2.4 identifier:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.2.4 allocation-mech:crc32(cidr)/conflict=+1
 
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 cidr:89.149.253.178/32
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 status:cancelled
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 if:eth1
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 type:ipv4
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 netmask:255.255.255.0
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 network:89.149.253.0
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 network-cidr:89.149.253.0/24
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 broadcast:89.149.253.255
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 gateway:89.149.253.1
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 dns-nameserver:217.20.116.1
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 dns-nameserver:217.20.115.1
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 service:www
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 service:ftp
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 service:ssh
.1.3.6.1.4.1.37476.30.2.1.1.2.4.2313053751 service:mail
 
###
 
.1.3.6.1.4.1.37476.30.2.2 description:Leaseweb
.1.3.6.1.4.1.37476.30.2.2.1 description:Customer ViaThinkSoft
.1.3.6.1.4.1.37476.30.2.2.1.1 description:Server Gamma
.1.3.6.1.4.1.37476.30.2.2.1.1 status:active
 
.1.3.6.1.4.1.37476.30.2.2.1.1.4 identifier:ipv4
.1.3.6.1.4.1.37476.30.2.2.1.1.4 allocation-mech:crc32(cidr)/conflict=+1
 
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 cidr:95.211.38.42/32
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 status:active
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 if:eth0
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 type:ipv4
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 netmask:255.255.255.224
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 network:95.211.38.32
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 network-cidr:95.211.38.32/27
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 broadcast:95.211.38.63
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 gateway:95.211.38.62
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 dns-nameserver:62.212.65.123
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 dns-nameserver:62.212.64.122
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 revdns:viathinksoft.de
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 service:www
.1.3.6.1.4.1.37476.30.2.2.1.1.4.2069468249 service:mail
 
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 cidr:95.211.38.108/32
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 status:active
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 confidential
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 network-cidr:95.211.38.96/27
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 if:eth0:1
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 type:ipv4
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 netmask:255.255.255.224
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 network:95.211.38.96
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 broadcast:95.211.38.127
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 gateway:95.211.38.126
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 dns-nameserver:62.212.65.123
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 dns-nameserver:62.212.64.122
# TODO: ändern?
# .1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 revdns:ssh.viathinksoft.de
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 revdns:hosted-by.leaseweb.com
.1.3.6.1.4.1.37476.30.2.2.1.1.4.3825059945 service:ssh
 
.1.3.6.1.4.1.37476.30.2.2.1.1.6 identifier:ipv6
.1.3.6.1.4.1.37476.30.2.2.1.1.6 allocation-mech:crc32(cidr)/conflict=+1
 
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814 network-cidr:2001:1af8:4100:a061:1::/112
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814 type:ipv6
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814 name:ViaThinkSoft IPv6 Rack address space (in 2001:1af8:4100:a061::/64 net)
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814 description:Sub-identifier is the last 16 bits of the address in decimal format
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814 allocation-mech:lastIpBits(16)
 
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 name:block-1337
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 cidr:2001:1af8:4100:a061:1::1337/128
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 status:active
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 assignment:daniel-marschall@viathinksoft.de 2012-02-22
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 if:eth0
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 type:ipv6
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 netmask:64
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 gateway:2001:1af8:4100:a061::1
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 name:ViaThinkSoft Main IPv6
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 revdns:ipv6.viathinksoft.de
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 service:www
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 service:mail
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 cahost:viathinksoft.de
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.4919 cahost:www.viathinksoft.de
 
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #name:block-4041
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #cidr:2001:1af8:4100:a061:1::4041/128
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #status:active
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #confidential
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #assignment:daniel-marschall@viathinksoft.de 2012-02-26
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #if:eth0
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #type:ipv6
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #netmask:64
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #gateway:2001:1af8:4100:a061::1
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #name:ViaThinkSoft Auth IPv6
# TODO: ändern?
# .1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #revdns:ssh.viathinksoft.de
.1.3.6.1.4.1.37476.30.2.2.1.1.6.890164814.16449 #service:ssh
 
# --- ViaThinkSoft CA managment ---
 
# --- ViaThinkSoft Aktenzeichen ---
 
# --- Human Resources ---
 
#hr:de.viathinksoft soa
#hr:de.viathinksoft delegation marschall
#hr:de.viathinksoft.marschall short ma
#hr:de.viathinksoft delegation vn
/trunk_oldversion/_private/future_ideas
0,0 → 1,2
ideas: *invisible_children
 
/trunk_oldversion/_private/hinweise
0,0 → 1,5
 
Q: Wieso kann man in den Beschreibungen keine Links setzen (<a href=...>)
A: Eck-Klammern < > sollen generell verwendet werden dürfen, weshalb sie nicht als HTML interpretiert werden.
Da die Ausgabe von OID+ Inhalt auch über das whois Protkoll erfolgen soll, kann HTML nicht verwendet werden.
Das Klickbar-Machen von Links ist nur eine Hilfestellung für das Web-Interface.
/trunk_oldversion/_private/ng
0,0 → 1,2
informationen nur für bestimmte personen. nein, man kann nur pro OID rechte vergeben, nicht für FELDER
 
/trunk_oldversion/_private/probleme
0,0 → 1,9
es kann nicht garantiert werden dass die RA sich selbst felder definiert ohne die superior RA zu beachten (wie im vorherigen konzept von oiddb1 gelöst)
 
es wird vorausgesetzt dass ein whois server aufgesetzt werden kann
 
es ist unklar wie schreibender zugriff gewährt werden kann
 
es ist nicht möglich, geheime oids zu erzeugen, man kann nur die attribute geheim machen
 
wird rwhois angwandt, dann erfahren die superior nodes den token, der nicht für sie bestimmt ist
/trunk_oldversion/_private/que
0,0 → 1,3
kann eine oid auch komplett geheim sein?
 
feldernamen sortieren? also nicht comment,allocated,comment sondern comment,comment,allocated
/trunk_oldversion/_private/todo
0,0 → 1,231
 
man soll eine zeile auch so auskommentieren dürfen:
2.999 #name:xyz
anstelle
#2.999 name:xyz
 
funktioniert draft[in] ?
 
Die VTS OID+ datenbank proof read
 
[co] OIDs automatisch NOEXPORT
 
confidential
... können ganze OIDs verschwinden? (nein)
... kann man den identifier unsichtbar machen für die öffentlichkeit?
 
markieren der informationen, die durch authcode sichtbar wurden?
 
 
das ist bloed: man kann mit dem token zwar ueber whois kevin.example.com sehen (den index), aber eben auch alle meine persoenlichen daten!
auch in allen anderen OIDs ist nun mein voller name zu sehen!
 
 
Executed query uuid:www.kevin.example.com.
searchterm: www.kevin.example.com.
search-result: No exact match and no superior node was found
--> hier sollte man vielleicht sagen, dass der searchterm nicht gefunden wurde, unter der bedingung
a) namespace "uuid"
b) unter dem aktuellen credentials
 
oid zeile: wenn kein asn1 id, dann den lastarc nicht wiederholen. außerdem eine zeile mit "name" oder "index" dahinter anzeigen
 
erkennen, ob ipv4, ipv6 etc, und dann automatisch den prefix "ipv4" etc verwenden --> 95.211.38.42 dann möglich
 
automatischen tree/browsing für indexes, z.b. browsing von /128 auf /112 möglich, da dieses hierarchie nicht in OIDs stattfindet
 
 
die ausgabe von listall ist viel zu breit, wegen den automatisch generierten oids
 
ipv6:2001:1af8:4100:a061:1::4041/129
-- als illegal erkennen
 
funktioniert die suche, wenn man /127 sucht, und /112 existiert?
ipv6:2001:1af8:4100:a061:1::4041/127 geht
oidplus:2001:1af8:4100:a061:1::4041/127 geht nicht
--> ja, aber nur bei "ipv6:" prefix
 
bei ipv4/6 muss es eine möglichkeit geben, den baum nicht nur aus sicht der OIDs wiederzugeben, sondern auch aus sicht der NS-elemente (z.b. 112 -> 128)
 
es soll möglich sein, z.b. für OID "." lese oder RA-rechte zu setzen, ohne diese OID aber zu definieren (sodass es nicht als root auftaucht)
 
man soll dinge als macro einbauen können (z.b. rechte), ohne hierfür einen namen zu vergeben (also sie unsichtbar zu halten)
 
 
 
 
 
doi fieldextenders auch , wenn eine oid manuell angelegt wurde und ein index(doi) besitzt
 
 
 
könnte auch [el]ra(1) möglich sein, um nur RA#1 zu entfernen?
 
 
 
&action=uuid_info
--> als query machbar?
--> wird das auch eine 2.25 oid finden, wenn diese kein index(uuid) hat?
 
! uuid nie als index linken, sondern immer als uuid_info
 
bei einer NIC darf man nicht jede domain sehen!
--> reicht es den index zu indizieren, oder besser die ganze domain?
 
 
 
 
gibt es hidden oids, die vorhanden sind, wenn man sie aufruft, aber sonst nicht sichtbar sind?
-- auch nicht per index etc, aber man kann den index eingeben!
-- das wäre dann für die domains gut
oder eventuell erst sichtbar bei passwort?
 
 
doi: in wie fern soll man eine hierarchie einbauen? ist 10.1000/abc/def überhaupt erlaubt?
 
 
index(xyz) außerhalb des markierten "-----" verschieben, sodass man ihn wegparsen kann bei vwi
 
plugins/field_extenders/3_uuid.inc.php
-> zu jedem namebased soll ein index erstellt werden
aber dieser index soll unsichtbar sein! sonst wird die indexliste zugespamt!
es geht aber nicht, da nur indexes gefunden werden, die in der DB stehen
folglich kann man die uuid immer noch nicht per commandline abfragen
 
 
 
listall: anstelle so einen riesigen tree anzuzeigen, lieber einzelne roots anzeigen, und von dort aus dann eben den baum aufbauen
 
 
hier funktioniert superior: http://www.viathinksoft.de/~daniel-marschall/oid-plus/?action=show_index&index=10.1000/184/4
hier nicht: http://www.viathinksoft.de/~daniel-marschall/oid-plus/?action=show_index&index=10.1000/1844
--> aber es gibt 10.1000 !
--> aber es ist kein index(doi) ... info: es gibt auch '/'
 
 
 
wenn ich uuid:5831ae7e-de3c-3f92-14c6-7c32eb03b138 eingebe, komme ich nicht zu oid:.1.3.6.1.4.1.37476.30.1
wenn ich es aber im webinterface anklicke, geht es (also über ?action=uuid_info)
-> also müsste jede oid noch generierte indexes bekommen @v@
 
 
 
 
kann man bei der doi:10.9999/1234 suche auch auf den arc von 10.9999 zurückspringen, wenn es 1234 nicht gibt?
 
wenn kein identifier da, dann die erste zeile description rausholen im navigations-abschnitt
noscript emails
 
 
 
dois in einem richtigen stamm haben!
<stamm>.<doi root>.<uuidd>
 
 
 
http://whois.viathinksoft.de/whois/kevin.example.com
--> über oid lösen, aber dann eben die oid infos filtern
--> auch personal.txt soll dann drinstehen
--> die indexes müssen natürlich auch privat sein
--> information objects, also 1 OID = 1 whois datensatz, ohne uuid
 
oid hidden, aber sichtbar bei direktem aufruf?
 
api für das aufrufen von außen (mit keyphrase)
api zum überprüfen, ob es eine oid direkt gibt (für vts whois)
 
oid export script. iterieren und bei allen gucken ob sie veröffentlicht werden dürfen
 
alle oids von vts prüfen!
 
 
 
 
 
viele dinge konfigurirerbar machen
 
die ganzen field-extended sachen sehen viel zu kompliziert aus!!!
die eigenen angaben bitte fett hervorheben!
 
eine nicht-existierende oid
soll auch superior-current-child navigation haben
 
sollte die index oids nochmal aufgesplittet werden in <nid> -> <identifier> ?
 
 
DRAFT oids ausblendbar ueber web api
 
kann man bei der vererbung von attributen einfach ein neues attribut hinzunehmen? (OR-verknüpfung von flags?)
 
write api
 
kann ein description field eingerückt werden?
 
.2.12.3.4.5.6 6 -- ist schlecht lesbar. besser .2.12.3.4.5.6 <no identifier>(6)
 
alles übersetzbar machen
 
arsch langsam
 
<http://...> wird als url erkannt
 
---
 
oid+: "ra(1)-name" soll "ra" Überschreiben. man muss dafür nicht extra ein macro schreiben
 
---
 
:M_FREEOID [xt]ra(1):M_FREEOID __1__ __6__
Macro 'M_FREEOID' not found at ./db/xxx.db at line 8
 
---
 
Geht nicht (transitive Überschreibung von "ra"):
:M_FREEOID_RA ??-name:__1__
:M_FREEOID ra(1)[in][xt]:M_FREEOID_RA __1__
.1.3.6.1.4.1.37476.1234 [xt]entry:M_FREEOID info@daniel-marschall.de
Geht:
:M_FREEOID_RA ??-name:__1__
.1.3.6.1.4.1.37476.1234 [xt]entry:M_FREEOID info@daniel-marschall.de
.1.3.6.1.4.1.37476.1234 [xt]ra:M_FREEOID_RA info@daniel-marschall.de
 
---
 
cache / performance
 
OIDRA
BUG IN OIDRA LEGACY: werte sind mit sortiert!!! description: alles durcheinander
volcano oid assign
oid 9000: sint32
oid 40: statmon-private
upperlimit, message-typen, asn1-module für statmon
statmon.db
vts oidra alles prüfen und pub
 
whois header der immer angezeigt wird (.txt) file
 
asn.1 notation, IRI notation
 
anzahl von child oids anzeigen
 
ALAS antispam
 
zeilenumbruch trotz <pre>, aber einrückung behalten -- geht nur mit <table>?
 
!! draft erkennung
 
oid:... syntax (mit/ohne leading dot)
# --> implement in gwhois + vwhois
 
FT XML export
aber ohne .2.25 und ohne genroot . auch leaf und frozen beachten
 
source: hinzufügen
whois + fußzeile + kopfzeile(Txt)
 
eine oid, die nur [co] hat, existiert angeblich nicht -- nicht gut
 
performance
 
sieht nicht so schön aus wie oidinfo
 
/trunk_oldversion/_private/todo-fut
0,0 → 1,21
 
anzeigen der version, uhrzeit und ip adresse und datum der datenbestände
 
verbose uuid information direkt anzeigen und nicht nur per webservice von vts?
 
writing api
 
ORS anbindung
 
 
einen index und oid privat halten, z.b. dmx?
 
eine oid, die nicht als basis gewertet wird, aber infos z.b. asn-1 namen enthält?
 
ein XT attribut, das ohne namens-präfix etwas hinzufügt, z.b. werte die bei jeder oid hinzukommen sollen?
 
index(ipv6): 2001:1af8:4100:a061:1::/112
index(ipv6): 2001:1af8:4100:a061:1::1337
index(ipv6): 2001:1af8:4100:a061:1::4041
--> sollte der index-handler hier nicht die einzelnen indizes normalisieren?
 
/trunk_oldversion/_private/todo2
0,0 → 1,53
 
modular: 1volcano übernimmt derzeit zu viele aufgaben, die eigentlich zu 2oidplus gehört, z.b. namespaces-to-uuid
 
namespaces (doi, domain, packagename) mit möglichkeit, eine instanz hochzugehen
 
listChildren ist VOLL langsam!
http://webcache.googleusercontent.com/search?q=cache:5IWrJQXlDDgJ:www.xdebug.org/docs/profiler+&cd=1&hl=de&ct=clnk&gl=de
 
automatisch generierte uuid oids: alphanum identifier "uuid-<uuid>" (identifier darf nicht mit nummern anfange)
 
in der db auch folgendes erlauben: "urn:oid:" oder "oid:" oder dottless...
 
An invalid OID , e.g. "oidplus:.3.0" should not raise an exception visible to the user
 
 
ip4/6 -- mit richtiger vererbung im oid-baum!
javapackage -- mit richtiger vererbung im oid-baum!
doi -- mit richtiger vererbung im oid-baum!
andere identifier: wirklich als namebased uuid machen, oder als base64-oid mapping?
 
 
 
bei freeoid dem whois server folgen! (außer unserem eigenen, wegen endlos-rekursion)
 
!list -> soll nicht scheiße einrücken, wenn es mehrere roots gibt (z.B. PEN und UUID), oder wenigstens gescheit einrücken, 1.3 und 2.25
 
eine oid, die nur ".2.12.3.4.5.6 *invisible:0" hat, ist not-defined. ist das ok?
 
!! wie eine inherited node löschen? [del]?
 
überdenken, wann ein feld overwrite wird.
 
[in] attribut geht nicht für "not found" oids...
 
xml interface fuer oidinfo
 
oid+:
guid: !!!
doi:
packagename:
ipv4/6... alles was vorher in oid+ dabei war
-> soll automatisch als index erstellt werden!
 
man soll DOIs auch vererben können, mit distance usw --> vts doi to oid mapping!
 
link zu oidinfo bei jeder oid -> will eine ping-api
 
que: wird DRAFT vererbt?
 
!! *<url> -> [include]<url>
 
read-auth aufsplitten in invisible auth + confidential auth
 
/trunk_oldversion/_private/todo3
0,0 → 1,33
 
packagename searchprovider (inverted domain searchprovider)
 
 
 
uuid <a> links überschneiden sich bei index page
 
 
 
.2.25.91508361227511054614958357830529945354 91508361227511054614958357830529945354
-> das sieht verwirrend aus
 
 
 
wenn kein searchprovider und kein index vorliegt, dann trotzdem gucken, ob eine uuid oid den berechneten namespace hat?
(uuid oid wurde per hand erstellt und der ersteller hat vergessen den index zu setzen)
 
 
 
 
 
 
2/listAllOIDs ist redundant? 1/getAllOIDs geht auch
 
 
searchprovider
highlighter for all kinds of indexes!
erlauben, eine baumstruktur/sortierung (ipv6!) zu erstellen
(zuerst wird aber von VolcanoDB nach NID sortiert!)
 
 
bei jeder oid die source anzeigen, in der sie definiert wurde?
 
/trunk_oldversion/_private/todo4
0,0 → 1,183
invisible oids, anstelle nur read [co] . "read" umbenennen in co
 
oid+
ra(1) überschreibt ra(2) ?
alle generierten oids sollen unter einer bestimmten wurzel erstellt werden
den asn.1 pfad anklickbar machen (breadcrump)
 
 
einen index wie z.b. dmx.com privat halten?
wird es dann trotzdem im index listing angezeigt?
wie kann man einen index privat halten, der automatisch erstellt wird?
einen auth-code, der es erst ermöglicht eine oid sichtbar zu machen... und was ist, wenn man die oid direkt anspricht?
 
 
https://www.viathinksoft.de/~daniel-marschall/oid-plus/?action=roots
braucht 10 sekunden
-> die anfragen für jede root sollten paralell gestellt werden
-> indexes in einem lokalen root zusammenfassen
 
 
default RA = unknown?
 
ipv4 field-extender soll rev dns zeigen
 
 
 
 
ViaThinkSoft Main IPv4
ViaThinkSoft Backup IPv4
ViaThinkSoft Main IPv6
ViaThinkSoft Backup IPv6
Address not in usage
domain: [[HDL]]
owner-c: VTS-DAM
admin-c: VTS-AFRAID
tech-c: VTS-AFRAID
zone-c: VTS-AFRAID
billing-c: VTS-AFRAID
hosting-c: VTS-VNE
nameserver: ns1.afraid.org # inherited
nameserver: ns2.afraid.org # inherited
nameserver: ns3.afraid.org # inherited
nameserver: ns4.afraid.org # inherited
status: delegated subdomain
created: unknown
expires: never
 
[[INCLUDE:VTS-DAM]]
[[INCLUDE:VTS-VNE]]
[[INCLUDE:VTS-AFRAID]]
domain: [[HDL]]
owner-c: VTS-KDR
admin-c: VTS-DAM
tech-c: VTS-DAM
zone-c: VTS-DAM
billing-c: VTS-DAM
hosting-c: VTS-VNE
nameserver: ns11.prosite.de # inherited
nameserver: ns12.prosite.de # inherited
status: delegated subdomain
created: unknown
expires: never
 
[[INCLUDE:VTS-KDR]]
[[INCLUDE:VTS-VNE]]
[[INCLUDE:VTS-DAM]]
cat: vts-specific/priv: Ist ein Verzeichnis
domain: rez.example.com
owner-c: VTS-REZ
admin-c: VTS-DAM
tech-c: VTS-DAM
zone-c: VTS-DAM
billing-c: VTS-DAM
hosting-c: VTS-VNE
nameserver: ns11.prosite.de # inherited
nameserver: ns12.prosite.de # inherited
status: delegated subdomain
created: unknown
expires: never
 
[[INCLUDE:VTS-REZ]]
[[INCLUDE:VTS-VNE]]
[[INCLUDE:VTS-DAM]]
comment:This subdomain is a DNS subdomain from freedns.afraid.org
 
person: Daniel Marschall
org-name: ViaThinkSoft
address: Example street 1
address: Example town
country: DE
phone: +49 1234 5678
fax-no: -
e-mail: daniel-marschall@example.com
 
person: Kevin
org-name: -
address: Example street 1
address: Example town
country: PH
phone: +63 1234 5678
fax-no: -
e-mail: kevin@example.com
 
person: (rez)
org-name: -
address: ???
country: PL
phone: -
fax-no: -
e-mail: ???
 
person: Victor-Philipp Negoescu
org-name: ViaThinkSoft
address: Example street 2
address: Example town
country: DE
phone: +49 1234 5678
fax-no: -
e-mail: victor@example.com
 
 
 
2001:1af8:4100:a061:1::
 
 
 
095.211.038.042
095.211.038.108
 
 
 
 
 
einen abstand zwischen "search-result" und den daten? und zwischen den daten und "superior-node" ?
 
 
 
 
indexprovider
auch zusätzliche sachen, z.b.
uuid soll auch abfragen von vts-uuid-infos
oder bei doi soll ein link eingeblendet werden zum doi server
highlighting von htmlFormat() um den link im fließtext zu erzeugen (default: nix)
sortierung innerhalb der nid, nachdem nid bereits von core sortiert wurde
 
 
 
 
 
OID .2.999.1
---
Executed query oidplus:.2.999.1
---
oid: .2.999.1
oid-depth: 3
der-encoding: 06 03 88 37 01
namebased-uuid-sha1: 660722ff-71b0-5662-9dbc-2bba2afe8a0f
namebased-uuid-md5: 248b7ac5-48ef-3c24-1a48-58319a91ea2e
asn1-notation: { 2 999 1 }
iri-notation: /2/999/1
search-result: Not found; Superior node found
distance(oid): 1
---
oid: .2.999
oid-depth: 2
der-encoding: 06 02 88 37
namebased-uuid-sha1: 42e32fd6-fc81-5dff-99f7-89aec4c050e1
namebased-uuid-md5: 2d6d9054-e42f-39c3-1d16-b064408d97a5
cross-ref: http://www.oid-info.com/get/2.999
asn1-notation: { 2 999 }
iri-notation: /2/999
search-result: Found
name: test .3.0 xyz
name: test 1.30 xyz
name: test 1.49 xyz
name: test .1.039 xyz
name: test .1.040 xyz
name: test .2.0999 xyz
current-node: .2.999 999
child-node: .2.999.1 1 [not described]
====> hier fehlt oben ein child-node verweis auf 2.999.1
--auch wird wahrscheinlich nicht auf xref geprüft?
 
/trunk_oldversion/_private/todo5
0,0 → 1,5
attribute sortieren bei der anzeige. damit nicht einmal [leaf,deprecated] und einmal [deprecated,leaf] steht
 
domains: es kann sein dass identifier illegal ist, z.b. www.foo_bar.com . dann geht das ganze macro nicht!
 
auch source in der ausgabe anzeigen z.b. "db/mha2.db" oder "http://..."
/trunk_oldversion/_private/vwi
0,0 → 1,3
vwhois problem... es sollte 2 whois server von vts geben...
das problem ist, dass http://whois.viathinksoft.de/whois/oid:1.3.6.1.4.1.37476.1.9000 nicht das selbe zeigt, was ein anderer gwhois zeigen würde, weil der vts-whois-server die abfrage abfangen muss. man sieht nicht die gwhois header und footer von der umleitung auf :program|oid-plus .
 
/trunk_oldversion/_profiling/.htaccess
0,0 → 1,25
# https://stackoverflow.com/a/26155051/488539
 
# Redirect to HTTPS
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
 
# Authenticate users only when using HTTPS
<If "%{HTTPS} == 'on'">
AuthType Basic
AuthName "ViaThinkSoft"
AuthUserFile /home/daniel-marschall/.htpasswd
# Prevent this 'Require' directive from overriding any merged previously
<IfVersion >= 2.4>
AuthMerging And
</IfVersion>
Require valid-user
</If>
 
# ---
 
RewriteEngine Off
RewriteOptions Inherit
Options +Indexes
 
/trunk_oldversion/_profiling/do_profile.sh
0,0 → 1,5
#!/bin/bash
rm profiling_/cachegrind.out.*
php -d xdebug.profiler_enable=On whois.php
mv /global/php-profiling/cachegrind.out.* profiling_/
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+text/x-sh
\ No newline at end of property
/trunk_oldversion/_profiling/profiler-enable
0,0 → 1,2
php -d xdebug.profiler_enable=On index.php
 
/trunk_oldversion/_profiling/wincachegrind-1.0.0.9b.zip
Cannot display: file marked as a binary type.
svn:mime-type = application/zip
Property changes:
Added: svn:mime-type
+application/zip
\ No newline at end of property
/trunk_oldversion/_test/.htaccess
0,0 → 1,25
# https://stackoverflow.com/a/26155051/488539
 
# Redirect to HTTPS
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
 
# Authenticate users only when using HTTPS
<If "%{HTTPS} == 'on'">
AuthType Basic
AuthName "ViaThinkSoft"
AuthUserFile /home/daniel-marschall/.htpasswd
# Prevent this 'Require' directive from overriding any merged previously
<IfVersion >= 2.4>
AuthMerging And
</IfVersion>
Require valid-user
</If>
 
# ---
 
RewriteEngine Off
RewriteOptions Inherit
Options +Indexes
 
/trunk_oldversion/_test/db_test/statmon_v1_siehe_todo_eintrag
0,0 → 1,78
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.2.1 [in]attribute:draft
oid:.1.3.6.1.4.1.37476.2.1 identifier:statmon
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusmon
oid:.1.3.6.1.4.1.37476.2.1 attribute:draft
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusmon
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusMonitor
oid:.1.3.6.1.4.1.37476.2.1 unicodelabel:StatusMonitor
oid:.1.3.6.1.4.1.37476.2.1 description:ViaThinkSoft Status Monitor Communication Interface
oid:.1.3.6.1.4.1.37476.2.1 specification:http://www.viathinksoft.de/documents/specification/statusmon/
oid:.1.3.6.1.4.1.37476.2.1 allocated:daniel-marschall@viathinksoft.de 2011-03-22
 
# --- Version 1
 
oid:.1.3.6.1.4.1.37476.2.1.1 identifier:v1
 
#oid:.1.3.6.1.4.1.37476.2.1.1.1 [in]*invisible:1
oid:.1.3.6.1.4.1.37476.2.1.1.1 allocated:daniel-marschall@viathinksoft.de 2011-03-22
oid:.1.3.6.1.4.1.37476.2.1.1.1 description:Monitor states
oid:.1.3.6.1.4.1.37476.2.1.1.1 description:All child OIDs are leaf OIDs.
oid:.1.3.6.1.4.1.37476.2.1.1.1 identifier:states
#oid:.1.3.6.1.4.1.37476.2.1.1.1 [in]attribute:canceled
# TODO: warum wird "draft" nicht weiter durchgeschleift?
oid:.1.3.6.1.4.1.37476.2.1.1.1 [in]attribute:draft
oid:.1.3.6.1.4.1.37476.2.1.1.1 maxdepth:1
oid:.1.3.6.1.4.1.37476.2.1.1.1 todo:rename into state ?
oid:.1.3.6.1.4.1.37476.2.1.1.1 unicodelabel:States
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 description:Everything is OK
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 identifier:ok
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 unicodelabel:OK
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 description:A warning is thrown
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 identifier:warning
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 unicodelabel:WARNING
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 description:Severity of the state (0 = OK, >0 = Warning)
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 identifier:severity
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 unicodelabel:SEVERITY
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 description:Notification when constant changes
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 identifier:constant
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 unicodelabel:CONSTANT
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 description:A picture which has to be monitored visually
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 identifier:picture
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 unicodelabel:PICTURE
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 description:Sends a message without changing the client monitor state
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 identifier:message
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 unicodelabel:MESSAGE
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 description:A temporary internal error prevents the Status Monitor to provide the current state of the service. This error is equivalent to a HTTP 500 response.
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 description:ERROR_INTERNAL [text (optional)]
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 identifier:error-internal
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 unicodelabel:ERROR_INTERNAL
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 description:ERROR_ARGUMENTS [text (optional)]
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 description:This error indicates that the client has provided illegal arguments (= GET parameters) to the Status Monitor.
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 identifier:error-arguments
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 unicodelabel:ERROR_ARGUMENTS
/trunk_oldversion/_test/db_test/test1/test2/_hdl.db
0,0 → 1,9
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
:HDL-VTS ??-name(1):ViaThinkSoft
:HDL-VTS ??-tel(2):(VTS TEL)
:HDL-VTS ??-fax(3):(VTS FAX)
 
:HDL-MAR ??-name(1):Daniel Marschall
:HDL-MAR ??-tel(1):(MAR TEL)
 
/trunk_oldversion/_test/db_test/test1/test2/test.db
0,0 → 1,69
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
#:TEST_MACRO identifier:__FU__
#oid:.2.999 [xt]identifier:TEST_MACRO
 
oid:.2.999 identifier:ax
oid:.2.999 desc:OIDAx
 
oid:.2.999.3 identifier:ax
oid:.2.999.3 identifier:bx
oid:.2.999.3 identifier:cx
oid:.2.999.3 desc:OIDAx
 
#test
oid:.2.999.3.4 [co]identifier:ax
oid:.2.999.3.4 [co]read-auth(plain):8888
oid:.2.999.3.4 [co]desc:OIDAx
 
oid:.2.999.1.2.3 identifier:a
oid:.2.999.1.2.03 desc:OIDA
 
oid:.2.999.1.2.3.4 identifier:b
oid:.2.999.1.2.3.4 desc:OIDB
 
oid:.2.999.1.2.3.4.5 identifier:c
oid:.2.999.1.2.3.4.5 desc:OIDC
oid:.2.999.1.2.3.4.5 index(str):hello
 
oid:.2.999.1.2.3.4.6 identifier(abc,def,xxx):d
oid:.2.999.1.2.3.4.6 desc(abc):OIDD
 
oid:.2.999.1.2.3.4.6.7.8.9.10 identifier(abc,def,xxx):d
oid:.2.999.1.2.3.4.6.7.8.9.10 desc(abc):OIDD
 
oid:.2.999.1.2.3.4.6.7.8.9.10.11 identifier(abc,def,xxx):d
oid:.2.999.1.2.3.4.6.7.8.9.10.11 desc(abc):OIDD
 
oid:.2.999.1.2.3.4.6.7.8.9.10.11.12 identifier(abc,def,xxx):d
oid:.2.999.1.2.3.4.6.7.8.9.10.11.12 desc(abc):OIDD
 
.2.888.1.2.4 identifier:x
.2.888.1.2.4 desc:OIDx
 
.2.9.99 desc:zero
.2.9.99 identifier:xxy
 
.2 [xt][in]ra(123):HDL-VTS
 
oid:.2.123.1 desc:extend test
oid:.2.123.1 [xt][in]ra(45):HDL-MAR
#oid:.2.123.1 [xt][in]raWithXTin:HDL-DMX
#oid:.2.123.1 [xt]raWithXT:HDL-DMX
#oid:.2.123.1 [in]raWithIN:myIn
#oid:.2.123.1 [xt][in]raWithXTin:NOT-EXISTING
 
oid:.2.123.1.2 desc:Extended
oid:.2.123.1.2 raWithXTin:ferdina
 
oid:.2.123.1.2.3 desc:Extended 3
oid:.2.123.1.2.3 raWithXTin:nomnomnom
 
oid:.2.123.1.2.3.4 desc:Extended 4
oid:.2.123.1.2.3.4 raWithXTin:eraeraera
 
# todo
. ra(1)[in][xt]:C_MAR
. (2)ra[in][xt]:C_VTS
# . 1.ra(1)-date:2013
 
/trunk_oldversion/_test/find_common_root.php
0,0 → 1,78
<?php
 
$roots = array();
#$roots[] = '.2.25.123';
#$roots[] = '.2.25.456';
$roots[] = '.1.3.6.1.4';
$roots[] = '.1.3.6.1.4.1.1234';
$roots[] = '.1.3.6.1.4.1.5678.2';
 
$hiarc = -1;
 
foreach ($roots as $r) {
$c = explode('.', $r);
$z = count($c);
if ($z > $hiarc) $hiarc = $z;
}
 
echo "Hiarc: $hiarc\n";
 
$cr = '';
for ($i=1; $i<$hiarc; $i++) {
$eq = null;
$diff = false;
echo "--- $i ---\n";
foreach ($roots as $r) {
$c = explode('.', $r);
$t = $c[$i];
if (is_null($eq)) {
$eq = $t;
} else {
if ($eq != $t) {
echo "Chk: $eq != $t\n";
 
$diff = true;
break;
}
}
}
if ($diff) {
$c = explode('.', $roots[0]);
$o = array();
for ($j=$i-2; $j>=0; $j--) {
$o[] = $c[$j];
}
$o = array_reverse($o);
$cr = implode('.', $o);
# if ($cr == '') $cr = '.';
echo "Common root: ".$cr."\n";;
break;
}
}
 
$zzz = array();
$zzz[$cr] = true;
foreach ($roots as $r) {
echo "Proc $r ($cr)\n";
$r = substr($r, strlen($cr));
# $r = substr($r, 1).'.';
# $r = $cr.'.'.substr($r, 0, strpos($r, '.'));
$v = explode('.', $r);
array_pop($v);
 
print_r($v);
 
$a = $cr;
foreach ($v as $vv) {
$a .= 'x'.$vv;
$zzz[$a] = true;
 
}
echo "\n";
}
 
foreach ($zzz as $z => $x) {
echo "X = $z\n";
}
 
?>
/trunk_oldversion/_test/mapping_test.php
0,0 → 1,58
<?php
 
# Algorithm as specified by .1.3.6.1.4.1.37476.3.2.3.1
 
define('BASE64_CHARS', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=');
 
function identifierToNumber($identifier) {
if ($identifier == '') return '99';
$out = '';
$identifier = utf8_encode($identifier);
$identifier = base64_encode($identifier);
for ($i=0; $i<strlen($identifier); $i++) {
$p = $identifier[$i];
$p = strpos(BASE64_CHARS, $p);
$p = str_pad($p, 2, '0', STR_PAD_LEFT);
$out .= $p;
}
return $out;
}
 
function numberToIdentifier($number) {
if ($number == '99') return '';
if (strlen($number)%2 != 0) return false;
$out = '';
for ($i=0; $i<=strlen($number); $i+=2) {
$n = substr($number, $i, 2);
$out .= substr(BASE64_CHARS, $n, 1);
}
$out = base64_decode($out);
$out = utf8_decode($out);
return $out;
}
 
function javaPackageNameToOID($identifier) {
$out = '2.999';
$ary = explode('.', $identifier);
foreach ($ary as $a) {
$out .= '.'.identifierToNumber($a);
}
return $out;
}
 
function OIDToJavaPackageName($oid) {
$oid = preg_replace('@^2\\.999\\.@', '', $oid, -1, $c);
if ($c == 0) return false;
$out = array();
$ary = explode('.', $oid);
foreach ($ary as $a) {
$out[] = numberToIdentifier($a);
}
return implode('.', $out);
}
 
$x = javaPackageNameToOID('test.de.viathinksoft.java.example...');
 
echo OIDToJavaPackageName($x);
 
?>
/trunk_oldversion/_test/various_tests.php
0,0 → 1,72
<?php
 
include_once __DIR__ . '/../includes/oid_plus.inc.php';
 
# ------------------------------------------
 
header('Content-Type:text/plain');
 
$db = new OIDPlus();
 
$db->addDir(__DIR__ . '/../db');
 
/*
 
#echo "--------- Resolving identifiers\n";
#var_dump($db->resolveIdentifiers('.2.999.ax.ax.1.2.3'));
 
#echo "--------- Debug \n";
#$db->debug();
 
#echo "--------- Roots \n";
#$r = $db->findRoots();
#print_r($r);
 
#echo "--------- Find hello (str) \n";
#var_dump($db->findOID('hello'));
 
#echo "--------- Children .2.999 \n";
#print_r($db->listChildren('.2.999'));
 
#echo "--------- Children . \n";
#print_r($db->listChildren('.'));
 
#echo "--------- Rec show . \n";
#$db->rec_show('.');
 
# echo "--------- Rec show .2.999 \n";
# $db->rec_show('.2.999', 1);
 
echo "--------- Help \n";
$db->query('help');
 
 
echo "--------- List \n";
$db->query('oidplus:!list #7,8888,3');
 
echo "--------- Domain \n";
$db->query('oidplus:viathinksoft.de');
 
echo "--------- IP\n";
$db->query('oidplus:2001:1af8:4100:a061:0001::1336');
echo "--------- IP\n";
$db->query('oidplus:2001:1af8:4100:a061:0001::1337/127');
echo "--------- IP\n";
$db->query('oidplus:2001:1af8:4100:a061:0001::1337');
 
#echo "--------- Misc \n";
#$db->query('oidplus: hello world #0123 ');
#$db->query('oidplus: hello world ');
 
 
echo "--------- WELCOME\n";
$db->query('oidplus:!help');
$db->query('oidplus:!list');
$db->query('oidplus:!listIndexes');
$db->query('oidplus:.2.999.1');
 
*/
 
$db->query('oidplus:.1.3.6.1.4.1.37476.30.1.1.1.1.1812847950.1');
 
?>
/trunk_oldversion/_test/vts-oid-mapping
0,0 → 1,39
 
ViaThinkSoft OID Mapping
 
Instead of using a namebased UUID to map identifiers to the OID tree (in arc 2.25),
this mapping mechanism allows to resolve an OID back into its original
identifier.
 
Mapping stringToNumber: .1.3.6.1.4.1.37476.3.2.3.1
 
mapping(50)
misc(0)
nid<base64>???
sub-nid<base64>???
...???
id<base64>
urn(1)
nid<base64>
sub-nid<base64>
...
id<base64>
doi(2)
10
org1000(1000)
id<base64>
...??? <-- ein feld "no-full-doi" => keine url zeigen
javapackage(3)
nid<base64>
...
nid<base64>
ipv4
???
ipv6
???
isbn
10
<isbn>
13
<isbn>
 
/trunk_oldversion/core/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk_oldversion/core/1_VolcanoDB.class.php
0,0 → 1,1106
<?php
 
# todo: "recursive" functions private machen, damit params nicht manipuliert werden können...
# todo: return false -> exception
 
# TODO false vs null ausgaben
# TODO signed openssl output
 
# TODO: oid definieren für name based
# QUE: geht extention von macros?
 
# TODO: "server time" am ende von Âquery() anzeigen?
 
require_once __DIR__ . '/../includes/uuid_utils.inc.php';
require_once __DIR__ . '/../includes/oid_utils.inc.php';
 
define('UUID_NAMEBASED_NS_OidPlusMisc', 'ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22');
define('UUID_NAMEBASED_NS_OidPlusNSOnly', '0943e3ce-4b79-11e5-b742-78e3b5fc7f22');
 
define('GENERATION_ROOT_DEFAULT', '.2.25.<SYSID>');
 
class VolcanoDB {
protected $macro_data = array(); // TODO: use with caution!
protected $oid_data = array(); // TODO: use with caution!
protected $authTokens = array();
protected $configuration = array();
protected $configuration_file = null;
protected $configuration_may_create = false;
 
protected $redactedMessage = '# Information redacted. Please append a correct auth token with your request.';
# protected $redactedMessage = null;
 
public function filterRedactedEntries($output) {
$out = '';
 
$lines = explode("\n", $output);
foreach ($lines as $line) {
$line = trim($line);
if ($line == '') continue;
$name_val = explode(':', $line, 2);
if (count($name_val) != 2) continue;
if (trim($name_val[1]) != trim($this->redactedMessage)) {
$out .= $line."\n";
}
 
}
 
return $out;
}
 
public function getOIDData() {
return $this->oid_data;
}
 
public function getMacroData() {
return $this->macro_data;
}
 
public function __construct($conf_file, $may_create) {
$this->configuration_file = $conf_file;
$this->configuration_may_create = $may_create;
$this->readConfiguration();
}
 
public function getConfigValue($name) {
if (!isset($this->configuration[$name])) return false;
return $this->configuration[$name];
}
 
public function setConfigValue($name, $value) {
$this->configuration[$name] = $value;
$this->saveConfiguration();
}
 
protected function readConfiguration() {
if (is_null($this->configuration_file)) return;
$this->configuration = array();
if (!file_exists($this->configuration_file)) {
if (!$this->configuration_may_create) {
$metadata = array();
throw new VolcanoException("Configuration file '$conf_file' not found", $metadata);
}
} else {
$lines = file($this->configuration_file);
foreach ($lines as &$line) {
$line = trim($line);
if (empty($line)) continue;
if ($line[0] == '#') continue;
$ary = explode('=', $line, 2);
if (count($ary) < 2) continue;
$this->configuration[$ary[0]] = $ary[1];
}
}
 
if ($this->getConfigValue('system_unique_id') === false) {
$this->setConfigValue('system_unique_id', gen_uuid());
}
}
 
public function getSystemID() {
return $this->getConfigValue('system_unique_id');
}
 
public function getSystemIDInteger() {
$val = uuid_numeric_value($this->getSystemID());
if (!$val) {
$metadata = array();
throw new VolcanoException("system_unique_id is not a valid UUID. Please check db/local.conf", $metadata);
}
return $val;
}
 
protected function saveConfiguration() {
if (is_null($this->configuration_file)) return;
file_put_contents($this->configuration_file, '');
foreach ($this->configuration as $name => $val) {
file_put_contents($this->configuration_file, $name.'='.$val."\n", FILE_APPEND);
}
}
 
public function setRedactedMessage($msg) {
$this->redactedMessage = $msg;
}
 
public function getRedactedMessage() {
return $this->redactedMessage;
}
 
public function disableRedactedMessage() {
$this->redactedMessage = null;
}
 
public function isRedactedMessageEnabled() {
return !is_null($this->redactedMessage);
}
 
public function addAuthToken($token) {
if (!in_array($token, $this->authTokens)) {
$this->authTokens[] = $token;
$this->clearCaches();
}
}
 
public function clearAuthTokens() {
$this->authTokens = array();
$this->clearCaches();
}
 
public function addDir($dir, $recursive=true) {
if (!is_dir($dir)) {
throw new VolcanoException("Directory not found: $dir");
}
$ary = glob($dir . '/*');
if (count($ary) == 0) return;
if ($ary === false) return;
sort($ary);
foreach ($ary as &$a) {
if ($a[0] == '.') continue; // e.g. '.', '..', or '.htaccess'
if (self::endsWith($a, '~')) continue; // recycled files
if (($recursive) && (is_dir($a))) {
$this->addDir($a, $recursive);
continue;
}
if (!is_file($a)) continue;
if (!self::endsWith($a, '.db')) continue;
$this->addFile($a);
}
unset($a);
 
#echo '<!--';
#print_r($this->oid_data);
#print_r($this->macro_data);
#echo '-->';
 
}
 
public function addFile($file) {
$h = fopen($file, 'r');
 
$lineno = 1;
$header = fgets($h);
if (trim($header) != '['.$this->getFileformatIdentifier().']') {
$metadata = array();
$metadata['source'] = "$file:0";
throw new VolcanoException("Header of file is invalid", $metadata);
}
 
while (!feof($h)) { // TODO OK?
$line = fgets($h);
$lineno++;
$this->addLine($line, $file.':'.$lineno);
}
fclose($h);
}
 
# todo: wie das problem bzgl allowed field-override lösen? (superior RA verbietet "identifier" change)
 
protected function isSpecialInvisibleField($data) {
assert(isset($data['attrib_name']));
 
$field_name = $data['attrib_name'];
 
if (empty($field_name)) return false;
 
if ($field_name == '*read-auth') return true;
# if ($field_name == '*write-auth') return true;
if ($field_name == '*invisible') return true;
 
if ($field_name[0] == '*') {
throw new VolcanoException("Invalid system command '$field_name'", $data);
}
 
return false;
}
 
public function isAuthentificated($oid) {
$readAuths = $this->getDatasets($oid, '*read-auth', false); # todo: [co] erzwingen?
foreach ($readAuths as &$ra) {
$nid = isset($ra['attrib_params'][0]) ? $ra['attrib_params'][0] : '';
$found_valid_authprovider = false;
foreach (self::$authProvs as &$ap) {
if ($ap->checkId($nid)) {
$found_valid_authprovider = true;
if ($ap->checkAuth($ra['value'], null)) return true; // first, check with empty/null authToken, e.g. for IP-Authentification
foreach ($this->authTokens as &$token) {
if ($ap->checkAuth($ra['value'], $token)) return true;
}
unset($token);
}
}
if (!$found_valid_authprovider) {
# return false;
throw new VolcanoException("No authentification provider found", $ra);
}
unset($ap);
}
unset($ra);
return false;
}
 
protected static function showSource($source) {
if (strpos($source, ':') === false) return $source;
preg_match('@^(.+):(\\d+)$@', $source, $m);
$file = $m[1];
$line = $m[2];
return "$file at line $line";
}
 
protected function clearCaches() { # TODO: aufsplitten in caches, die die auth betreffen und die, die es nicht tun?
$this->all_cache = null;
$this->cache_recdatasets = array();
$this->cache_listOIDs = array();
}
 
protected function getIndexGenerationRoot() {
$val = $this->getConfigValue('local_index_generation_root');
if (!$val) {
$val = GENERATION_ROOT_DEFAULT;
$this->setConfigValue('local_index_generation_root', $val);
}
 
return $this->extendOID($val, true);
}
 
public function extendOID($identifier, $no_gen_root_replacement=false) {
$identifier = str_replace('<SYSID>', $this->getSystemIDInteger(), $identifier);
if (!$no_gen_root_replacement) {
// Avoids an endless recursion with getIndexGenerationRoot
$identifier = str_replace('<GENROOT>', $this->getIndexGenerationRoot(), $identifier);
}
$identifier = sanitizeOID($identifier, true);
return $identifier;
}
 
public function addLine($line, $source='(Direct Input):0') {
$line = trim($line);
$line = str_replace("\t", ' ', $line);
$line = str_replace(array("\n", "\r"), '', $line);
 
$line_expl = explode(' ', $line, 2);
 
if (empty($line) || ($line[0] == '#')) {
return;
} else if (strpos($line_expl[0], ':') !== false) {
$this->clearCaches();
 
$expl2 = explode(':', $line_expl[0], 2);
$namespace = trim(strtolower($expl2[0]));
$identifier = trim($expl2[1]);
 
if (empty($namespace)) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("The namespace may not be empty", $metadata);
}
 
if (empty($identifier)) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("The identifier may not be empty", $metadata);
}
 
$is_oid = $namespace == 'oid';
$is_macro = $namespace == '*macro';
$is_external = $namespace == '*external';
$is_other = (!$is_oid) && (!$is_macro) && (!$is_external);
 
# TODO: isSpecialNamespace($namespace, $source) ?
if (($namespace[0] == '*') && (!$is_macro) && (!$is_external)) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("Invalid system namespace '$namepsace'", $metadata);
}
 
if ($is_external) {
# TODO: wenn lokal und mit .php endend, dann eval()
$url = $identifier;
$this->addFile($url);
return;
}
 
if ($is_macro) {
$identifier = strtoupper($identifier);
}
 
if ($is_other) {
# TODO!!! diese handlers als plugins auslagern!
# QUE: sollte sowas nicht OID+ und nicht Volcano sein?
 
$flags = '';
if (strpos($identifier, '[co]') !== false) {
$identifier = str_replace('[co]', '', $identifier);
$flags .= '[co]';
}
$original_identifier = $identifier;
# TODO: check for unknown attrib flags
 
/*
if (($namespace == 'guid') || ($namespace == 'uuid')) {
$guid = $identifier;
} else {
$guid = gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OidPlusMisc, $namespace.':'.$identifier);
}
$identifier = '.'.uuid_to_oid($guid); # TODO: parameter, ob mit leading dot oder nicht
*/
 
$is_guid_ns = ($namespace == 'guid') || ($namespace == 'uuid');
 
if ($is_guid_ns && (!$this->getConfigValue('uuid_indexes_in_genroot'))) {
# uuid_indexes_in_genroot wird verwendet, sonst würde bei einer sammlung von MS COM clsids würde sonst die root zone platzen
$guid = $identifier;
$identifier = '.'.uuid_to_oid($guid); # TODO: parameter, ob mit leading dot oder nicht
} else {
# Es wird ein weltweit einzigartiger Root angelegt, anstelle 2.25 für jeden einzelnen index zu verwenden.
# Grund: Indexes sollen (alleine schon aus Performancegründen bei der Root-Anzeige im Webinterface)
# in einer Wurzel zusammengefasst werden. Diese Wurzel sollte aber unter der legalen Kontrolle des
# Eigentümers stehen. "2.25" kann nicht als Wurzel definiert werden, da der Benutzer kein Recht hat,
# "2.25" sein Eigen zu nennen.
# PROBLEM: aber dann kann man von den einzelnen items nicht das "uuid" feld ablesen, um an die
# per UUID_NAMEBASED_NS_OidPlusMisc erstellte UUID ranzukommen, da das "uuid" feld nur kindsknoten von 2.25
# konvertiert.
$gen_root = $this->getIndexGenerationRoot();
 
if ($namespace == 'doi') {
if (!self::beginswith($identifier, '10.')) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("Invalid DOI '$identifier'. Must start with '10.'", $metadata);
}
$x = substr($identifier, 3/* strlen('10.') */);
$orgid = explode('/', $x, 2)[0];
 
# doi(10) <orgid> <doi:identifier>
$identifier_ns = $gen_root.'.10.'.$orgid;
 
if (!$this->oidDescribed($identifier_ns, false)) {
$this->addLine("oid:$identifier_ns description: Organisation $orgid", $source);
}
 
$guid_item = gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OidPlusMisc, 'doi:'.$identifier);
} else if ($is_guid_ns) {
# uuid(25) <numeric_uuid>
$identifier_ns = $gen_root.'.25';
 
# TODO: im web frontend trotzdem die originale index uuid zum klicken abieten (action=uuid_info, nicht nur action=show_index!)
$guid_item = $identifier;
} else {
$guid_ns = gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OidPlusNSOnly, $namespace);
 
# ns(0) <ns> <ns:identifier>
$identifier_ns = $gen_root.'.0.'.uuid_numeric_value($guid_ns);
 
if (!$this->oidDescribed($identifier_ns, false)) {
$this->addLine("oid:$identifier_ns description: Automatically generated arc for namespace \"$namespace\"", $source);
if (oid_id_is_valid($namespace)) {
$this->addLine("oid:$identifier_ns identifier:$namespace", $source);
}
}
 
$guid_item = gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OidPlusMisc, $namespace.':'.$identifier);
}
 
$identifier = $identifier_ns.'.'.uuid_numeric_value($guid_item);
}
if (!$this->oidDescribed($identifier, false)) { # TODO: WARUM? man kann den index doch auch so anlegen??? !!
$this->addLine('oid:'.$identifier." ${flags}index($namespace):$original_identifier", $source);
}
$is_other = false;
$is_oid = true;
}
 
# Muss als letztes stehen, da $is_other zu $is_oid konvertiert werden kann
if ($is_oid) {
$bak_oid = $identifier;
$identifier = $this->extendOID($identifier);
 
if ($identifier === false) {
$metadata = array();
$metadata['source'] = $source;
$metadata['oid'] = $bak_oid;
throw new VolcanoException("Illegal OID or dot notation with leading dot not recognized", $metadata);
}
}
 
if (!isset($line_expl[1])) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("Syntax error in DB: line contains no data", $metadata);
}
 
$data = isset($line_expl[1]) ? $line_expl[1] : '';
 
$bry = explode(':', $data, 2);
$attrib_name = (isset($bry[0])) ? $bry[0] : '';
$value = (isset($bry[1])) ? $bry[1] : '';
 
// <attrib_name>(<attrib_params>)
if (preg_match("@^(.*)\((.+)\)(.*)$@isU", $attrib_name, $m)) {
$attrib_name = $m[1].$m[3];
$attrib_params = explode(',', $m[2]);
} else {
$attrib_params = array();
}
 
// Process params
// [co]<attrib_name> marks the line as confidential (read-auth necessary)
$attrib_name = str_replace('[co]', '', $attrib_name, $cnt);
$flag_confidential = $cnt > 0;
 
$attrib_name = str_replace('[xt]', '', $attrib_name, $cnt);
$flag_extend = $cnt > 0;
 
$attrib_name = str_replace('[add]', '', $attrib_name, $cnt);
$flag_add = $cnt > 0;
 
$attrib_name = str_replace('[del]', '', $attrib_name, $cnt);
$flag_del = $cnt > 0;
 
$attrib_name = str_replace('[in]', '', $attrib_name, $cnt);
## $flag_inherit = $cnt > 0;
# Wir speichern hier keinen boolean, sondern den $attrib_name .
# Dadurch wird sichergestellt, dass ein [xt]-Block im ganzen überschrieben wird, und nicht jede Zeile einzeln.
# Jede Zeile enthält also im flag_inherit den Namen ihres [xt]-Blocks.
$flag_inherit = ($cnt > 0) ? $attrib_name : false; // attrib_name muss ohne restliche flags sein, deswegen [in] zuletzt parsen
 
# No! We just leave inherited so we can use it later
/*
if (($flag_inherit) && ($is_macro)) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("Macro attributes cannot be inherited", $metadata);
}
*/
 
if (preg_match('@\[(.*)\]@isU', $attrib_name, $m)) {
$metadata = array();
$unkn_flag = $m[1];
$metadata['source'] = $source;
throw new VolcanoException("Flag [$unkn_flag] unknown", $metadata);
}
 
$attrib_name = trim($attrib_name);
 
// Add data
if ($flag_extend) {
$value = trim($value);
 
// Allow multiple whitespaces as separator for macro params
$value = preg_replace('@(\s+)@', ' ', $value);
 
# $macro_params = explode(' ', $value); // <macroname> <macroparam_1> <...>
$macro_params = str_getcsv($value, ' '); // requires PHP 5.3, see http://stackoverflow.com/questions/2202435/php-explode-the-string-but-treat-words-in-quotes-as-a-single-word for alternatives
$macroname = $macro_params[0];
if (!isset($this->macro_data[strtoupper($macroname)])) {
$metadata = array();
$metadata['source'] = $source;
 
# TODO: zuerst alle anderen *.db files durchprobieren ob es auftaucht?
throw new VolcanoException("Macro '$macroname' not found", $metadata);
}
 
$x = $this->macro_data[strtoupper($macroname)];
 
foreach ($x as $y) { // no &$y
# $y['source'] bleibt erhalten
 
// Replace macro params in value, attrib_name and attrib_params
foreach ($macro_params as $mp_n => &$mp_x) {
$y['value'] = str_replace('__'.$mp_n.'__', $mp_x, $y['value']);
$y['attrib_name'] = str_replace('__'.$mp_n.'__', $mp_x, $y['attrib_name']);
foreach ($y['attrib_params'] as &$ap_val) {
$ap_val = str_replace('__'.$mp_n.'__', $mp_x, $ap_val);
}
}
// Remove unused macro param place holders
// NO! Otherwise we cannot use parametrized macros which are using parametrized macros itself
/*
$y['value'] = preg_replace('@__(\\d+)__@sU', '', $y['value']);
$y['attrib_name'] = preg_replace('@__(\\d+)__@sU', '', $y['attrib_name']);
foreach ($y['attrib_params'] as &$ap_val) {
$ap_val = preg_replace('@__(\\d+)__@sU', '', $ap_val);
}
*/
 
// $y['attrib_params'] = $attrib_params;
// Nein, attrib_params lieber direkt nach ?? einfügen:
if (count($attrib_params) > 0) {
$attr_ext = '('.implode(',', $attrib_params).')';
} else {
$attr_ext = '';
}
# NG: '??' auch ersetzen in attrib_param, value ?
$y['attrib_name'] = str_replace('??', $attrib_name.$attr_ext, $y['attrib_name']);
// QUE: wie verhalten sich die params im falle einer vererbung? kann man params missbrauchen um z.B. ra(1), ra(2) etc zu kennzeichnen?
 
$y['flag_confidential'] = $flag_confidential || $y['flag_confidential'];
# todo: read-auth im macro-bereich?
# $y['flag_extend'] = true; // TODO?
$y['flag_inherit'] = trim($flag_inherit); # dieser flag_inherit geht von der ursprungs-oid über alle stufen der macros und submacros hinweg
$y['flag_add'] = $flag_add;
 
if ($is_macro) {
$y['macro'] = $identifier;
} else {
$y['oid'] = $identifier;
}
 
// Check if the identifier is valid to the ASN.1 standards
$flag_extend = strpos($y['attrib_name'], '[xt]') !== false;
if ((!$flag_extend) && (!$is_macro) && (strtolower($y['attrib_name']) == 'identifier') && (!oid_id_is_valid($y['value']))) {
throw new VolcanoException("Identifier '".$y['value']."' is not a valid ASN.1 identifier", $y);
}
 
if ((!$flag_extend) && (!$is_macro) && (strtolower($y['attrib_name']) == 'iri') && (!iri_valid($y['value']))) {
throw new VolcanoException("Identifier '".$y['value']."' is not a valid IRI identifier", $y);
}
 
if ($is_macro) {
$this->macro_data[$identifier][] = $y;
} else {
$this->oid_data[$identifier][] = $y;
}
}
} else {
// $value = trim($value); // TODO: oder doch lieber? z.b. descriptions einrücken?
 
# NG: '??' auch ersetzen in attrib_param, value ?
if ((!$is_macro) && (strpos($attrib_name, '??') !== false)) {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("'??' is only allowed inside a macro", $metadata);
}
 
$y = array(
'source' => $source,
'attrib_name' => $attrib_name,
'attrib_params' => $attrib_params,
'value' => $value,
'flag_confidential' => $flag_confidential,
# 'flag_extend' => $flag_extend,
'flag_inherit' => trim($flag_inherit),
'flag_add' => $flag_add,
'flag_del' => $flag_del
);
 
if ($is_macro) {
$y['macro'] = $identifier;
} else {
$y['oid'] = $identifier;
}
 
// Check if the identifier is valid to the ASN.1 standards
if ((!$flag_extend) && (!$is_macro) && (strtolower($y['attrib_name']) == 'identifier') && (!oid_id_is_valid($y['value']))) {
throw new VolcanoException("Identifier '".$y['value']."' is not a valid ASN.1 identifier", $y);
}
 
if ($is_macro) {
$this->macro_data[$identifier][] = $y;
} else {
$this->oid_data[$identifier][] = $y;
}
}
} else {
$metadata = array();
$metadata['source'] = $source;
throw new VolcanoException("Syntax error in database (not beginning with 'oid:' or '*macro:' or a valid identifier like 'guid:<uuid>')", $metadata);
}
}
 
private $all_cache = array();
# TODO: auch $parent_oid parameter
public function getAllOIDs($check_auth=true) {
$vvv = $check_auth;
if (isset($this->all_cache[$vvv])) return $this->all_cache[$vvv];
 
// TODO: $with_macros per default false. ausblenden. xxx
 
$ary = array();
foreach ($this->oid_data as $b => &$data) {
if ($check_auth) {
if ($this->oidDescribed($b, $check_auth)) $ary[] = $b;
} else {
$ary[] = $b;
}
}
 
$this->all_cache[$vvv] = $ary;
return $ary;
}
 
// TODO: -> functions.inc.php
protected static function getShortestString(&$ary) {
$minlen = PHP_INT_MAX;
$out = false;
foreach ($ary as &$a) {
if ($a === null) continue;
$len = strlen($a);
if ($len < $minlen) {
$out = $a;
$minlen = $len;
}
}
unset($a);
return $out;
}
 
// TODO: -> oid_utils.inc.php ?
protected static function strikeRoot(&$ary, $oid) {
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) return false;
 
$dotstop = self::appendDot($oid);
foreach ($ary as &$a) {
if (($a == $oid) || (self::beginsWith($a, $dotstop))) {
$a = null;
}
}
unset($a);
}
 
public function findRoots($check_auth=true) {
$out = array();
 
$ary = $this->getAllOIDs($check_auth);
 
while (($oid = $this->getShortestString($ary)) !== false) {
$out[] = $oid;
$this->strikeRoot($ary, $oid);
}
 
oidSort($out);
 
return $out;
}
 
public static function findSearchProvider($nid) {
$found_prov = null;
foreach (self::$searchProvs as &$searchprov) {
if ($searchprov->checkId($nid)) {
$found_prov = $searchprov;
break;
}
}
unset($searchprov);
 
return $found_prov;
}
 
public function findOID(&$indexname, $check_auth=true) {
$lowest_oid = null;
$lowest_dist = PHP_INT_MAX;
$lowest_nid = null;
$oids = $this->getAllOIDs($check_auth);
 
$ary = explode(':', $indexname, 2);
if (count($ary) == 2) {
$suggested_nid = $ary[0]; // This does not neccessarily be a searchprovider NID, since it could also be a part of an IPv6 address
$found_prov = self::findSearchProvider($suggested_nid);
if (!is_null($found_prov)) {
$indexname = $ary[1];
} else {
// No search provider was found. We don't strip the text before ':', because it
// could be actually a part of the index name, e.g. for an IPv6
# $indexname = $ary[1];
}
} else {
$suggested_nid = '';
$found_prov = null;
}
 
$has_preferred_prov = !is_null($found_prov);
 
foreach ($oids as &$oid) {
$search_data = $this->getDatasets($oid, 'index'); # todo: wird [co] beachtet?
foreach ($search_data as &$data) {
$nid = $data['attrib_params'][0];
$value = $data['value'];
 
 
if (!$has_preferred_prov) $found_prov = self::findSearchProvider($nid);
 
if (!is_null($found_prov)) {
$cur_distance = $found_prov->calcDistance($value, $indexname);
if ($cur_distance === false) continue;
if ($cur_distance < 0) continue; // item is too specific for the request
// else if ($cur_distance == 0) return array($oid, 0, $nid);
else if ($cur_distance < $lowest_dist) {
$lowest_dist = $cur_distance;
$lowest_oid = $oid;
$lowest_nid = $nid;
if ($cur_distance == 0) break 2;
}
} else {
// We don't have a Searchprovider, but we can look for an index which matches exactly
if ($suggested_nid == $nid) {
$indexname = isset($ary[1]) ? $ary[1] : '';
}
if ($value == $indexname) {
$lowest_dist = 0;
$lowest_oid = $oid;
$lowest_nid = $nid;
break 2;
}
}
}
unset($data);
}
unset($oid);
 
if (is_null($lowest_oid)) return null;
return array($lowest_oid, $lowest_dist, $lowest_nid);
}
 
private $cache_listOIDs = array();
public function listOIDs($parent_oid, $absolute=true, $depth=-1, $check_auth=true) {
$parent_oid = sanitizeOID($parent_oid, substr($parent_oid,0,1) == '.');
if ($parent_oid === false) return false;
 
$vvv = ($absolute ? 'T' : 'F').($check_auth ? 'T' : 'F').$depth.'/'.$parent_oid;
if (isset($this->cache_listOIDs[$vvv])) return $this->cache_listOIDs[$vvv];
 
$dotstop = self::appendDot($parent_oid);
 
$oids = $this->getAllOIDs($check_auth);
 
$out = array();
foreach ($oids as &$oid) {
if (self::beginsWith($oid, $dotstop)) {
if ($depth >= 0) {
if (substr_count($oid, '.')-substr_count($dotstop, '.') > $depth-1) continue;
}
if ($absolute) {
$out[] = $oid;
} else {
$out[] = substr($oid, strlen($dotstop));
}
}
}
unset($oid);
 
$this->cache_listOIDs[$vvv] = $out;
return $out;
}
 
public function listChildren($parent_oid, $levels=-1, $check_auth=true) {
if ($levels == 0) return false;
 
$parent_oid = sanitizeOID($parent_oid, substr($parent_oid,0,1) == '.');
if ($parent_oid === false) return false;
 
$deepChildrenSearch = $this->listOIDs($parent_oid, false, -1, $check_auth);
if (count($deepChildrenSearch) == 0) return array();
 
$firstarcs = array();
foreach ($deepChildrenSearch as &$child) {
$ary = explode('.', $child, 2);
$firstarc = $ary[0];
if ($firstarc == '') continue; # Achtung: Darf nicht empty() sein, da empty(0)===true
 
# if (!in_array($firstarc, $firstarcs)) $firstarcs[] = $firstarc; # slow
if (!isset($firstarcs[$firstarc])) $firstarcs[$firstarc] = true;
}
unset($child);
# sort($firstarcs);
ksort($firstarcs);
 
$dotstop = self::appendDot($parent_oid);
 
$out = array();
# foreach ($firstarcs as &$firstarc) {
foreach ($firstarcs as $firstarc => &$dummy) {
 
 
/* This doesn't work with orphan OIDs
$firstarcs = $this->listOIDs($parent_oid, false, 1, $check_auth);
if (count($firstarcs) == 0) return array();
 
sort($firstarcs);
 
$dotstop = self::appendDot($parent_oid);
 
$out = array();
foreach ($firstarcs as &$firstarc) {
*/
$cur_oid = $dotstop.$firstarc;
 
$out[$firstarc] = array(
'children' => $this->listChildren($cur_oid, $levels-1, $check_auth),
'described' => $this->oidDescribed($cur_oid, $check_auth),
'identifiers' => $this->getIdentifiers($cur_oid, $check_auth),
'unicodelabels' => $this->getUnicodeLabels($cur_oid, $check_auth),
'attributes' => $this->getOIDAttribs($cur_oid, $check_auth)
);
}
 
return $out;
}
 
/* protected */ public function getIdentifiers($oid, $check_auth=true) {
// TODO: value sanity check
return $this->getValuesOf($oid, 'identifier', $check_auth);
}
 
/* protected */ public function getUnicodeLabels($oid, $check_auth=true) {
// TODO: value sanity check
return $this->getValuesOf($oid, 'unicodelabel', $check_auth);
}
 
/* protected */ public function getOIDAttribs($oid, $check_auth=true) {
return $this->getValuesOf($oid, 'attribute', $check_auth, 1);
}
 
// case 0 = preserve TODO: als konstanten auslagern
// case 1 = upper case
// case 2 = lower case
/* protected */ public function getValuesOf($oid, $attrib_name, $unique=true, $case=0) {
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) return false;
 
$identifiers = array();
$identifiers_raw = $this->getDatasets($oid, $attrib_name);
foreach ($identifiers_raw as &$idd) {
$val = $idd['value'];
if ($case == 1) $val = strtoupper($val);
elseif ($case == 2) $val = strtolower($val);
$identifiers[] = $val;
}
unset($idd);
 
if ($unique) $identifiers = array_unique($identifiers);
 
return $identifiers;
}
 
/* protected */ public function getValues($oid, $attribute_name) {
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) return false;
 
$values = array();
$values_raw = $this->getDatasets($oid, $attribute_name);
foreach ($values_raw as &$idd) {
$values[] = $idd['value'];
}
unset($idd);
return $values;
}
 
public function oidDescribed($oid, $check_auth=true) {
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) return false;
 
if ($check_auth) {
$m = $this->getDatasets($oid, '', $check_auth);
$c = 0;
foreach ($m as &$data) {
if ($this->isSpecialInvisibleField($data)) continue;
$c++;
}
if ($c == 0) return false; // secret OID or not available OID
}
 
return isset($this->oid_data[$oid]); # TODO: was ist wenn OID secret?
}
 
public function getDatasets($oid, $attrib_name='', $check_auth=true) { // TODO filter nach params, value?
$out = array();
$ary = $this->rec_getDatasets($oid, $attrib_name, $check_auth);
foreach ($ary as &$d) {
if ((!empty($attrib_name)) && ($d['attrib_name'] != $attrib_name)) continue;
$out[] = $d;
}
return $out;
}
 
public function stripAttribs($oid, $attrib_name, $limit=-1) {
$count = 0;
foreach ($this->oid_data[$oid] as $n => $data) { // no &$data
if (empty($attrib_name) || ($data['attrib_name'] == $attrib_name)) {
$count++;
if (($limit >= 0) && ($count > $limit)) break;
unset($this->oid_data[$oid][$n]);
}
}
}
 
private $cache_recdatasets = array();
 
# FUT QUE: return by reference?
protected function rec_getDatasets($oid, $attrib_name='', $check_auth=true) { // TODO filter nach params, value?
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) {
throw new VolcanoException("'$oid' is not a valid OID."); # TODO: exception source ("stacktrace") metadata -- idee: global $source variable?
}
 
$vvv = $oid.'/'.$attrib_name.'/'.($check_auth ? 'T' : 'F');
if (isset($this->cache_recdatasets[$vvv])) return $this->cache_recdatasets[$vvv];
 
if (!$this->oidDescribed($oid, false)) return array();
 
$out = array();
foreach ($this->oid_data[$oid] as $data) { // no &$data
if ($check_auth) {
# Anstelle *invisible lieber ein "attribute:" ? ist leider schwieriger zu bedienen , z.b. wenn man es wieder weghaben möchte
if (($data['attrib_name'] == '*invisible') && ($data['value'] == '1')) {
if ($this->isAuthentificated($oid)) { # TODO: parameter, für was man sich authentifizieren möchte (read,write, etc).
$dd = $data; // TODO: OK?
$dd['attrib_name'] = 'attribute';
$dd['value'] = 'INVISIBLE';
$dd['flag_inherit'] = $data['flag_inherit'];
$dd['flag_add'] = $data['flag_add']; # TODO: ok?
$dd['attrib_params'] = array();
$dd['source'] = $data['source'];
# TODO: weitere dinge in $dd notwendig?
$out[] = $dd;
} else {
$this->cache_recdatasets[$vvv] = array($data);
return array($data);
}
}
 
if (($data['flag_confidential']) && (!$this->isAuthentificated($oid))) {
if (!$this->isRedactedMessageEnabled()) {
continue; // hide complete line
} else {
$data['value'] = $this->redactedMessage;
}
}
}
 
if ((!empty($attrib_name)) && ($data['attrib_name'] != $attrib_name)) continue;
 
// Add it to output
if (!$data['flag_del']) $out[] = $data;
}
unset($data);
 
// Get the inherited fields
if ($oid != '.') {
$ori_oid = $oid;
while ($oid != '.') {
$oid = oid_up($oid);
if ($this->oidDescribed($oid, false)) break;
}
$ds = $this->rec_getDatasets($oid, $attrib_name, $check_auth);
foreach ($ds as &$d) {
if ($d['flag_inherit']) {
// Only inherit if it isn't overwritten
$is_overwritten = false;
 
foreach ($this->oid_data[$ori_oid] as &$x) { // $d = diese oid ; $x = vater oid
#/*
// compare single fields to each other (may also include fields that were extended from a macro)
if ($x['attrib_name'] == $d['attrib_name']) { # todo: case sensitive?
$is_overwritten = true;
break;
}
#*/
 
if ($x['attrib_name'] == $d['flag_inherit']) { # todo: case sensitive?
$is_overwritten = true;
break;
}
 
// ein ganzer [xt] block wird inherited, z.B. "ra". nicht die einzelnen felder einzeln behandeln.
if ($x['flag_inherit'] == $d['flag_inherit']) { # todo: case sensitive?
$is_overwritten = true;
break;
}
}
 
if ($x['flag_add']) {
$is_overwritten = false;
}
 
if ($is_overwritten) continue;
 
if ($check_auth) {
if (($d['attrib_name'] == '*invisible') && ($d['value'] == '1')) {
if ($this->isAuthentificated($oid)) {
$dd['attrib_name'] = 'attribute';
$dd['value'] = 'INVISIBLE';
$dd['flag_inherit'] = $d['flag_inherit'];
$dd['flag_add'] = $d['flag_add']; # TODO: ok?
$dd['attrib_params'] = array();
# $out[] = $dd;
} else {
$this->cache_recdatasets[$vvv] = array($d);
return array($d);
}
}
}
 
// Add to output
if (!$d['flag_del']) $out[] = $d;
}
}
}
 
$this->cache_recdatasets[$vvv] = $out;
return $out;
}
 
// TODO: iso.org auch aufloesen und standardized
public function resolveIdentifiers($term) {
$ary = explode('.', $term);
$cd = $this->listChildren('.');
 
foreach ($ary as $n => &$a) {
if ($n == 0) continue;
if (!is_numeric($a[0])) {
if (is_null($cd)) return false; // TODO FUT: loessen durch referenzierende whois server (forward)?
$found = false;
foreach ($cd as $arc => &$data) {
foreach ($data['identifiers'] as &$idc) {
if ($idc == $a) {
$a = $arc;
$found = true;
break 2;
}
}
}
unset($data);
if (!$found) return false;
}
$cd = (!isset($cd[$a]['children'])) ? null : $cd[$a]['children'];
}
unset($a);
 
return implode('.', $ary);
}
 
// --------- STATIC
 
protected static $searchProvs = array();
protected static $authProvs = array();
 
public static function getFileformatIdentifier() {
return '1.3.6.1.4.1.37476.2.5.1.1.2';
}
 
public static function registerSearchProvider($prov) {
self::$searchProvs[] = $prov;
}
 
public static function registerAuthProvider($prov) {
self::$authProvs[] = $prov;
}
 
protected static function appendDot($oid) {
return ($oid == '.') ? '.' : $oid . '.';
}
 
// TODO: functions.inc.php
protected static function beginsWith($haystack, $needle) {
# http://maettig.com/code/php/php-performance-benchmarks.php
return strpos($haystack, $needle) === 0;
}
 
// TODO: functions.inc.php
protected static function endsWith($haystack, $needle) {
# $length = strlen($needle);
# if ($length == 0) return true;
# return (substr($haystack, -$length) === $needle);
return substr($haystack, -strlen($needle)) === $needle;
}
}
/trunk_oldversion/core/2_OIDPlus.class.php
0,0 → 1,612
<?php
 
# TODO:
# <oid1>
# ...
# <orphan>
 
// TODO: {...} = ein link zu einer whois query
 
// TODO !list auch ohne oidplus:
 
# todo: auch "oid:" erlauben (ohne beginning dot)
 
# TODO is_numeric() nicht verwenden bei oidutils... stattdessen [0-9]+
 
// TODO: suchen nach eigenschaften, z.b. created:2012-...
# todo: exceptions im frontent oder false results?
# todo: was ist private, was protected?
# todo: ismU ohne m etc
# todo: headless camel notation
# todo: distance funktion: (a,b) und (b,a) syntax nicht eindeutig... mal so mal so. (plugins/*.php und ipv?_functions.php)
 
# todo: extends ok oder ist es keine oop-erweiterung?
require_once __DIR__ . '/1_VolcanoDB.class.php';
class OIDPlus extends VolcanoDB {
protected function displayLine($oid) {
$described = $this->oidDescribed($oid);
$identifiers = $this->getIdentifiers($oid);
$oid_attribs = $this->getOIDAttribs($oid);
 
$out = $oid;
 
$oidary = explode('.', $oid);
$lastarc = $oidary[count($oidary)-1];
if (count($identifiers) == 0) {
$out .= " $lastarc";
} else {
foreach ($identifiers as $n => $i) {
if ($n != 0) $out .= " |";
$out .= " $i($lastarc)";
}
}
if (count($oid_attribs) > 0) {
$out .= " [".implode(',',$oid_attribs)."]";
}
if (!$described) $out .= " [not described]";
# TODO: '...' anzeigen zwischen einer OID und einer orphan OID?
return $out;
}
 
protected function rec_show($oid, &$out, $desc='', $levels=-1) {
$x = $this->listAllOIDs($oid, $levels);
foreach ($x as $oid) {
$out .= $desc . $this->displayLine($oid) . "\n";
}
unset($x);
}
 
protected function rec_listAllOIDs($oid, &$out, $levels=-1) {
$children = $this->listChildren($oid, $levels);
if ($children === false) {
#echo "...\n"; # TODO problem, es ist ungewiss ob noch was untergeordnet ist!
return;
}
 
foreach ($children as $num => &$data) {
$dotstop = self::appendDot($oid);
$cur_oid = $dotstop.$num;
$out[] = $cur_oid;
$this->rec_listAllOIDs($cur_oid, $out, $levels-1);
}
unset($data);
}
 
public function listAllOIDs($oid, $levels=-1) {
$out = array();
$this->rec_listAllOIDs($oid, $out, $levels);
return $out;
}
 
/* TODO: das wäre einfacherer, aber das geht nicht mit orphan OIDS !!!
public function listAllOIDs($parent_oid, $depth=-1, $check_auth=true) {
return $this->listOIDs($parent_oid, true, $depth=-1, $check_auth=true);
}
*/
 
public function count_roots() {
return count($this->findRoots());
}
 
public function count_oids() {
$oids = $this->getAllOIDs();
return count($oids);
}
 
public function count_indexes() {
$cnt = 0;
$oids = $this->getAllOIDs();
foreach ($oids as &$oid) {
$arys = $this->getDatasets($oid, 'index');
if (count($arys) > 0) $cnt++;
}
return $cnt;
}
 
protected function sc_listIndexes() {
$out = '';
# TODO: + oid anzeigen?
$oids = $this->getAllOIDs();
foreach ($oids as &$oid) {
$arys = $this->getDatasets($oid, 'index');
foreach ($arys as &$ary) {
if (!isset($ary['attrib_params'][0])) {
throw new VolcanoException('index() field without any param', $ary);
}
$nid = $ary['attrib_params'][0];
$val = $ary['value'];
# TODO: domain mit puny-decoding?
$out .= "index($nid):$val\n";
}
}
return $out;
}
 
protected function sc_listRoots() {
$out = '';
$roots = $this->findRoots();
foreach ($roots as &$root) {
$out .= "oid:" . $this->displayLine($root) . "\n"; # todo "oid:" mittels maketabs alignen
}
return $out;
}
 
protected function sc_list($show_complete_tree = false) {
$out = '';
if ($show_complete_tree) {
$roots = array('.');
} else {
$roots = $this->findRoots();
}
$first = true;
foreach ($roots as &$root) {
// Auskommentiert: Abstand zwischen den OIDs von 2 Roots lassen
// if (!$first) echo "\n";
$first = false;
$out .= "oid:" . $this->displayLine($root) . "\n";
$this->rec_show($root, $out, "oid:");
}
 
$out2 = array();
$max_len_oid = 0;
$max_dep_oid = 0;
$min_dep_oid = PHP_INT_MAX;
$lines = explode("\n", trim($out));
foreach ($lines as &$x) {
$m = explode(' ', $x, 2);
$oid = substr($m[0], 4);
$len = strlen($oid);
$dep = oid_len($oid);
$entry = isset($m[1]) ? $m[1] : '';
$out2[] = array($len, $dep, $oid, $entry);
if ($len > $max_len_oid) $max_len_oid = $len;
if ($dep > $max_dep_oid) $max_dep_oid = $dep;
if ($dep < $min_dep_oid) $min_dep_oid = $dep;
}
 
$out = '';
foreach ($out2 as &$data) {
$len = $data[0];
$dep = $data[1];
$oid = $data[2];
$entry = $data[3];
 
if (empty($entry)) $entry = '<no identifier>';
 
$oid = str_pad($oid, $max_len_oid);
$entry = str_repeat('. ', $dep-$min_dep_oid).$entry;
 
$out .= "oid:$oid | $entry\n";
}
 
unset($root);
return $out;
}
 
protected static function help() {
// TODO syntax for searching
echo "System commands:\n";
echo "\thelp\n";
echo "\toidplus:!list [#<authtoken>[,<authtoken>[,...]]]\n";
echo "\toidplus:!listRoots [#<authtoken>[,<authtoken>[,...]]]\n";
echo "\toidplus:!listIndexes [#<authtoken>[,<authtoken>[,...]]]\n";
# todo: listAll
echo "\toidplus:!help\n";
echo "\n";
echo "Seaching for indexed items (index attribute):\n";
echo "\toidplus:<index> [#<authtoken>[,<authtoken>[,...]]]\n";
echo "\n";
echo "Lookup a single OID:\n";
echo "\toidplus:.2.999 [#<authtoken>[,<authtoken>[,...]]]\n";
echo "\toidplus:.2.example [#<authtoken>[,<authtoken>[,...]]]\n";
}
 
# todo: kein echo sondern string return?
public function query($q) {
$q = trim($q);
 
# echo "Process query '$q'\n\n";
 
$this->clearAuthTokens();
 
if ($q == 'help') {
return self::help();
}
 
if (!preg_match('@^oidplus:([^#]+)(#([^#]*)){0,1}$@ismU', $q, $m)) {
# return false;
 
# TODO: eigentlich sollte die syntax nicht willkürlich sein
# lieber "oid:(non-dotted-oid without authToken and no indexes)
# $q = preg_replace('@^oidplus:@isU', '', $q);
# $q = preg_replace('@^(urn:){0,1}oid:@isU', '.', $q);
$q = preg_replace('@^(urn:){0,1}oid:@isU', '', $q);
if (oid_valid_dotnotation($q, true, false) && ($q[0] != '.')) $q = ".$q";
 
$q = "oidplus:$q";
return $this->query($q);
} else {
$q = trim($m[1]);
$pins = (isset($m[3])) ? trim($m[3]) : null;
 
if (oid_valid_dotnotation($q, true, false) && ($q[0] != '.')) $q = ".$q";
}
 
if (!is_null($pins)) {
$pins = explode(',', $pins);
foreach ($pins as &$pin) {
$this->addAuthToken($pin);
}
unset($pin);
}
 
if ($q[0] == '!') {
$syscommand = trim(substr($q, 1));
if ($syscommand == 'help') {
return self::help();
} else if ($syscommand == 'list') {
$out = self::sc_list();
echo self::make_tabs($out);
return;
} else if ($syscommand == 'listRoots') {
$out = self::sc_listRoots();
echo self::make_tabs($out);
return;
} else if ($syscommand == 'listIndexes') {
$out = self::sc_listIndexes();
echo self::make_tabs($out);
return;
} else {
// TODO error
return false;
}
} else if ($q[0] == '.') {
// Single OID
// TODO auch ohne leading dot?
 
echo self::make_tabs($this->showSingleOID($q));
return;
} else {
// Indexed name (string, ipv4, ipv6, domain, doi, guid, ...)
 
$prefix = '';
$ary = $this->findOID($q);
if ($ary) {
$oid = $ary[0];
$dist = $ary[1];
$nid = $ary[2];
 
if ($dist > 0) {
$prefix .= "searchterm:$q\n";
$prefix .= "search-result:Did not find an exact match for the given searchterm, but found a superior node\n";
$prefix .= "distance($nid):$dist\n";
$prefix .= "\n";
}
 
echo self::make_tabs($this->showSingleOID($oid, $prefix));
return;
} else {
$prefix .= "searchterm:$q\n";
# $prefix .= "search-result:Not found\n";
$prefix .= "search-result:No exact match and no superior node was found\n";
echo self::make_tabs($prefix);
}
}
}
 
public static function filterOutput($output, $name, $preg=false, $including_name=true) {
$out = '';
 
$lines = explode("\n", $output);
foreach ($lines as $line) {
$line = trim($line);
if ($line == '') continue;
$name_val = explode(':', $line, 2);
if (count($name_val) != 2) continue;
if ($preg) {
$ok = preg_match($name, $name_val[0], $m);
} else {
$ok = $name == trim($name_val[0]);
}
if ($ok) {
if ($including_name) {
$out .= $line."\n";
} else {
$out .= $name_val[1]."\n";
}
}
 
}
 
return $out;
}
 
const SEG_OIDINFO = 2;
const SEG_OIDDATA = 4;
const SEG_IDX_BROWSER = 8;
const SEG_OID_BROWSER = 16;
/*protected*/ public function showSingleOID($oid, $prefix='', $segments = self::SEG_OIDINFO+self::SEG_OIDDATA+self::SEG_IDX_BROWSER+self::SEG_OID_BROWSER, $make_tabs=true) {
if (!oid_valid_dotnotation($oid, true, substr($oid,0,1) == '.')) {
throw new VolcanoException("OID '$oid' is invalid");
}
 
$out_segs = array();
 
$oid = sanitizeOID($oid, substr($oid,0,1) == '.');
if ($oid === false) return false;
 
// --- Segment 1 ---
 
if (($segments & self::SEG_OIDINFO) == self::SEG_OIDINFO) {
$out = "oid:$oid\n"; # TODO: soll das "searchterm" heißen, wenn nur superior node gefunden wurde?
 
# TODO: nach search-result: verschieben?
foreach (self::$fieldExtenders as $fe) {
$x = array();
$fe->processOID($oid, $x, $this);
if (count($x) > 0) {
$out .= implode("\n", $x)."\n";
}
}
 
if ($this->oidDescribed($oid)) {
$out .= "search-result:Found\n";
} else {
# TODO: wenn der user eine ungültige oid eingibt, dann keinen "internal error" werfen
$out .= "search-result:Not found\n";
}
 
$out_segs[] = $out;
}
 
// --- Segment 2 ---
 
if (($segments & self::SEG_OIDDATA) == self::SEG_OIDDATA) {
$out = '';
$x = $this->getDatasets($oid);
foreach ($x as &$y) {
if ($this->isSpecialInvisibleField($y)) continue; // system fields, like '*read-auth' are invisible
$out .= $y['attrib_name'];
if (count($y['attrib_params']) > 0) $out .= '('.implode(',', $y['attrib_params']).')';
$out .= ':'.$y['value']."\n"; # todo: +params? TEST.
}
 
$out_segs[] = $out;
}
 
# --- Segment 3: Index-Navigation ---
 
if (($segments & self::SEG_IDX_BROWSER) == self::SEG_IDX_BROWSER) {
$index_browser_ns = '';
$index_browser_val = '';
$index_browser_found = false;
if (isset($this->oid_data[$oid])) {
foreach ($this->oid_data[$oid] as $tmp) {
if ($tmp['attrib_name'] == 'index') {
if (!isset($tmp['attrib_params'][0])) continue; # TODO: exception?
$index_browser_ns = $tmp['attrib_params'][0];
 
# $index_browser_val = $tmp['value'];
if (($tmp['flag_confidential']) && (!$this->isAuthentificated($oid))) {
if (!$this->isRedactedMessageEnabled()) {
continue; // hide complete line
} else {
$index_browser_val = $this->redactedMessage;
}
} else {
$index_browser_val = $tmp['value'];
}
 
$index_browser_found = true;
break;
}
}
}
 
if (($index_browser_found) && ($found_prov = self::findSearchProvider($index_browser_ns))) {
$out = '';
 
$nearest_father = array(false, PHP_INT_MAX, '');
$subs = array();
 
$index_ns_root = oid_up($oid);
 
$cry = $this->listChildren($index_ns_root, 1);
foreach ($cry as $num => $c) {
$oid_2 = $index_ns_root.'.'.$num;
 
$index_browser_ns_2 = '';
$index_browser_val_2 = '';
$index_browser_found_2 = false;
foreach ($this->oid_data[$oid_2] as $tmp_2) {
if ($tmp_2['attrib_name'] == 'index') {
if (!isset($tmp_2['attrib_params'][0])) continue; # TODO: exception?
$index_browser_ns_2 = $tmp_2['attrib_params'][0];
 
# $index_browser_val_2 = $tmp_2['value'];
if (($tmp_2['flag_confidential']) && (!$this->isAuthentificated($oid_2))) {
if (!$this->isRedactedMessageEnabled()) {
continue; // hide complete line
} else {
$index_browser_val_2 = $this->redactedMessage;
}
} else {
$index_browser_val_2 = $tmp_2['value'];
}
 
$index_browser_found_2 = true;
break;
}
}
 
if ($index_browser_found_2) {
$cur_distance = $found_prov->calcDistance($index_browser_val, $index_browser_val_2);
 
if ($index_browser_val == $index_browser_val_2) continue;
 
if ($cur_distance === false) continue;
 
if ($cur_distance < 0) {
if (abs($cur_distance) < $nearest_father[1]) {
$nearest_father[0] = true;
$nearest_father[1] = abs($cur_distance);
$nearest_father[2] = array($index_browser_val_2);
} else if (abs($cur_distance) == $nearest_father[1]) {
$nearest_father[2][] = $index_browser_val_2;
}
} else if ($cur_distance > 0) {
$subs[] = $index_browser_val_2;
}
}
}
 
# TODO FUT: brothers (selbe dist zum vater)
 
// Nur die untergeordneten Knoten anzeigen, zwischen denen kein weiterer Knoten zu unserem Knoten besteht.
// K <-- a <-- a' <-- a''
// <-- b <-- b'
// <-- c
// => Wähle a, b, c
foreach ($subs as &$sub1) {
foreach ($subs as &$sub2) {
if ($sub1 == $sub2) continue;
 
$dist = ($found_prov->calcDistance($sub1, $sub2));
if ($dist === false) continue;
if ($dist > 0) $sub2 = null;
}
}
 
if ($nearest_father[0]) {
foreach ($nearest_father[2] as $tmp) {
$out .= "father-index($index_browser_ns):$tmp\n";
}
}
$out .= "self-index($index_browser_ns):$index_browser_val\n";
foreach ($subs as $tmp) {
if (is_null($tmp)) continue;
$out .= "son-index($index_browser_ns):$tmp\n";
}
 
$out_segs[] = $out;
}
}
 
# --- Segment 4: OID Navigation ---
 
if (($segments & self::SEG_OID_BROWSER) == self::SEG_OID_BROWSER) {
$out = '';
 
// Show father
if ($oid != '.') {
// $out .= "father:" . $this->displayLine(oid_up($oid)) . "\n";
$i=0;
$cur_oid = $oid;
$father_out = '';
 
$tmp_table = array();
 
while ($cur_oid != '.') {
$i++;
$cur_oid = oid_up($cur_oid);
$tmp_table[] = array($this->oidDescribed($cur_oid), "superior-node($i):" . $this->displayLine($cur_oid));
}
 
$described_once = false;
for ($i=count($tmp_table)-1; $i>=0; $i--) {
$t = $tmp_table[$i];
 
$is_desc = $t[0];
$line = $t[1];
 
if ($is_desc) $described_once = true;
 
if ($is_desc || $described_once ) {
$father_out .= "$line\n";
}
}
 
$out .= $father_out;
}
 
// Show current OID
$out .= "current-node:" . $this->displayLine($oid) . "\n";
 
// Show first level children (also undescribed ones)
$x = $this->listChildren($oid, 1);
foreach ($x as $num => &$data) {
$dotstop = self::appendDot($oid);
$cur_oid = $dotstop.$num;
$out .= "child-node:" . $this->displayLine($cur_oid) . "\n";
}
 
$out_segs[] = $out;
 
// Brothers
 
$out = '';
 
$x = $this->listChildren(oid_up($oid), 1);
foreach ($x as $num => &$data) {
$dotstop = self::appendDot(oid_up($oid));
$cur_oid = $dotstop.$num;
if ($cur_oid != $oid) $out .= "brother:" . $this->displayLine($cur_oid) . "\n";
}
 
$out_segs[] = $out;
}
 
// --- Output ---
 
$out = $prefix;
$first = true;
foreach ($out_segs as $seg) {
if (!$first) {
$out .= ":----------------------\n"; # TODO: max len of output
}
$out .= $seg;
$first = false;
}
 
if ($make_tabs) {
$out = self::make_tabs($out);
}
 
return $out;
}
 
# http://whois.viathinksoft.de/gwhois_fork/showcode/?fn=package%2Fshare%2Fsubprograms%2Ffunctions.inc.php
# Changed: $abstand default 4->2, oop, +$mindestbreite
protected static function make_tabs($text, $abstand = 2, $mindestbreite = 0) {
$ary = explode("\n", $text);
$longest = 0;
foreach ($ary as &$a) {
$bry = explode(':', $a, 2);
if (count($bry) < 2) continue;
$c = strlen($bry[0]);
if ($c > $longest) $longest = $c;
}
if ($longest < $mindestbreite) $longest = $mindestbreite;
foreach ($ary as $n => &$a) {
$bry = explode(':', $a, 2);
if (count($bry) < 2) continue;
$rep = $longest-strlen($bry[0]) + $abstand;
if ($rep < 1) {
$wh = '';
} else {
$wh = str_repeat(' ', $rep);
}
$ary[$n] = ($bry[0] != '' ? $bry[0].':' : ' ').$wh.trim($bry[1]);
}
$x = implode("\n", $ary);
return $x;
}
 
 
protected static $fieldExtenders = array();
 
public static function registerFieldExtender($prov) {
self::$fieldExtenders[] = $prov;
}
 
}
/trunk_oldversion/core/OIDPlusFieldExtenders.class.php
0,0 → 1,5
<?php
 
interface OIDPlusFieldExtenders {
static function processOID($oid, &$out, &$oidplusobj);
}
/trunk_oldversion/core/VolcanoAuthProvider.class.php
0,0 → 1,7
<?php
 
interface VolcanoAuthProvider {
static function checkId($id);
static function checkAuth($candidate, $token);
 
}
/trunk_oldversion/core/VolcanoException.class.php
0,0 → 1,21
<?php
 
class VolcanoException extends Exception {
 
function __construct($message, $metadata=array()) {
$msg = $message;
if (isset($metadata['oid'])) $msg .= " for OID ".$metadata['oid'];
if (isset($metadata['macro'])) $msg .= " for Macro ".$metadata['macro'];
if (isset($metadata['source'])) $msg .= " at ".$this->showSource($metadata['source']);
 
parent::__construct($msg);
}
 
protected static function showSource($source) {
if (strpos($source, ':') === false) return $source;
preg_match('@^(.+):(\\d+)$@', $source, $m);
$file = $m[1];
$line = $m[2];
return "$file at line $line";
}
}
/trunk_oldversion/core/VolcanoSearchProvider.class.php
0,0 → 1,6
<?php
 
interface VolcanoSearchProvider {
static function checkId($id);
static function calcDistance($candidate, $searchterm);
}
/trunk_oldversion/db/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk_oldversion/db/_contacts.db
0,0 → 1,53
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
# MACROS
 
# The same address is used in several contact macros (:C_...)
*macro:ADDR_MAR ??-name:Daniel Marschall
*macro:ADDR_MAR ??-org:ViaThinkSoft
*macro:ADDR_MAR ??-address:Example street 1
*macro:ADDR_MAR ??-address:Example town
*macro:ADDR_MAR ??-country:DE
*macro:ADDR_MAR [co]??-phone:+49 1234 5678
*macro:ADDR_MAR [co]??-fax:+49 1234 5678
*macro:ADDR_MAR ??-email:info@example.com
*macro:ADDR_MAR ??-changed:2016-02-16
 
# Macro "VTS" used as RA
*macro:C_VTS ??-name:ViaThinkSoft OID Registration Authority
*macro:C_VTS ??-email:oidra@viathinksoft.de
*macro:C_VTS ??-person[xt]:ADDR_MAR
 
# Macro "MAR" used as RA
*macro:C_MAR ??-name:Daniel Marschall Private OID Registration Authority
*macro:C_MAR ??-email:daniel-marschall@example.com
*macro:C_MAR ??-person[xt]:ADDR_MAR
 
# Macro for OIDs without an RA
*macro:C_NOBODY ??-name:No Registration Authority known!
 
*macro:ADDR_VNE ??-name:Victor-Philipp Negoescu
*macro:ADDR_VNE ??-org:ViaThinkSoft
*macro:ADDR_VNE [co]??-address:Example street 2
*macro:ADDR_VNE [co]??-address:Example town
*macro:ADDR_VNE ??-country:DE
*macro:ADDR_VNE [co]??-phone:+49 1234 5678
*macro:ADDR_VNE ??-email:victor@example.com
*macro:ADDR_VNE ??-changed:2012-11-19 23:57:28 GMT
 
*macro:ADDR_MD ??-name:Michael Düpjohann
*macro:ADDR_MD ??-org:MD-Technologie
*macro:ADDR_MD [co]??-address:Example street 3
*macro:ADDR_MD [co]??-address:Example town
*macro:ADDR_MD ??-country:DE
*macro:ADDR_MD [co]??-phone:+49 1234 5678
*macro:ADDR_MD ??-email:md@example.com
*macro:ADDR_MD ??-changed:2018-07-12 13:26:28 GMT
 
*macro:ADDR_THOMMY ??-name:Thomas Bretzke
*macro:ADDR_THOMMY ??-org:taccon software development
*macro:ADDR_THOMMY [co]??-address:Example street 4
*macro:ADDR_THOMMY [co]??-address:Example town
*macro:ADDR_THOMMY ??-country:DE
*macro:ADDR_THOMMY ??-email:thomas@example.com
*macro:ADDR_THOMMY ??-changed:2018-07-12 13:33:28 GMT
/trunk_oldversion/db/_genroot.db
0,0 → 1,15
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:<GENROOT> name:OID+ Generation Root
# kein asn1id, da einzigartigkeit nicht garantiert (z.b. wenn genroot=2.25)
#oid:<GENROOT> identifier:oidgenroot
 
oid:<GENROOT>.0 identifier:ns
oid:<GENROOT>.0 description:User defined namespaces.
 
oid:<GENROOT>.10 identifier:doi
oid:<GENROOT>.10 description:Children are 10.<orgid>.<suffix-sha1-uuid>
oid:<GENROOT>.10 description:Digital Object Identifier (DOI) information objects mapped to the OID tree.
 
oid:<GENROOT>.25 identifier:uuid
oid:<GENROOT>.25 description:Universally Unique Identifier (UUID) information objects mapped to the OID tree.
/trunk_oldversion/db/_macro_domains.db
0,0 → 1,24
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
# Macro MACRO_DOMAIN <domainname_without_tld> <tld> <status>
*macro:MACRO_DOMAIN status:__3__
*macro:MACRO_DOMAIN type:domain
*macro:MACRO_DOMAIN domain:__1__.__2__
*macro:MACRO_DOMAIN identifier:__1__
*macro:MACRO_DOMAIN index(domain):__1__.__2__.
 
# Macro PRICE_PROSITE_DE
*macro:PRICE_PROSITE_DE price(eur/month):0.39
*macro:PRICE_PROSITE_DE price(eur/once):3.95
 
# Macro MACRO_DOMAIN_PROSITE_DE <domainname_without_tld> <status>
*macro:MACRO_DOMAIN_PROSITE_DE [xt]domain:MACRO_DOMAIN __1__ de __2__
*macro:MACRO_DOMAIN_PROSITE_DE [xt]price:PRICE_PROSITE_DE
 
# Macro PRICE_PROSITE_COM
*macro:PRICE_PROSITE_COM price(eur/month):0.75
*macro:PRICE_PROSITE_COM price(eur/once):9.90
 
# Macro MACRO_DOMAIN_PROSITE_COM <domainname_without_tld> <status>
*macro:MACRO_DOMAIN_PROSITE_COM [xt]domain:MACRO_DOMAIN __1__ com __2__
*macro:MACRO_DOMAIN_PROSITE_COM [xt]price:PRICE_PROSITE_COM
/trunk_oldversion/db/amatch.db
0,0 → 1,35
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.9000.58.1 identifier:amatch
oid:.1.3.6.1.4.1.37476.9000.58.1 description:Artist-Commissioner Matching Algorithms
 
oid:.1.3.6.1.4.1.37476.9000.58.1.1 identifier:offerAndRequest
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:Offer and Request matching object
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:Requestors (usually commissioners) and offerors (usually artists) share this object.
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:The object contains things like type of artwork, classification and price.
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:The subordinate OIDs have the name r{n}({n}) where {n} stands for the revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:If an additional ".0" is attached, it denotes that it is a "WIP" (Work-In-Progress) variant of the denotes revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.1 description:Example: {r1(1) 0} is "Revision 1 WIP" and {r(1)} is "Revision 1 Final".
 
oid:.1.3.6.1.4.1.37476.9000.58.1.2 identifier:artist
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:Artist
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:This object describes an offeror (usually an artist).
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:The subordinate OIDs have the name r{n}({n}) where {n} stands for the revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:If an additional ".0" is attached, it denotes that it is a "WIP" (Work-In-Progress) variant of the denotes revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.2 description:Example: {r1(1) 0} is "Revision 1 WIP" and {r(1)} is "Revision 1 Final".
 
oid:.1.3.6.1.4.1.37476.9000.58.1.3 identifier:commissioner
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:Commissioner
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:This object describes an requestor (usually a commissioner).
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:The subordinate OIDs have the name r{n}({n}) where {n} stands for the revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:If an additional ".0" is attached, it denotes that it is a "WIP" (Work-In-Progress) variant of the denotes revision.
oid:.1.3.6.1.4.1.37476.9000.58.1.3 description:Example: {r1(1) 0} is "Revision 1 WIP" and {r(1)} is "Revision 1 Final".
 
oid:.1.3.6.1.4.1.37476.9000.58.2 identifier:art-protect
 
/trunk_oldversion/db/crypt.db
0,0 → 1,9
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.2.99 identifier:foreign
oid:.1.3.6.1.4.1.37476.3.2.2.99 unicodelabel:Foreign
oid:.1.3.6.1.4.1.37476.3.2.2.99 description:Encryption algorithms by other vendors.
oid:.1.3.6.1.4.1.37476.3.2.2.99 information:This arc maps these algorithms in the OID tree.
oid:.1.3.6.1.4.1.37476.3.2.2.99 information:The purpose is to use these OIDs to identify algorithms, if an OID is necessary.
oid:.1.3.6.1.4.1.37476.3.2.2.99 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
/trunk_oldversion/db/decoder.db
0,0 → 1,23
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.2.2 identifier:decoder
oid:.1.3.6.1.4.1.37476.2.2 description:(De)Coder
 
oid:.1.3.6.1.4.1.37476.2.2.1 identifier:fileformat
oid:.1.3.6.1.4.1.37476.2.2.1 description:(De)Coder file format
 
oid:.1.3.6.1.4.1.37476.2.2.1.3 identifier:dc3
oid:.1.3.6.1.4.1.37476.2.2.1.3 description:File formats for (De)Coder 3.x
 
oid:.1.3.6.1.4.1.37476.2.2.1.3.1 identifier:dc31
oid:.1.3.6.1.4.1.37476.2.2.1.3.1 description:(De)Coder 3.1 File Format
oid:.1.3.6.1.4.1.37476.2.2.1.3.1 attribute:leaf
 
oid:.1.3.6.1.4.1.37476.2.2.1.3.2 identifier:dc32
oid:.1.3.6.1.4.1.37476.2.2.1.3.2 description:(De)Coder 3.2 File Format
oid:.1.3.6.1.4.1.37476.2.2.1.3.2 attribute:leaf
 
oid:.1.3.6.1.4.1.37476.2.2.1.4 identifier:dc4
oid:.1.3.6.1.4.1.37476.2.2.1.4 attribute:leaf
oid:.1.3.6.1.4.1.37476.2.2.1.4 specification:https://www.viathinksoft.de/info/decoder/dc4-spec.txt
oid:.1.3.6.1.4.1.37476.2.2.1.4 description:(De)Coder 4.x file format
/trunk_oldversion/db/domains.db
0,0 → 1,20
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
# TODO: wie kann man einen solchen auto-generierten index confidential machen?
 
domain:[co]test.example.com name:Example website
domain:[co]test.example.com owner[xt]:ADDR_MAR
#domain:[co]test.example.com admin[xt]:ADDR_MAR
domain:[co]test.example.com tech[xt]:ADDR_MAR
#domain:[co]test.example.com zone[xt]:ADDR_MAR
#domain:[co]test.example.com billing[xt]:ADDR_MAR
domain:[co]test.example.com hosting[xt]:ADDR_MAR
domain:[co]test.example.com nameserver: ns11.example.com # inherited
domain:[co]test.example.com nameserver: ns12.example.com # inherited
domain:[co]test.example.com status: delegated subdomain
domain:[co]test.example.com created: unknown
domain:[co]test.example.com expires: never
domain:[co]test.example.com changed: 2012-11-20 00:40:57 GMT
domain:[co]test.example.com source: ViaThinkSoft
domain:[co]test.example.com [del]ra
domain:[co]test.example.com attribute:noexport
/trunk_oldversion/db/encoding.db
0,0 → 1,23
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.3.1 identifier:stringToNumber
oid:.1.3.6.1.4.1.37476.3.2.3.1 unicodelabel:StringToNumber
oid:.1.3.6.1.4.1.37476.3.2.3.1 allocated:daniel-marschall@viathinksoft.de 2014-12-09
oid:.1.3.6.1.4.1.37476.3.2.3.1 description: StN (String to Number) algorithm
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: The StN (String to Number) algorithm works as follows:
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: If the input string is empty, the resulting number will be 99.
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: If the input string is not empty, then it will be
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: encoded using UTF-8 and finally encoded with Base64.
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: Every Base64 will be encoded to a two digit decimal number.
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: 'A' encodes to 00, 'B' encodes to 01, ...,
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: '/' encodes to 63, '=' encodes to 64
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: All numbers will be concatenated.
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: Example:
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: 'test' will encode to '2906215129006464'
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: Using the StN algorithm, every string, or identifier respectively,
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: can be mapped into the OID tree (but the client must use
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: BigInteger to handle the OID, or read the OID as String
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: instead of interprete each arc as integer).
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: The advantage in comparison to name based Universally Unique Identifiers (UUIDs), which can be
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: mapped to the OID tree into arc 2.25 is, that the OID
oid:.1.3.6.1.4.1.37476.3.2.3.1 information: can be converted back to its original string.
/trunk_oldversion/db/example.db
0,0 → 1,3
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.2.999 identifier:example
/trunk_oldversion/db/example_domains.db
0,0 → 1,13
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.2.999.1 identifier:domains
 
# --- DE
 
oid:.2.999.1.1 [xt]domain: MACRO_DOMAIN_PROSITE_DE daniel-marschall de active
oid:.2.999.1.2 [xt]domain: MACRO_DOMAIN_PROSITE_DE viathinksoft de active
oid:.2.999.1.3 [co][xt]domain: MACRO_DOMAIN_PROSITE_DE daniel-marschall-secret de inactive
 
# --- COM
 
oid:.2.999.1.4 [xt]domain: MACRO_DOMAIN_PROSITE_COM viathinksoft com active
/trunk_oldversion/db/example_other_identifiers.db
0,0 → 1,14
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
# License Dependency Management
 
licmgr:viathinksoft delegation decoder
licmgr:viathinksoft.decoder license:GPL
licmgr:viathinksoft.decoder.vclA license LGPL
 
# Human Resources
 
hr:de.viathinksoft soa
hr:de.viathinksoft delegation marschall
hr:de.viathinksoft.marschall short ma
hr:de.viathinksoft delegation vn
/trunk_oldversion/db/fileformats.db
0,0 → 1,145
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.1.5 identifier:oid-illegality-rules
oid:.1.3.6.1.4.1.37476.3.1.5 description:"Illegality rules" file format
oid:.1.3.6.1.4.1.37476.3.1.5 information:Stores information about OIDs which were misdefined or otherwise invalid.
oid:.1.3.6.1.4.1.37476.3.1.5 information:This file format was introduced by the OID Info Application Programming Interface (API) in the programming language PHP ( https://www.viathinksoft.de/~daniel-marschall/oid-repository/api/ ).
 
oid:.1.3.6.1.4.1.37476.3.1.5.1 identifier:v1
oid:.1.3.6.1.4.1.37476.3.1.5.1 description: Version 1
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: Syntax:
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: -- comment : comments are also allowed after a rule definition
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: 2.999.(11-).0 : the arc values 11 and below are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: 2.999.(11+).0 : the arc values 11 and above are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: 2.999.(1-5).0 : the arc values 1 to 5 are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.1 information: 2.999.*.0 : * is equal to (0+)
oid:.1.3.6.1.4.1.37476.3.1.5.1 attribute:leaf
 
oid:.1.3.6.1.4.1.37476.3.1.5.2 identifier:v2
oid:.1.3.6.1.4.1.37476.3.1.5.2 description: Version 2
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: Syntax:
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: -- comment : comments are also allowed after a rule definition
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: 2.999.(11-).0 : the arc values 11 and below are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: 2.999.(11+).0 : the arc values 11 and above are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: 2.999.(1-5).0 : the arc values 1 to 5 are illegal
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: 2.999.*.0 : * is equal to (0+)
oid:.1.3.6.1.4.1.37476.3.1.5.2 information: 2.999.(!3).0 : only arc 3 is valid, all others are invalid (added in version 2)
oid:.1.3.6.1.4.1.37476.3.1.5.2 attribute:leaf
oid:.1.3.6.1.4.1.37476.3.1.5.2 assigned:2018-09-20
 
# ---
 
oid:.1.3.6.1.4.1.37476.3.1.3 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3 identifier:vmd
 
oid:.1.3.6.1.4.1.37476.3.1.3.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.0 identifier:format
 
oid:.1.3.6.1.4.1.37476.3.1.3.0.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.0.0 identifier:v0
 
#TODO: Diesen arc löschen!
oid:.1.3.6.1.4.1.37476.3.1.3.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1 identifier:general-obsolete
oid:.1.3.6.1.4.1.37476.3.1.3.1 [in]*invisible:1
oid:.1.3.6.1.4.1.37476.3.1.3.1 attribute:deprecated
 
oid:.1.3.6.1.4.1.37476.3.1.3.1.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1.1 identifier:superiorcontainerid
 
oid:.1.3.6.1.4.1.37476.3.1.3.1.1.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1.1.0 identifier:none
 
oid:.1.3.6.1.4.1.37476.3.1.3.1.2 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1.2 identifier:namevaluepair
 
oid:.1.3.6.1.4.1.37476.3.1.3.1.2.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1.2.0 identifier:name
 
oid:.1.3.6.1.4.1.37476.3.1.3.1.2.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.1.2.1 identifier:value
 
oid:.1.3.6.1.4.1.37476.3.1.3.2 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.2 identifier:nodes
 
oid:.1.3.6.1.4.1.37476.3.1.3.2.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.2.0 identifier:universe
 
# TODO: VTS specific metatags!!! verschieben nach VTS!
oid:.1.3.6.1.4.1.37476.3.1.3.3 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3 identifier:metatags
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.1 identifier:format
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.2 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.2 identifier:uuid
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.3 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.3 identifier:user
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.4 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.4 identifier:creationTime
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.5 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.5 identifier:modificationTime
 
oid:.1.3.6.1.4.1.37476.3.1.3.3.6 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.3.6 identifier:lastAccessTime
 
oid:.1.3.6.1.4.1.37476.3.1.3.4 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4 identifier:format
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.0 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.0 identifier:special
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.0.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.0.1 identifier:childnode
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.0.2 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.0.2 identifier:childNodeFileReference
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.1 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.1 identifier:string
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.2 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.2 identifier:number
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.3 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.3 identifier:boolean
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.4 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.4 identifier:date
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.5 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.5 identifier:time
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.6 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.6 identifier:datetime
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.7 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.7 identifier:float
 
oid:.1.3.6.1.4.1.37476.3.1.3.4.8 attribute:draft
oid:.1.3.6.1.4.1.37476.3.1.3.4.8 identifier:oid
 
# ---
 
oid:.1.3.6.1.4.1.37476.2.5 identifier:oidplus
oid:.1.3.6.1.4.1.37476.2.5 description:OIDplus
 
oid:.1.3.6.1.4.1.37476.2.5.1 identifier:v1
oid:.1.3.6.1.4.1.37476.2.5.1 description:Version 1
 
oid:.1.3.6.1.4.1.37476.2.5.1.1 identifier:volcano
oid:.1.3.6.1.4.1.37476.2.5.1.1 description:Volcano file format
oid:.1.3.6.1.4.1.37476.2.5.1.1 information:This file format is used as OID database format for ViaThinkSoft OID+
 
oid:.1.3.6.1.4.1.37476.2.5.1.1.1 identifier:v1
oid:.1.3.6.1.4.1.37476.2.5.1.1.1 description:Volcano file format, Version 1
oid:.1.3.6.1.4.1.37476.2.5.1.1.1 attribute:leaf
 
oid:.1.3.6.1.4.1.37476.2.5.1.1.2 identifier:v2
oid:.1.3.6.1.4.1.37476.2.5.1.1.2 description:Volcano file format, Version 2
oid:.1.3.6.1.4.1.37476.2.5.1.1.2 attribute:leaf
 
/trunk_oldversion/db/freeoid.db
0,0 → 1,14
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.9000 identifier:freeoid
oid:.1.3.6.1.4.1.37476.9000 identifier:freesub
oid:.1.3.6.1.4.1.37476.9000 unicodelabel:FreeOID
oid:.1.3.6.1.4.1.37476.9000 unicodelabel:FreeSub
oid:.1.3.6.1.4.1.37476.9000 description:This service is mainly intended to give private persons, small workgroups and
oid:.1.3.6.1.4.1.37476.9000 description:software developers of freeware, shareware or open-source software the possibility of
oid:.1.3.6.1.4.1.37476.9000 description:obtaining a free OID with minimum bureaucratic overhead.
oid:.1.3.6.1.4.1.37476.9000 description:See https://www.viathinksoft.de/freeoid/
oid:.1.3.6.1.4.1.37476.9000 allocated:daniel-marschall@viathinksoft.de 2011-03-14
oid:.1.3.6.1.4.1.37476.9000 changed:daniel-marschall@viathinksoft.de 2013-11-12
 
#*external:https://www.viathinksoft.de/freeoid/interface/oidplus_plugin/
/trunk_oldversion/db/guids.db
0,0 → 1,21
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 name:Namespace Universally Unique Identifier (UUID) for name-based UUIDs (as defined in IETF RFC 4122, clause 4.3) which describe identifiers which cannot be mapped to the OID tree.
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:The payload for a namebased UUID in this namespace is
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:"<namespace>:<identifier>", e.g. "isbn:978-3-16-148410-0"
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:The value of <namespace> can be chosen by the user and must be
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:converted into lower case. An Uniform Resource Name (URN) is preferred.
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:OID+ will convert these identifiers into a namebased UUID which
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:will be converted into an UUID OID (beneath arc 2.25),
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:which can be listed by OID+. This process allows that every identifier
uuid:ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22 description:can be mapped into the OID tree.
 
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 name:Namespace Universally Unique Identifier (UUID) for namebased UUIDs (as defined in IETF RFC 4122, clause 4.3) which describe identifiers which cannot be mapped to the OID tree.
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:The payload for a namebased UUID in this namespace is
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:"<namespace>", e.g. "isbn"
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:The value of <namespace> can be chosen by the user and must be
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:converted into lower case. A common Uniform Resource Name (URN) namespace is preferred.
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:OID+ will convert these identifiers into a namebased UUID which
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:will be converted into an UUID OID (beneath arc 2.25),
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:which can be listed by OID+. This process allows that every identifier
uuid:0943e3ce-4b79-11e5-b742-78e3b5fc7f22 description:can be mapped into the OID tree.
/trunk_oldversion/db/hash.db
0,0 → 1,70
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.1.99 identifier:foreign
oid:.1.3.6.1.4.1.37476.3.2.1.99 unicodelabel:Foreign
oid:.1.3.6.1.4.1.37476.3.2.1.99 description:Hash functions of other vendors.
oid:.1.3.6.1.4.1.37476.3.2.1.99 information:This arc maps these algorithms in the OID tree.
oid:.1.3.6.1.4.1.37476.3.2.1.99 information:The purpose is to use these OIDs to identify hashes, if an OID is necessary.
oid:.1.3.6.1.4.1.37476.3.2.1.99 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.1 identifier:md4
oid:.1.3.6.1.4.1.37476.3.2.1.99.1 unicodelabel:MD4
oid:.1.3.6.1.4.1.37476.3.2.1.99.1 description:Message Digest 4 (MD4)
oid:.1.3.6.1.4.1.37476.3.2.1.99.1 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.2 identifier:md5
oid:.1.3.6.1.4.1.37476.3.2.1.99.2 unicodelabel:MD5
oid:.1.3.6.1.4.1.37476.3.2.1.99.2 description:Message Digest 5 (MD5)
oid:.1.3.6.1.4.1.37476.3.2.1.99.2 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.3 identifier:ripemd160
oid:.1.3.6.1.4.1.37476.3.2.1.99.3 unicodelabel:RIPEMD-160
oid:.1.3.6.1.4.1.37476.3.2.1.99.3 description:RACE Integrity Primitives Evaluation Message Digest, 160 bits (RIPEMD-160)
oid:.1.3.6.1.4.1.37476.3.2.1.99.3 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.4 identifier:sha0
oid:.1.3.6.1.4.1.37476.3.2.1.99.4 unicodelabel:SHA0
oid:.1.3.6.1.4.1.37476.3.2.1.99.4 description:Secure Hash Algorithm
oid:.1.3.6.1.4.1.37476.3.2.1.99.4 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.5 identifier:sha1
oid:.1.3.6.1.4.1.37476.3.2.1.99.5 unicodelabel:SHA1
oid:.1.3.6.1.4.1.37476.3.2.1.99.5 description:Secure Hash Algorithm 1
oid:.1.3.6.1.4.1.37476.3.2.1.99.5 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.6 identifier:sha2
oid:.1.3.6.1.4.1.37476.3.2.1.99.6 unicodelabel:SHA2
oid:.1.3.6.1.4.1.37476.3.2.1.99.6 description:Secure Hash Algorithm 2
oid:.1.3.6.1.4.1.37476.3.2.1.99.6 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.224 description:Secure Hash Algorithm 2 with 224 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.224 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.256 description:Secure Hash Algorithm 2 with 256 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.256 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.384 description:Secure Hash Algorithm 2 with 384 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.384 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.512 description:Secure Hash Algorithm 2 with 512 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.6.512 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
 
 
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.7 identifier:sha3
oid:.1.3.6.1.4.1.37476.3.2.1.99.7 unicodelabel:SHA3
oid:.1.3.6.1.4.1.37476.3.2.1.99.7 description:Secure Hash Algorithm 3
oid:.1.3.6.1.4.1.37476.3.2.1.99.7 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.224 description:Secure Hash Algorithm 3 with 224 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.224 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.256 description:Secure Hash Algorithm 3 with 256 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.256 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.384 description:Secure Hash Algorithm 3 with 384 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.384 allocated:daniel-marschall@viathinksoft.de 2014-11-28
 
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.512 description:Secure Hash Algorithm 3 with 512 bits
oid:.1.3.6.1.4.1.37476.3.2.1.99.7.512 allocated:daniel-marschall@viathinksoft.de 2014-11-28
/trunk_oldversion/db/local.conf
0,0 → 1,14
# If not availabe, it will be automatically generated
local_index_generation_root=.1.3.6.1.4.1.37476.30.3
 
# Caption of the web interface
webinterface_title=ViaThinkSoft OID Registration Authority (Old/Test data)
 
# will always show namebased-uuid-sha1 and namebased-uuid-md5, even if the OID is a pure UUID OID (.2.25.x , but not 2.25.x.y)
namebased_uuids_for_pure_uuids=1
 
# DO NOT CHANGE
system_unique_id=d72b142c-297f-11e5-823b-78e3b5fc7f22
 
uuid_indexes_in_genroot=1
 
/trunk_oldversion/db/marschall.db
0,0 → 1,4
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.1.2.1 identifier:devices
oid:.1.3.6.1.4.1.37476.1.2.1.1 identifier:webcam-bureau
/trunk_oldversion/db/members.db
0,0 → 1,25
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.1 identifier:members
oid:.1.3.6.1.4.1.37476.1 unicodelabel:Members
oid:.1.3.6.1.4.1.37476.1 description:Members/Developers
oid:.1.3.6.1.4.1.37476.1 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.1.1 identifier:victor
oid:.1.3.6.1.4.1.37476.1.1 identifier:vnegoescu
oid:.1.3.6.1.4.1.37476.1.1 description:Victor-Philipp Negoescu
oid:.1.3.6.1.4.1.37476.1.1 ra(1)[in][xt]:ADDR_VNE
 
oid:.1.3.6.1.4.1.37476.1.2 identifier:daniel-marschall
oid:.1.3.6.1.4.1.37476.1.2 identifier:dmarschall
oid:.1.3.6.1.4.1.37476.1.2 description:Daniel Marschall
oid:.1.3.6.1.4.1.37476.1.2 ra(1)[in][xt]:ADDR_MAR
 
oid:.1.3.6.1.4.1.37476.1.3 identifier:mduepjohann
oid:.1.3.6.1.4.1.37476.1.3 description:Michael Düpjohann
oid:.1.3.6.1.4.1.37476.1.3 ra(1)[in][xt]:ADDR_MD
 
oid:.1.3.6.1.4.1.37476.1.4 identifier:thommy
oid:.1.3.6.1.4.1.37476.1.4 identifier:tbretzke
oid:.1.3.6.1.4.1.37476.1.4 description:Thomas Bretzke
oid:.1.3.6.1.4.1.37476.1.4 ra(1)[in][xt]:ADDR_THOMMY
/trunk_oldversion/db/mha.db
0,0 → 1,100
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.1.1 identifier:mha-family
oid:.1.3.6.1.4.1.37476.3.2.1.1 unicodelabel:MHA-Family
oid:.1.3.6.1.4.1.37476.3.2.1.1 description:MHA (Marschall-Hash) hash scheme family
oid:.1.3.6.1.4.1.37476.3.2.1.1 specification:https://www.viathinksoft.de/documents/specification/mha/
oid:.1.3.6.1.4.1.37476.3.2.1.1 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 identifier:mha
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 unicodelabel:MHA
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:MHA (Marschall-Hash) hash scheme
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:Subsequent arcs are addressed as followed:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:{mha-nnnn(nnnn) b} for MHA-nnnn with representation b={none, binary(0), base64(1), hexadecimal(2)}
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:Default usage:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987 for MHA-1987 in any representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.0 for MHA-1987 in 20-byte binary representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.1 for MHA-1987 in 27-byte case-sensitive base64 representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 for MHA-1987 in 40-byte lowercase hexadecimal representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:Additional parameters needed for the receiver:
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 description:- iterated salt: by default empty
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 maxdepth:2
oid:.1.3.6.1.4.1.37476.3.2.1.1.0 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.0 identifier:illegal
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.0 description:Illegal
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.0 description:This arc may not be used since MHA-0 is not defined.
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.0 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.0 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987 identifier:mha-1987
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987 description:MHA-1987 (default usage)
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987 maxdepth:1
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.0 identifier:binary
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.0 description:MHA-1987 in binary representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.0 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.0 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.1 identifier:base64
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.1 description:MHA-1987 in (trimmed) base64 representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.1 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.1 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 identifier:base16
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 identifier:hexadecimal
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 description:MHA-1987 in lowercase hexadecimal representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.0.1987.2 allocated:daniel-marschall@viathinksoft.de 2011-08-14
 
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 identifier:md5mha
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 unicodelabel:MD5MHA
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:MD5MHA hash scheme = MHA hash of a (unsalted!) MD5 hash
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:used for migrating hashes from MD5 to MHA
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:Subsequent arcs are addressed as followed:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:{md5mha-nnnn(nnnn) b} for MD5MHA-nnnn with representation b={none, base64(0), binary(1), hexadecimal(2)}
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:Default usage:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:.1987 for MD5MHA-1987 in any representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:.1987.0 for MD5MHA-1987 in 27-byte case-sensitive base64 representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:.1987.1 for MD5MHA-1987 in 20-byte binary representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:.1987.2 for MD5MHA-1987 in 40-byte lowercase hexadecimal representation
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:Additional parameters needed for the receiver:
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 description:- iterated salt: by default empty
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 maxdepth:2
oid:.1.3.6.1.4.1.37476.3.2.1.1.1 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.0 identifier:illegal
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.0 description:Illegal
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.0 description:This arc may not be used since MD5MHA-0 is not defined.
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.0 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.0 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987 identifier:md5mha-1987
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987 description:MD5MHA-1987 (default usage)
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987 maxdepth:1
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.0 identifier:binary
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.0 description:MD5MHA-1987 in binary representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.0 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.0 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.1 identifier:base64
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.1 description:MD5MHA-1987 in (modified) base64 representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.1 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.1 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.2 identifier:base16
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.2 identifier:hexadecimal
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.2 description:MD5MHA-1987 in lowercase hexadecimal representation.
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.2 attribute:LEAF
oid:.1.3.6.1.4.1.37476.3.2.1.1.1.1987.2 allocated:daniel-marschall@viathinksoft.de 2011-08-14
 
/trunk_oldversion/db/mha2.db
0,0 → 1,7
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.1.2 identifier:mha2
oid:.1.3.6.1.4.1.37476.3.2.1.2 unicodelabel:MHA2
oid:.1.3.6.1.4.1.37476.3.2.1.2 description:MHA2 (Marschall-Hash 2) hash algorithm
oid:.1.3.6.1.4.1.37476.3.2.1.2 specification:https://www.viathinksoft.de/documents/specification/mha2/
oid:.1.3.6.1.4.1.37476.3.2.1.2 allocated:daniel-marschall@viathinksoft.de 2014-11-07
/trunk_oldversion/db/mha3.db
0,0 → 1,7
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.2.1.3 identifier:mha3
oid:.1.3.6.1.4.1.37476.3.2.1.3 unicodelabel:MHA3
oid:.1.3.6.1.4.1.37476.3.2.1.3 description:MHA3 (Marschall-Hash 3) hash algorithm
oid:.1.3.6.1.4.1.37476.3.2.1.3 specification:https://www.viathinksoft.de/documents/specification/mha3/
oid:.1.3.6.1.4.1.37476.3.2.1.3 allocated:daniel-marschall@viathinksoft.de 2018-05-04
/trunk_oldversion/db/network.db
0,0 → 1,12
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
ipv4:37.48.104.196/32 description:ViaThinkSoft Server DELTA Main IPv4
ipv4:37.48.104.196/32 domain:viathinksoft.de
ipv4:37.48.104.196/32 domain:viathinksoft.com
ipv4:37.48.104.196/32 attribute:noexport
 
ipv6:2001:1af8:4700:a07e:1::/112 description:ViaThinkSoft IPv6 range for server DELTA
ipv6:2001:1af8:4700:a07e:1::/112 attribute:noexport
 
ipv6:2001:1af8:4700:a07e:1::1337 description:ViaThinkSoft Server DELTA Main IPv6
ipv6:2001:1af8:4700:a07e:1::1337 attribute:noexport
/trunk_oldversion/db/pyrascript.db
0,0 → 1,12
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.3.4.1 identifier:pyrascript
oid:.1.3.6.1.4.1.37476.3.4.1 unicodelabel:PyraScript
oid:.1.3.6.1.4.1.37476.3.4.1 description:PyraScript
oid:.1.3.6.1.4.1.37476.3.4.1 allocated:daniel-marschall@viathinksoft.de 2018-07-14
 
oid:.1.3.6.1.4.1.37476.3.4.1.1408 identifier:pyrascript
oid:.1.3.6.1.4.1.37476.3.4.1.1408 unicodelabel:PyraScript
oid:.1.3.6.1.4.1.37476.3.4.1.1408 description:PyraScript implementation of August 2014
oid:.1.3.6.1.4.1.37476.3.4.1.1408 allocated:daniel-marschall@viathinksoft.de 2018-07-14
oid:.1.3.6.1.4.1.37476.3.4.1.1408 attribute:leaf
/trunk_oldversion/db/root.db
0,0 → 1,122
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476 [in]*read-auth(plain):passwort123
#oid:.1.3.6.1.4.1.37476 [in]*write-auth(false)
 
#oid:.1.3.6.1.4.1.37476 identifier:viathinksoft
#oid:.1.3.6.1.4.1.37476 unicodelabel:ViaThinkSoft
 
oid:.1.3.6.1.4.1.37476 name:ViaThinkSoft Root OID
oid:.1.3.6.1.4.1.37476 description:ViaThinkSoft (German https://www.viathinksoft.de/ or English https://www.viathinksoft.com/ )
oid:.1.3.6.1.4.1.37476 description:More information about assigned OIDs: https://www.viathinksoft.de/documents/oid/
 
oid:.1.3.6.1.4.1.37476 ra(1)[in][xt]:C_VTS
 
oid:.1.3.6.1.4.1.37476 policy(1):Please see the Memorandum about ViaThinkSoft's OID tree
oid:.1.3.6.1.4.1.37476 policy(1):https://www.viathinksoft.de/documents/oid/advisory/
 
oid:.1.3.6.1.4.1.37476 allocated:iana-pen@iana.org 2011-02-25
oid:.1.3.6.1.4.1.37476 asn1-notation: {iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 37476}
oid:.1.3.6.1.4.1.37476 iri-notation: /ISO/Identified-Organization/6/1/4/1/37476
 
# ---
 
oid:.1.3.6.1.4.1.37476.2 identifier:products
oid:.1.3.6.1.4.1.37476.2 unicodelabel:Products
oid:.1.3.6.1.4.1.37476.2 description:Products
oid:.1.3.6.1.4.1.37476.2 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.3 allocated:daniel-marschall@viathinksoft.de 2011-03-14
oid:.1.3.6.1.4.1.37476.3 description:Specifications
oid:.1.3.6.1.4.1.37476.3 identifier:specifications
oid:.1.3.6.1.4.1.37476.3 unicodelabel:Specifications
 
oid:.1.3.6.1.4.1.37476.3.0 allocated:daniel-marschall@viathinksoft.de 2011-03-14
oid:.1.3.6.1.4.1.37476.3.0 description:Other specifications (not referenced by brother OIDs)
oid:.1.3.6.1.4.1.37476.3.0 identifier:misc
oid:.1.3.6.1.4.1.37476.3.0 unicodelabel:Misc
 
oid:.1.3.6.1.4.1.37476.3.1 allocated:daniel-marschall@viathinksoft.de 2011-03-14
oid:.1.3.6.1.4.1.37476.3.1 description:File formats
oid:.1.3.6.1.4.1.37476.3.1 identifier:fileformat
oid:.1.3.6.1.4.1.37476.3.1 unicodelabel:FileFormat
 
oid:.1.3.6.1.4.1.37476.3.2 identifier:algorithm
oid:.1.3.6.1.4.1.37476.3.2 unicodelabel:Algorithm
oid:.1.3.6.1.4.1.37476.3.2 description:Algorithms
oid:.1.3.6.1.4.1.37476.3.2 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.3.2.1 identifier:hash
oid:.1.3.6.1.4.1.37476.3.2.1 unicodelabel:Hash
oid:.1.3.6.1.4.1.37476.3.2.1 description:Specific hash algorithms
oid:.1.3.6.1.4.1.37476.3.2.1 allocated:daniel-marschall@viathinksoft.de 2011-07-23
 
oid:.1.3.6.1.4.1.37476.3.2.2 identifier:crypt
oid:.1.3.6.1.4.1.37476.3.2.2 unicodelabel:Crypt
oid:.1.3.6.1.4.1.37476.3.2.2 description:Crypt algorithms
oid:.1.3.6.1.4.1.37476.3.2.2 allocated:daniel-marschall@viathinksoft.de 2011-11-07
 
oid:.1.3.6.1.4.1.37476.3.2.3 identifier:encoding
oid:.1.3.6.1.4.1.37476.3.2.3 unicodelabel:Encoding
oid:.1.3.6.1.4.1.37476.3.2.3 description:Encoding algorithms
oid:.1.3.6.1.4.1.37476.3.2.3 allocated:daniel-marschall@viathinksoft.de 2014-12-09
 
oid:.1.3.6.1.4.1.37476.3.3 identifier:interface
oid:.1.3.6.1.4.1.37476.3.3 unicodelabel:Interface
oid:.1.3.6.1.4.1.37476.3.3 description:Interfaces
oid:.1.3.6.1.4.1.37476.3.3 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.3.4 identifier:script
oid:.1.3.6.1.4.1.37476.3.4 unicodelabel:Script
oid:.1.3.6.1.4.1.37476.3.4 description:Individual script languages and notations
oid:.1.3.6.1.4.1.37476.3.4 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.3.5 identifier:communication
oid:.1.3.6.1.4.1.37476.3.5 unicodelabel:Communication
oid:.1.3.6.1.4.1.37476.3.5 description:Communication interfaces
oid:.1.3.6.1.4.1.37476.3.5 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.3.6 identifier:protocol
oid:.1.3.6.1.4.1.37476.3.6 unicodelabel:Protocol
oid:.1.3.6.1.4.1.37476.3.6 description:Individual protocols
oid:.1.3.6.1.4.1.37476.3.6 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.4 identifier:experimental
oid:.1.3.6.1.4.1.37476.4 unicodelabel:Experimental
oid:.1.3.6.1.4.1.37476.4 description:Objects in experimental implementations
oid:.1.3.6.1.4.1.37476.4 allocated:daniel-marschall@viathinksoft.de 2011-03-14
 
oid:.1.3.6.1.4.1.37476.10 identifier:ca
oid:.1.3.6.1.4.1.37476.10 unicodelabel:CA
oid:.1.3.6.1.4.1.37476.10 description:Reserved for future use in X.509 certificates.
oid:.1.3.6.1.4.1.37476.10 attribute:RESERVED
oid:.1.3.6.1.4.1.37476.10 allocated:daniel-marschall@viathinksoft.de 2014-11-08
 
oid:.1.3.6.1.4.1.37476.20 identifier:multidump
oid:.1.3.6.1.4.1.37476.20 identifier:vmd
oid:.1.3.6.1.4.1.37476.20 unicodelabel:Multidump
oid:.1.3.6.1.4.1.37476.20 description:ViaThinkSoft Multidump (an experimental format for interoperation between open systems)
oid:.1.3.6.1.4.1.37476.20 information:Multidump is completely built out of object identifiers. Every possible field or module is represented by an OID arc. Third-party vendors may use their own OID arcs for their extensions. This arc is used for data structures for ViaThinkSoft products.
oid:.1.3.6.1.4.1.37476.20 specification:https://www.viathinksoft.de/documents/specification/multidump/
oid:.1.3.6.1.4.1.37476.20 allocated:daniel-marschall@viathinksoft.de 2011-07-17
 
oid:.1.3.6.1.4.1.37476.30 identifier:oidplus
oid:.1.3.6.1.4.1.37476.30 unicodelabel:OIDplus
oid:.1.3.6.1.4.1.37476.30 description:ViaThinkSoft OID+ Information Objects
oid:.1.3.6.1.4.1.37476.30 information:This arc maps information objects of ViaThinkSoft's internal managment (domain managment, IP network managment, GUIDs, package names, document numbering, etc) to the OID tree so that the informations can be embedded to the software ViaThinkSoft OID+.
oid:.1.3.6.1.4.1.37476.30 information:Informations can be queried with a whois client, but usually most of the information objects are for private use only and require a personal identifcation number (PIN).
oid:.1.3.6.1.4.1.37476.30 allocated:daniel-marschall@viathinksoft.de 2012-06-26
 
oid:.1.3.6.1.4.1.37476.30.3 identifier:genroot
oid:.1.3.6.1.4.1.37476.30.3 unicodelabel:GenRoot
 
oid:.1.3.6.1.4.1.37476.9999 identifier:example
oid:.1.3.6.1.4.1.37476.9999 unicodelabel:Example
oid:.1.3.6.1.4.1.37476.9999 description:Example
oid:.1.3.6.1.4.1.37476.9999 information:This is a free usable arc for everyone with the purpose of documenting examples of object identifiers in tutorial, open source demos, etc. (in the same way as "example.com" is used as an example for web sites). You can use this OID without any permission.
oid:.1.3.6.1.4.1.37476.9999 information:This OID is now deprecated in favor of {joint-iso-itu-t(2) example(999)}.
oid:.1.3.6.1.4.1.37476.9999 information:Since the ViaThinkSoft OID policies do not allow the re-allocation of an allocated OID, this arc will not be used for any other purpose.
oid:.1.3.6.1.4.1.37476.9999 specification:https://www.viathinksoft.de/documents/specification/example-oid/
oid:.1.3.6.1.4.1.37476.9999 attribute:DEPRECATED
oid:.1.3.6.1.4.1.37476.9999 ra:Anybody <anonymous@example.com>
oid:.1.3.6.1.4.1.37476.9999 allocated:daniel-marschall@viathinksoft.de 2011-04-18
/trunk_oldversion/db/statmon.db
0,0 → 1,73
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.2.1 identifier:statmon
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusmon
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusmon
oid:.1.3.6.1.4.1.37476.2.1 identifier:statusMonitor
oid:.1.3.6.1.4.1.37476.2.1 unicodelabel:StatusMonitor
oid:.1.3.6.1.4.1.37476.2.1 description:ViaThinkSoft Status Monitor Communication Interface
oid:.1.3.6.1.4.1.37476.2.1 specification:https://www.viathinksoft.de/documents/specification/statusmon/
oid:.1.3.6.1.4.1.37476.2.1 allocated:daniel-marschall@viathinksoft.de 2011-03-22
 
# --- Version 1
 
oid:.1.3.6.1.4.1.37476.2.1.1 identifier:v1
 
#oid:.1.3.6.1.4.1.37476.2.1.1.1 [in]*invisible:1
oid:.1.3.6.1.4.1.37476.2.1.1.1 allocated:daniel-marschall@viathinksoft.de 2011-03-22
oid:.1.3.6.1.4.1.37476.2.1.1.1 description:Monitor states
oid:.1.3.6.1.4.1.37476.2.1.1.1 description:All child OIDs are leaf OIDs.
oid:.1.3.6.1.4.1.37476.2.1.1.1 identifier:states
oid:.1.3.6.1.4.1.37476.2.1.1.1 maxdepth:1
oid:.1.3.6.1.4.1.37476.2.1.1.1 todo:rename into state ?
oid:.1.3.6.1.4.1.37476.2.1.1.1 unicodelabel:States
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 description:Everything is OK
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 identifier:ok
oid:.1.3.6.1.4.1.37476.2.1.1.1.1 unicodelabel:OK
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 description:A warning is thrown
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 identifier:warning
oid:.1.3.6.1.4.1.37476.2.1.1.1.2 unicodelabel:WARNING
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 description:Severity of the state (0 = OK, >0 = Warning)
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 identifier:severity
oid:.1.3.6.1.4.1.37476.2.1.1.1.3 unicodelabel:SEVERITY
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 description:Notification when constant changes
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 identifier:constant
oid:.1.3.6.1.4.1.37476.2.1.1.1.4 unicodelabel:CONSTANT
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 description:A picture which has to be monitored visually
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 identifier:picture
oid:.1.3.6.1.4.1.37476.2.1.1.1.5 unicodelabel:PICTURE
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 description:Sends a message without changing the client monitor state
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 identifier:message
oid:.1.3.6.1.4.1.37476.2.1.1.1.6 unicodelabel:MESSAGE
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 description:A temporary internal error prevents the Status Monitor to provide the current state of the service. This error is equivalent to a HTTP 500 response.
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 description:ERROR_INTERNAL [text (optional)]
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 identifier:error-internal
oid:.1.3.6.1.4.1.37476.2.1.1.1.100 unicodelabel:ERROR_INTERNAL
 
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 allocated:daniel-marschall@viathinksoft.de 2011-03-26
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 attribute:LEAF
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 description:ERROR_ARGUMENTS [text (optional)]
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 description:This error indicates that the client has provided illegal arguments (= GET parameters) to the Status Monitor.
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 identifier:error-arguments
oid:.1.3.6.1.4.1.37476.2.1.1.1.101 unicodelabel:ERROR_ARGUMENTS
/trunk_oldversion/db/vnag.db
0,0 → 1,11
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
oid:.1.3.6.1.4.1.37476.2.3 identifier:vnag
oid:.1.3.6.1.4.1.37476.2.3 description:VNag
 
oid:.1.3.6.1.4.1.37476.2.3.1 identifier:jsondata
oid:.1.3.6.1.4.1.37476.2.3.1 description:JSON data object that is embedded in a HTML page
 
oid:.1.3.6.1.4.1.37476.2.3.1.1 identifier:v1
oid:.1.3.6.1.4.1.37476.2.3.1.1 description:Version 1
oid:.1.3.6.1.4.1.37476.2.3.1.1 attribute:leaf
/trunk_oldversion/documentation/config
0,0 → 1,16
# If not availabe, it will be automatically generated
local_index_generation_root=.2.25.<SYSID>
 
# Caption of the web interface
webinterface_title=ViaThinkSoft OID Registration Authority (Old/Test data)
 
# will always show namebased-uuid-sha1 and namebased-uuid-md5, even if the OID is a pure UUID OID (.2.25.x , but not 2.25.x.y)
namebased_uuids_for_pure_uuids=1
 
# Must be unique for every system
system_unique_id=d72b142c-297f-11e5-823b-78e3b5fc7f22
 
# If 1: index(uuid) will be created in <GENROOT>.25
# If 0: index(uuid) will be created in 2.25
uuid_indexes_in_genroot=1
 
/trunk_oldversion/documentation/db
0,0 → 1,70
Dateisuche:
 
sorted
 
Header:
 
[1.3.6.1.4.1.37476.2.5.1.1.2]
 
Line:
 
<namespace>:<identifier> [<flags>]<attrib_name>[(<attrib_param[s]>)]:<value>
 
[]= optional
 
Comments:
 
Comment lines start with #
 
Flags:
 
[add] Additive flag -> The field will not overwrite same-named fields in the hierarchy; instead it will be added.
[co] Confidential flag -> The field will be redacted, unless a auth key matches a previous defined read-auth in the hierarchy tree
[xt] Extend flag
Value is a handle
[in] Inherit flag -> The value will be interhited to all future OIDs, as long as it isn't overwritten.
[del] Delete flag -> Delete all previously declared fields. Required if you want to remove an inherited element.
 
Namespaces (case insensitive)
oid
guid will be converted to oid
other namespaces (e.g. doi) will be converted to a namebased uuid which will be converted to an oid
 
Special namespaces (case insensitive)
*macro
*external -> <identifier> is an URL which will be included
 
OID extending process:
 
- <SYSID> inside an OID will be replaced to the integer representation of
system_unique_id (defined in db/local.conf, and will be automatically generated).
- <GENROOT> inside an OID will be replaced to the generation root, which is by default .2.25.<SYSID>
 
System fields
-------------
 
System fields always begin with '*' and are always invisible for everyone.
 
Currently supported system fields are:
 
*read-auth : Contains auth infos for [co] fields and invisible OIDs
*invisible : (0|1) <-- will be shown if read-auth is available for the current OID (not the OID which defined *invisible!)
 
Macro params
------------
 
oid:.<oid> [xt]<attrib_name>(...):<macro name> <param 1> <param 2>
<macro name> == __0__
<param 1> == __1__
...
__...__ will be replaced in attrib_name, attrib_params and value .
Note: Unused place holders will not be removed, so parametrized marcos can use parametrized macros itself.
Note: Separator is any kind of whitespace. Multiple whitespaces are OK!
 
Fields with special meaning
---------------------------
 
identifier: Is the ASN.1 identifier. It MUST have the correct syntax.
attribute:
unicodelabel: The unicode label. Syntax checking not yet implemented.
 
/trunk_oldversion/documentation/indexes
0,0 → 1,13
 
 
possibility 1:
 
ipv4:<ip> xx:xx
-> OID namebased UUID
 
possibility 2 ("information object"):
 
oid:2.999 xx:xx
oid:2.999 index(ipv4):<ip>
-> free choice of OID
 
/trunk_oldversion/includes/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk_oldversion/includes/OidDerConverter.class.phps
0,0 → 1,380
<?php
 
/*
* OidDerConverter.class.php, Version 1.1; Based on version 1.11 of oid.c
* Copyright 2014-2015 Daniel Marschall, ViaThinkSoft
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
 
// Note: Leading zeros are permitted in dotted notation.
 
// TODO: define output format as parameter; don't force the user to use hexStrToArray
 
class OidDerConverter {
 
/**
* @arg $str "\x12\x23" or "12 34"
* @return array(0x12, 0x23)
*/
// Doesn't need to be public, but it is a nice handy function, especially in the testcases
public static function hexStrToArray($str) {
$out = array();
 
$str = str_replace('\x', ' ', $str);
$str = trim($str);
$ary = explode(' ', $str);
 
foreach ($ary as &$a) {
$out[] = hexdec($a);
}
 
return $out;
}
 
/**
* @return Outputs .<oid> for an absolute OID and <oid> for a relative OID.
*/
public static function derToOID($abBinary, $verbose=false) {
$output_oid = array();
$output_absolute = true;
 
if (count($abBinary) < 3) {
if ($verbose) fprintf(STDERR, "Encoded OID must have at least three bytes!\n");
return false;
}
 
$nBinary = count($abBinary);
$ll = gmp_init(0);
$fOK = false;
$fSub = 0; // Subtract value from next number output. Used when encoding {2 48} and up
 
// 0 = Universal Class Identifier Tag (can be more than 1 byte, but not in our case)
// 1 = Length part (may have more than 1 byte!)
// 2 = First two arc encoding
// 3 = Encoding of arc three and higher
$part = 0;
 
$lengthbyte_count = 0;
$lengthbyte_pos = 0;
$lengthfinished = false;
 
$arcBeginning = true;
 
foreach ($abBinary as $nn => &$pb) {
if ($part == 0) { // Class Tag
// Leading octet
// Bit 7 / Bit 6 = Universal (00), Application (01), Context (10), Private(11)
// Bit 5 = Primitive (0), Constructed (1)
// Bit 4..0 = 00000 .. 11110 => Tag 0..30, 11111 for Tag > 30 (following bytes with the highest bit as "more" bit)
// --> We don't need to respect 11111 (class-tag encodes in more than 1 octet)
// as we terminate when the tag is not of type OID or RELATEIVE-OID
// See page 396 of "ASN.1 - Communication between Heterogeneous Systems" by Olivier Dubuisson.
 
// Class: 8. - 7. bit
// 0 (00) = Universal
// 1 (01) = Application
// 2 (10) = Context
// 3 (11) = Private
$cl = (($pb & 0xC0) >> 6) & 0x03;
if ($cl != 0) {
if ($verbose) fprintf(STDERR, "Error at type: The OID tags are only defined as UNIVERSAL class tags.\n");
return false;
}
 
// Primitive/Constructed: 6. bit
// 0 = Primitive
// 1 = Constructed
$pc = $pb & 0x20;
if ($pc != 0) {
if ($verbose) fprintf(STDERR, "Error at type: OIDs must be primitive, not constructed.\n");
return false;
}
 
// Tag number: 5. - 1. bit
$tag = $pb & 0x1F;
if ($tag == 0x0D) {
$isRelative = true;
} else if ($tag == 0x06) {
$isRelative = false;
} else {
if ($verbose) fprintf(STDERR, "Error at type: The tag number is neither an absolute OID (0x06) nor a relative OID (0x0D).\n");
return false;
}
 
// Output
$output_absolute = !$isRelative;
 
$part++;
} else if ($part == 1) { // Length
// Find out the length and save it into $ll
 
// [length] is encoded as follows:
// 0x00 .. 0x7F = The actual length is in this byte, followed by [data].
// 0x80 + n = The length of [data] is spread over the following 'n' bytes. (0 < n < 0x7F)
// 0x80 = "indefinite length" (only constructed form) -- Invalid
// 0xFF = Reserved for further implementations -- Invalid
// See page 396 of "ASN.1 - Communication between Heterogeneous Systems" by Olivier Dubuisson.
 
if ($nn == 1) { // The first length byte
$lengthbyte_pos = 0;
if (($pb & 0x80) != 0) {
// 0x80 + n => The length is spread over the following 'n' bytes
$lengthfinished = false;
$lengthbyte_count = $pb & 0x7F;
if ($lengthbyte_count == 0x00) {
if ($verbose) fprintf(STDERR, "Length value 0x80 is invalid (\"indefinite length\") for primitive types.\n");
return false;
} else if ($lengthbyte_count == 0x7F) {
if ($verbose) fprintf(STDERR, "Length value 0xFF is reserved for further extensions.\n");
return false;
}
$fOK = false;
} else {
// 0x01 .. 0x7F => The actual length
 
if ($pb == 0x00) {
if ($verbose) fprintf(STDERR, "Length value 0x00 is invalid for an OID.\n");
return false;
}
 
$ll = gmp_init($pb);
$lengthfinished = true;
$lengthbyte_count = 0;
$fOK = true;
}
} else {
if ($lengthbyte_count > $lengthbyte_pos) {
$ll = gmp_mul($ll, 0x100);
$ll = gmp_add($ll, $pb);
$lengthbyte_pos++;
}
 
if ($lengthbyte_count == $lengthbyte_pos) {
$lengthfinished = true;
$fOK = true;
}
}
 
if ($lengthfinished) { // The length is now in $ll
if (gmp_cmp($ll, $nBinary - 2 - $lengthbyte_count) != 0) {
if ($verbose) fprintf(STDERR, "Invalid length (%d entered, but %s expected)\n", $nBinary - 2, gmp_strval($ll, 10));
return false;
}
$ll = gmp_init(0); // reset for later usage
$fOK = true;
$part++;
if ($isRelative) $part++; // Goto step 3!
}
} else if ($part == 2) { // First two arcs
$first = $pb / 40;
$second = $pb % 40;
if ($first > 2) {
$first = 2;
$output_oid[] = $first;
$arcBeginning = true;
 
if (($pb & 0x80) != 0) {
// 2.48 and up => 2+ octets
// Output in "part 3"
 
if ($arcBeginning && ($pb == 0x80)) {
if ($verbose) fprintf(STDERR, "Encoding error. Illegal 0x80 paddings. (See Rec. ITU-T X.690, clause 8.19.2)\n");
return false;
} else {
$arcBeginning = false;
}
 
$ll = gmp_add($ll, ($pb & 0x7F));
$fSub = 80;
$fOK = false;
} else {
// 2.0 till 2.47 => 1 octet
$second = $pb - 80;
$output_oid[] = $second;
$arcBeginning = true;
$fOK = true;
$ll = gmp_init(0);
}
} else {
// 0.0 till 0.37 => 1 octet
// 1.0 till 1.37 => 1 octet
$output_oid[] = $first;
$output_oid[] = $second;
$arcBeginning = true;
$fOK = true;
$ll = gmp_init(0);
}
$part++;
} else if ($part == 3) { // Arc three and higher
if (($pb & 0x80) != 0) {
if ($arcBeginning && ($pb == 0x80)) {
if ($verbose) fprintf(STDERR, "Encoding error. Illegal 0x80 paddings. (See Rec. ITU-T X.690, clause 8.19.2)\n");
return false;
} else {
$arcBeginning = false;
}
 
$ll = gmp_mul($ll, 0x80);
$ll = gmp_add($ll, ($pb & 0x7F));
$fOK = false;
} else {
$fOK = true;
$ll = gmp_mul($ll, 0x80);
$ll = gmp_add($ll, $pb);
$ll = gmp_sub($ll, $fSub);
$output_oid[] = gmp_strval($ll, 10);
 
// Happens only if 0x80 paddings are allowed
// $fOK = gmp_cmp($ll, 0) >= 0;
$ll = gmp_init(0);
$fSub = 0;
$arcBeginning = true;
}
}
}
 
if (!$fOK) {
if ($verbose) fprintf(STDERR, "Encoding error. The OID is not constructed properly.\n");
return false;
}
 
return ($output_absolute ? '.' : '').implode('.', $output_oid);
}
 
// Doesn't need to be public, but it is a nice handy function, especially in the testcases
public static function hexarrayToStr($ary, $nCHex=false) {
$str = '';
if ($ary === false) return false;
foreach ($ary as &$a) {
if ($nCHex) {
$str .= sprintf("\"\\x%02X", $a);
} else {
$str .= sprintf("%02X ", $a);
}
}
return trim($str);
}
 
public static function oidToDER($oid, $isRelative=false, $verbose=false) {
if ($oid[0] == '.') { // MIB notation
$oid = substr($oid, 1);
$isRelative = false;
}
 
$cl = 0x00; // Class. Always UNIVERSAL (00)
 
// Tag for Universal Class
if ($isRelative) {
$cl |= 0x0D;
} else {
$cl |= 0x06;
}
 
$arcs = explode('.', $oid);
 
$b = 0;
$isjoint = false;
$abBinary = array();
 
if ((!$isRelative) && (count($arcs) < 2)) {
if ($verbose) fprintf(STDERR, "Encoding error. The minimum depth of an encodeable absolute OID is 2. (e.g. 2.999)\n");
return false;
}
 
foreach ($arcs as $n => &$arc) {
if (!preg_match('@^\d+$@', $arc)) {
if ($verbose) fprintf(STDERR, "Encoding error. Arc '%s' is invalid.\n", $arc);
return false;
}
 
$l = gmp_init($arc, 10);
 
if ((!$isRelative) && ($n == 0)) {
if (gmp_cmp($l, 2) > 0) {
if ($verbose) fprintf(STDERR, "Encoding error. The top arc is limited to 0, 1 and 2.\n");
return false;
}
$b += 40 * gmp_intval($l);
$isjoint = gmp_cmp($l, 2) == 0;
} else if ((!$isRelative) && ($n == 1)) {
if ((!$isjoint) && (gmp_cmp($l, 39) > 0)) {
if ($verbose) fprintf(STDERR, "Encoding error. The second arc is limited to 0..39 for root arcs 0 and 1.\n");
return false;
}
 
if (gmp_cmp($l, 47) > 0) {
$l = gmp_add($l, 80);
self::makeBase128($l, 1, $abBinary);
} else {
$b += gmp_intval($l);
$abBinary[] = $b;
}
} else {
self::makeBase128($l, 1, $abBinary);
}
}
 
$output = array();
 
// Write class-tag
$output[] = $cl;
 
// Write length
$nBinary = count($abBinary);
if ($nBinary <= 0x7F) {
$output[] = $nBinary;
} else {
$lengthCount = 0;
$nBinaryWork = $nBinary;
do {
$lengthCount++;
$nBinaryWork /= 0x100;
} while ($nBinaryWork > 0);
 
if ($lengthCount >= 0x7F) {
if ($verbose) fprintf(STDERR, "The length cannot be encoded.\n");
return false;
}
 
$output[] = 0x80 + $lengthCount;
 
$nBinaryWork = $nBinary;
do {
$output[] = nBinaryWork & 0xFF;
$nBinaryWork /= 0x100;
} while ($nBinaryWork > 0);
}
 
foreach ($abBinary as $b) {
$output[] = $b;
}
 
return $output;
}
 
protected static function makeBase128($l, $first, &$abBinary) {
if (gmp_cmp($l, 127) > 0) {
$l2 = gmp_div($l, 128);
self::makeBase128($l2 , 0, $abBinary);
}
$l = gmp_mod($l, 128);
 
if ($first) {
$abBinary[] = gmp_intval($l);
} else {
$abBinary[] = 0x80 | gmp_intval($l);
}
}
}
/trunk_oldversion/includes/config.inc.php
0,0 → 1,21
<?php
 
require_once __DIR__.'/oid_utils.inc.php';
 
# TODO: diese konfiguration auch zur konfiguration von "is oid valid" nutzen
# 0 = "."
# 1 = ".2"
# 2 = ".2.999"
define('HIGHLIGHT_OID_MINLEN', 2);
define('ALLOW_LEADING_ZEROES', false);
define('LEADING_DOT_POLICY', OID_DOT_OPTIONAL);
# define('HIGHLIGHT_REQUIRES_WHITESPACE_DELIMITERS', false);
 
define('OIDINFO_EXPORT_ENABLED', true);
define('OIDINFO_EXPORT_SUBMITTER_FIRST_NAME', 'Daniel');
define('OIDINFO_EXPORT_SUBMITTER_LAST_NAME', 'Marschall');
define('OIDINFO_EXPORT_SUBMITTER_EMAIL', 'info@daniel-marschall.de');
define('OIDINFO_EXPORT_SUBMITTER_ONLY_MONOSPACE', false); # False = auto determinate
 
define('OIDINFO_EXPORT_SIMPLEPINGPROVIDER', 'viathinksoft.de:49500'); // MUST show all oid-info.com values, not a local RA's OID repository!
 
/trunk_oldversion/includes/gui.inc.php
0,0 → 1,115
<?php
 
if (!defined('OID_REGEX')) {
define('OID_REGEX', oid_detection_regex(HIGHLIGHT_OID_MINLEN, ALLOW_LEADING_ZEROES, LEADING_DOT_POLICY, true /* HIGHLIGHT_REQUIRES_WHITESPACE_DELIMITERS */));
}
 
function queryInfo($query) {
return '<p class="green">Executed query <a href="?action=query&amp;query='.urlencode($query).'">'.htmlentities($query).'</a></p>';
}
 
function showHTML($cont, $db, $show_internal_links=true, $monospace=true) {
$cont = htmlentities($cont);
# $cont = str_replace(' ', '&nbsp;', $cont);
# $cont = nl2br($cont);
 
$rm = $db->getRedactedMessage();
 
# TODO: htmlentities() bei den indexes usw
# TODO: <...> problem - wird hinzugefügt
 
# TODO: als plugins?
 
// Recognize index links
if ($show_internal_links) {
$cont = preg_replace('@(index(\\((.+)\\)|):\\s*)([^\\s#].+)@', '\\1<a href="?action=show_index&amp;ns=\\3&amp;index=\\4">\\4</a>', $cont);
}
 
// Recognize web links
$cont = preg_replace('@([a-zA-Z]+://[^\\s]+)@', '<a href="\\1">\\1</a>', $cont);
 
// Recognize E-Mail links
$cont = preg_replace('@([^\\s:]+)\\@([^\\s]+)@', '<a href="mailto:\\1(at)\\2">\\1(at)\\2</a>', $cont); # TODO: antispam
 
// Recognize OID links (with or without leading dot)
if ($show_internal_links) {
$cont = preg_replace(OID_REGEX, '<a href="?action=show_oid&amp;oid=\\1">\\1</a>', $cont);
} else {
$cont = preg_replace(OID_REGEX, '<a href="http://www.oid-info.com/get/\\1">\\1</a>', $cont);
}
 
// Decorate the "redacted" message
if ($show_internal_links) {
$cont = str_replace($rm, "<a href=\"?action=auth_tokens\" style=\"text-decoration:none\"><span style=\"background:black;color:white\">$rm</span></a>", $cont);
} else {
$cont = str_replace($rm, "<span style=\"background:black;color:white\">$rm</span>", $cont);
}
 
// Recognize all UUIDs (except if the UUID is already linked as uuid-index)
if ($show_internal_links) {
$cont = preg_replace('@\\b([A-Fa-f0-9]{8}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{12})\\b(?!</a>|">)@', '<a href="?action=uuid_info&amp;uuid=\\1">\\1</a>', $cont);
}
 
if (($monospace) && ($cont != '')) {
return '<pre>'.$cont.'</pre>';
} else {
return $cont;
}
}
 
function showException($e) {
ob_start();
if (!headers_sent()) header('HTTP/1.1 500 Internal Server Error');
$title = 'Database error';
echo page_header($title);
$msg = $e;
$msg = str_replace(__DIR__, '.', $msg);
?>
<h2><?php echo $title; ?></h2>
<p>An internal error occurred while reading the Volcano database. Please contact the administrator and try again later.</p>
<p>Error message:</p>
<p><pre><?php echo $msg; ?></pre></p>
<?php
echo page_footer();
$cont = ob_get_contents();
ob_end_clean();
return $cont;
}
 
function page_header($title='', $systemID='') { # TODO: w3c
ob_start();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<?php if ($systemID) echo '<meta name="X-OidPlus-SystemID" content="'.$systemID.' ('.uuid_numeric_value($systemID).')" />'."\n"; ?>
<title><?php echo htmlentities($title); ?></title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta name="robots" content="noindex" /><!-- because system is outdated -->
</head>
 
<body>
 
<?php
$cont = ob_get_contents();
ob_end_clean();
return $cont;
}
 
function page_footer() { # TODO: auch version anzeigen
ob_start();
?>
 
<p style="text-align:center">OID+ web interface &copy; 2012 - <?php echo date('Y'); ?> <a href="http://www.viathinksoft.de/">ViaThinkSoft</a>.</p>
 
</body>
 
</html><?php
$cont = ob_get_contents();
ob_end_clean();
return $cont;
}
 
/trunk_oldversion/includes/ip_function.inc.php
0,0 → 1,61
<?php
 
/*
* IP functions
* Copyright 2015 Daniel Marschall, ViaThinkSoft
* Version 2015-10-27
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
function get_real_ip() {
/* Eindeutige IP Adresse erhalten, auch bei Proxies und (neu:) von SSH connections im CLI modus */
// http://lists.phpbar.de/pipermail/php/Week-of-Mon-20040322/007749.html
// Modificated by VTS
// Version: 2015-10-27
 
// TODO: ipv6
 
if (isset($_SERVER['SSH_CLIENT'])) { $ary = explode(' ', $_SERVER['SSH_CLIENT']); return $ary[0]; }
if (isset($_SERVER['SSH_CONNECTION'])) { $ary = explode(' ', $_SERVER['SSH_CONNECTION']); return $ary[0]; }
 
$client_ip = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : '';
 
// It is not secure to use these, since they are not validated: http://www.thespanner.co.uk/2007/12/02/faking-the-unexpected/
// $x_forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
$x_forwarded_for = '';
 
$remote_addr = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '';
 
if (!empty($client_ip)) {
$ip_expl = explode('.', $client_ip);
$referer = explode('.', $remote_addr);
if ($referer[0] != $ip_expl[0]) {
$ip = array_reverse($ip_expl);
$return = implode('.', $ip);
} else {
$return = $client_ip;
}
} else if (!empty($x_forwarded_for)) {
if (strstr($x_forwarded_for, ',')) {
$ip_expl = explode(',', $x_forwarded_for);
$return = end($ip_expl);
} else {
$return = $x_forwarded_for;
}
} else {
$return = $remote_addr;
}
unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl);
return $return;
}
/trunk_oldversion/includes/ipv4_functions.inc.php
0,0 → 1,664
<?php
 
/*
* IPv4 functions for PHP
* Copyright 2012-2019 Daniel Marschall, ViaThinkSoft
* Version 2019-03-11
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
// TODO: oop, exceptions?
 
// Very small self-test:
/*
function ipv4_selftest() {
$iv_b = ipv4_complete('1.2');
$iv_m = 20;
$r = ipv4_cidr2range($iv_b, $iv_m);
echo "$iv_b/$iv_m => $r[0] - $r[1]\n";
 
$rev = ipv4_range2cidr($r[0], $r[1]);
$rev = implode("\n", $rev);
echo "$r[0] - $r[1] => $rev [";
$ok = $rev == "$iv_b/$iv_m";
echo $ok ? 'OK' : 'Mismatch';
echo "]\n";
echo "In-CIDR-Test: ";
echo ipv4_in_cidr("$iv_b/$iv_m", "$iv_b/$iv_m") ? 'OK' : 'Fail';
echo "\n";
}
ipv4_selftest();
*/
 
function ipv4_cidr2range($baseip_or_cidr, $subnet='') {
# (C) 2012 ViaThinkSoft
# Version 1.1
# This function converts an CIDR notation <baseip>/<subnet> into an IPv4 address block array($low_ip, $high_ip)
 
if (strpos($baseip_or_cidr, '/') !== false) {
$tmp = explode('/', $baseip_or_cidr, 2);
$baseip_or_cidr = $tmp[0];
$subnet = $tmp[1];
unset($tmp);
}
 
if (($subnet < 0) || ($subnet > 32)) return false;
 
$maxint32 = 0xFFFFFFFF;
$netmask = $maxint32 << (32-$subnet);
$netmask = $netmask & $maxint32; // crop to 32 bits
$wildcard = $maxint32 ^ $netmask; // ~$netmask;
 
$x = ipv4_incomplete_ip2long($baseip_or_cidr) & $netmask;
$nums = $wildcard;
$low = long2ip($x);
$high = long2ip($x + $nums);
 
return array($low, $high);
}
 
function ipv4_range2cidr($baseip, $topip, $shortening=false) {
# (C) 2012 ViaThinkSoft
# Version 1.0
# This function converts an IPv4 address block into valid CIDR blocks (There may be multiple blocks!)
 
$out = array();
if (ipv4_cmp($baseip, $topip) > 0) return false;
while (ipv4_incomplete_ip2long($baseip)-1 != ipv4_incomplete_ip2long($topip)) {
$i = -1;
do {
$i++;
$range = ipv4_cidr2range($baseip, $i);
$l = $range[0];
$t = $range[1];
} while ((ipv4_cmp($l, $baseip) != 0) || (ipv4_cmp($t, $topip) > 0));
 
# Shortening: Stroke ".0" at the end
if ($shortening) $baseip = ipv4_shortening($baseip);
 
$out[] = "$baseip/$i";
$baseip = ipv4_add($t, 1);
}
return $out;
}
 
function ipv4_shortening($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return preg_replace("|(\\.0{1,3}){0,3}\$|ismU", '', $ip);
}
 
function ipv4_add($baseip, $num) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return long2ip(ipv4_incomplete_ip2long($baseip) + $num);
}
 
function ipv4_sub($baseip, $num) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return long2ip(ipv4_incomplete_ip2long($baseip) - $num);
}
 
function ipv4_cmp($a, $b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$a = ipv4_incomplete_ip2long($a);
$b = ipv4_incomplete_ip2long($b);
 
if ($a == $b) return 0;
if ($a < $b) return -1;
if ($a > $b) return 1;
}
 
function ipv4_in_cidr($haystack, $needle) {
# (C) 2012 ViaThinkSoft
# Version 1.1
 
$x = explode('/', $haystack);
$ha = ipv4_cidr2range($x[0], $x[1]);
 
$x = explode('/', $needle);
if (!isset($x[1])) $x[1] = '32'; // single IP
$ne = ipv4_cidr2range($x[0], $x[1]);
 
$ha_low = ipv4_incomplete_ip2long($ha[0]);
$ha_hig = ipv4_incomplete_ip2long($ha[1]);
$ne_low = ipv4_incomplete_ip2long($ne[0]);
$ne_hig = ipv4_incomplete_ip2long($ne[1]);
 
# HA: low[ ]high
# NE: low[ ]high
 
return ($ne_low >= $ha_low) && ($ne_hig <= $ha_hig);
}
 
function ipv4_complete($short_form) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$short_form = trim($short_form);
if ($short_form == '') return '0.0.0.0';
$c = substr_count($short_form, '.');
if ($c > 3) return false;
if ($c == 3) return $short_form;
$c = substr_count($short_form, '.');
$short_form .= str_repeat('.0', 3-$c);
return $short_form;
}
 
function ipv4_incomplete_ip2long($ip) {
# (C) 2012-2014 ViaThinkSoft
# Version 1.2
 
# return sprintf('%u', ip2long(ipv4_complete($ip)));
return sprintf('%u', ip2long(ipv4_normalize($ip)));
}
 
// IMPORTANT! $cmp_ary[x]=y MUST HAVE x<=y !
function ipv4_merge_address_blocks($data, $debug = false, $shortening = false) {
# (C) 2012-2013 ViaThinkSoft
# Version 2.2
 
if ($debug !== false) $STARTZEIT = time();
 
// 1. Convert IPs to numbers
 
$cmp_ary = array();
foreach ($data as $a => &$b) {
$a = ipv4_incomplete_ip2long($a);
$b = ipv4_incomplete_ip2long($b);
 
$cmp_ary[$a] = $b;
unset($a);
unset($b);
}
 
// 2. Sort array
 
ksort($cmp_ary);
 
// 3. Merge the blocks in an intelligent way (and remove redundant blocks)
 
# Merge overlapping blocks
# [ ]
# [ ] -> [ ]
 
# Merge neighbor blocks
# [ ][ ] -> [ ]
 
# Remove redundant blocks
# [ ] -> [ ]
# [ ]
 
$merge_count = 0;
$redundant_deleted_count = 0;
$round_count = 0;
do {
if ($debug !== false) {
$LAUFZEIT = time() - $STARTZEIT;
echo $debug."Merging... $round_count rounds; merged $merge_count blocks; deleted $redundant_deleted_count redundant blocks; time: $LAUFZEIT seconds\r";
}
 
$round_count++;
 
$clean = true;
 
foreach ($cmp_ary as $a => &$b) {
foreach ($cmp_ary as $x => &$y) {
// x in range [a+1..b+1] ?
if ($x<=$a) continue;
if ($x>$b+1) break;
 
// Merge
$clean = false;
if ($y>$b) {
$merge_count++;
$b = $y;
unset($cmp_ary[$x]);
} else {
$redundant_deleted_count++;
unset($cmp_ary[$x]);
}
}
}
} while (!$clean);
 
if ($debug !== false) {
$LAUFZEIT = time() - $STARTZEIT;
echo $debug."Merge completed. $round_count rounds; merged $merge_count blocks; deleted $redundant_deleted_count redundant blocks; time: $LAUFZEIT seconds\n";
}
 
// 4. Convert back to IPs
 
$out_ary = array();
foreach ($cmp_ary as $a => &$b) {
$a = long2ip($a);
$b = long2ip($b);
if ($shortening) {
$a = ipv4_shortening($a);
$b = ipv4_shortening($b);
}
$out_ary[$a] = $b;
}
 
return $out_ary;
}
 
function ipv4_merge_arrays($data_a, $data_b) {
# (C) 2012 ViaThinkSoft
# Version 1.2
 
$normalized_data_a = array();
foreach ($data_a as $from => &$to) {
$normalized_data_a[ipv4_normalize($from)] = ipv4_normalize($to);
}
 
$normalized_data_b = array();
foreach ($data_b as $from => &$to) {
$normalized_data_b[ipv4_normalize($from)] = ipv4_normalize($to);
}
 
$data = array();
 
foreach ($normalized_data_a as $from => &$to) {
if (isset($normalized_data_b[$from])) {
$data[$from] = ipv4_max($to, $normalized_data_b[$from]);
} else {
$data[$from] = $to;
}
}
 
foreach ($normalized_data_b as $from => &$to) {
if (!isset($normalized_data_a[$from])) {
$data[$from] = $to;
}
}
 
return $data;
}
 
function ipv4_valid($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
# return ipv4_incomplete_ip2long($ip) !== false;
return ip2long($ip) !== false;
}
 
function ipv4_normalize($ip) {
# (C) 2012-2013 ViaThinkSoft
# Version 1.1.1
 
# Example:
# 100.010.001.000 -> 100.10.1.0
 
$ip = ipv4_complete($ip);
if (!$ip) return false;
 
# ip2long buggy: 001.0.0.0 wird nicht akzeptiert
## $cry = explode('.', $ip);
## $cry[0] = preg_replace('@^0+@', '', $cry[0]); if ($cry[0] == '') $cry[0] = '0';
## $cry[1] = preg_replace('@^0+@', '', $cry[1]); if ($cry[1] == '') $cry[1] = '0';
## $cry[2] = preg_replace('@^0+@', '', $cry[2]); if ($cry[2] == '') $cry[2] = '0';
## $cry[3] = preg_replace('@^0+@', '', $cry[3]); if ($cry[3] == '') $cry[3] = '0';
## $ip = implode('.', $cry);
## return $ip;
 
return preg_replace('@^0{0,2}([0-9]{1,3})\.0{0,2}([0-9]{1,3})\.0{0,2}([0-9]{1,3})\.0{0,2}([0-9]{1,3})$@', '\\1.\\2.\\3.\\4', $ip);
}
 
function ipv4_expand($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
# Example:
# 100.10.1.0 -> 100.010.001.000
 
$ip = ipv4_complete($ip);
if (!$ip) return false;
 
$cry = explode('.', $ip);
$cry[0] = str_pad($cry[0], 3, '0', STR_PAD_LEFT);
$cry[1] = str_pad($cry[1], 3, '0', STR_PAD_LEFT);
$cry[2] = str_pad($cry[2], 3, '0', STR_PAD_LEFT);
$cry[3] = str_pad($cry[3], 3, '0', STR_PAD_LEFT);
return implode('.', $cry);
}
 
function ipv4_min($ip_a, $ip_b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
if (ipv4_cmp($ip_a, $ip_b) == -1) {
return $ip_a;
} else {
return $ip_b;
}
}
 
function ipv4_max($ip_a, $ip_b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
if (ipv4_cmp($ip_a, $ip_b) == 1) {
return $ip_a;
} else {
return $ip_b;
}
}
 
function ipv4_ipcount($data) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$cnt = 0;
 
foreach ($data as $from => &$to) {
$cnt += ipv4_incomplete_ip2long($to) - ipv4_incomplete_ip2long($from);
}
 
return $cnt;
}
 
function ipv4_read_file($file) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$data = array();
 
$lines = file($file);
foreach ($lines as &$line) {
$rng = ipv4_line2range($line);
$data[$rng[0]] = $rng[1];
}
 
return $data;
}
 
function ipv4_line2range($line) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$line = trim($line);
 
if (strpos($line, '/') !== false) {
$rng = ipv4_cidr2range($line);
} else {
$rng = explode('-', $line);
$rng[0] = trim($rng[0]);
$rng[1] = trim($rng[1]);
$rng[0] = ipv4_normalize($rng[0]);
if (!isset($rng[1])) $rng[1] = $rng[0];
$rng[1] = ipv4_normalize($rng[1]);
}
 
return $rng;
}
 
# --- New 16,12,12
 
define('IPV4_BITS', 32);
 
function ipv4_distance($ipOrCIDR_Searchterm, $ipOrCIDR_Candidate) {
$ary = ipv4_cidr_split($ipOrCIDR_Searchterm);
$ip = $ary[0];
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
return false;
}
 
$ary = ipv4_cidr_split($ipOrCIDR_Candidate);
$ip = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === false) {
return false;
}
 
$x = ipv4_trackdown($ipOrCIDR_Searchterm);
 
if (ipv4_in_cidr($x[0], $ip.'/'.$cidr_bits)) {
$ary = ipv4_cidr_split($x[0]);
$cidr_bits2 = $ary[1];
if ($cidr_bits2 > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
return $cidr_bits2-$cidr_bits;
}
 
$i = 0;
$max = false;
foreach ($x as &$y) {
if (ipv4_in_cidr($ip.'/'.$cidr_bits, $y)) {
$max = $i;
}
$i++;
}
 
return $max;
}
 
function ipv4_cidr_split($ipOrCIDR) {
$ary = explode('/', $ipOrCIDR, 2);
$cidr_bits = isset($ary[1]) ? $ary[1] : IPV4_BITS;
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
$ip = $ary[0];
return array($ip, $cidr_bits);
}
 
function ipv4_equals($ipOrCIDRA, $ipOrCIDRB) {
return ipv4_normalize_range($ipOrCIDRA) == ipv4_normalize_range($ipOrCIDRB);
}
 
function ipv4_cidr_min_ip($ipOrCIDR) {
$ary = ipv4_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('0', IPV4_BITS-$cidr_bits);
 
return bin2ip($m);
}
 
function ipv4_cidr_max_ip($ipOrCIDR) {
$ary = ipv4_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('1', IPV4_BITS-$cidr_bits);
 
return bin2ip($m);
}
 
function ipv4_normalize_range($ipOrCIDR) {
$ary = ipv4_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('0', IPV4_BITS-$cidr_bits);
 
return bin2ip($m) . '/' . $cidr_bits;
}
 
function ipv4_trackdown($ipOrCIDR) {
$ary = ipv4_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV4_BITS) return false; // throw new Exception('CIDR bits > '.IPV4_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$out = array();
$m = ip2bin($ipOrCIDR);
 
for ($i=$cidr_bits; $i>=0; $i--) {
$m = substr($m, 0, $i) . str_repeat('0', IPV4_BITS-$i);
$out[] = bin2ip($m) . '/' . $i;
}
 
return $out;
}
 
# ---
 
if (!function_exists('ip2bin')) {
function ip2bin($ip) {
# Source: http://php.net/manual/en/function.ip2long.php#104163
# modified by VTS
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
return base_convert(ip2long($ip), 10, 2);
}
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
return false;
}
if (($ip_n = inet_pton($ip)) === false) {
return false;
}
$bits = 15; // 16 x 8 bit = 128bit (ipv6)
$ipbin = ''; # added by vts to avoid warning
while ($bits >= 0) {
$bin = sprintf('%08b', (ord($ip_n[$bits])));
$ipbin = $bin.$ipbin;
$bits--;
}
return $ipbin;
}
}
 
if (!function_exists('bin2ip')) {
function bin2ip($bin) {
# Source: http://php.net/manual/en/function.ip2long.php#104163
# modified by VTS
 
if (strlen($bin) <= 32) { // 32bits (ipv4)
return long2ip(base_convert($bin, 2, 10));
}
if (strlen($bin) != 128) {
return false;
}
$pad = 128 - strlen($bin);
for ($i = 1; $i <= $pad; $i++) {
$bin = '0'.$bin;
}
$bits = 0;
$ipv6 = ''; # added by vts to avoid warning
while ($bits <= 7) {
$bin_part = substr($bin,($bits*16),16);
$ipv6 .= dechex(bindec($bin_part)) . ':';
$bits++;
}
return inet_ntop(inet_pton(substr($ipv6, 0, -1)));
}
}
 
# --- TEST
 
/*
assert(ipv4_normalize('100.010.001.000') == '100.10.1.0');
assert(ipv4_normalize('100.010.01.000') == '100.10.1.0');
assert(ipv4_normalize('100.10.001.000') == '100.10.1.0');
assert(ipv4_normalize('1.010.001.000') == '1.10.1.0');
assert(ipv4_normalize('1.10.001.000') == '1.10.1.0');
 
assert(ipv4_distance('192.168.0.0/16', '192.168.64.0/18') == -2);
assert(ipv4_distance('192.168.0.0/17', '192.168.64.0/18') == -1);
assert(ipv4_distance('192.168.64.0/18', '192.168.64.0/18') == 0);
assert(ipv4_distance('192.168.64.0/19', '192.168.64.0/18') == 1);
assert(ipv4_distance('192.168.64.0/20', '192.168.64.0/18') == 2);
 
assert(ipv4_distance('192.168.69.202/31', '192.168.69.200/31') === false);
assert(ipv4_distance('192.168.69.201/32', '192.168.69.200/32') === false);
assert(ipv4_distance('192.168.69.201', '192.168.69.200') === false);
*/
 
/*
$test = '192.168.69.123';
$x = ipv4_trackdown($test);
foreach ($x as &$cidr) {
$min = ipv4_cidr_min_ip($cidr);
$max = ipv4_cidr_max_ip($cidr);
echo "$cidr ($min - $max)\n";
}
*/
 
 
 
 
function ipv4_sort($ary) {
$f = array();
foreach ($ary as $c) {
$a = explode('/', $c);
$ip = $a[0];
$bits = isset($a[1]) ? $a[1] : 32;
 
$d = ip2bin($ip);
 
# ord('*') must be smaller than ord('0')
$d = substr($d, 0, $bits).str_repeat('*', 32-$bits);
 
$f[$d] = $c;
}
 
return $f;
}
 
function ipv4_make_tree($ary) {
$ary = ipv4_sort($ary);
 
if (count($ary) == 0) return array();
 
$sub_begin = '';
$sub_begin_ip = '';
foreach ($ary as $n => $d) {
$sub_begin = substr($n, 0, strpos($n, '*'));
$sub_begin_ip = $d;
unset($ary[$n]);
break;
}
 
$sub = array();
$nonsub = array();
foreach ($ary as $n => $d) {
if (substr($n, 0, strlen($sub_begin)) == $sub_begin) {
$sub[$n] = $d;
} else {
$nonsub[$n] = $d;
}
}
 
$out = array();
$out[$sub_begin_ip] = ipv4_make_tree($sub);
 
$a = ipv4_make_tree($nonsub);
 
$out = array_merge($out, $a);
 
return $out;
}
 
/trunk_oldversion/includes/ipv6_functions.inc.php
0,0 → 1,766
<?php
 
/*
* IPv6 functions for PHP
* Copyright 2012-2020 Daniel Marschall, ViaThinkSoft
* Version 2020-02-28
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
# This library requires either the GMP extension (or BCMath if gmp_supplement.inc.php is present)
 
// TODO: oop, exceptions?
// TODO: variant without gmp ?
// TODO: IPv6 auflösung 'ffff::192.168.69.1' -> 'ffff:0000:0000:0000:0000:0000:c0a8:4501' geht nicht!!!
 
if (file_exists(__DIR__ . '/gmp_supplement.inc.php')) include_once __DIR__ . '/gmp_supplement.inc.php';
 
define('GMP_ONE', gmp_init('1'));
 
// Very small self-test:
/*
function ipv6_selftest() {
$iv_b = 'c0ff:ee00::';
$iv_m = 32;
$r = ipv6_cidr2range($iv_b, $iv_m);
echo "$iv_b/$iv_m => $r[0] - $r[1]\n";
 
$rev = ipv6_range2cidr($r[0], $r[1]);
$rev = implode("\n", $rev);
echo "$r[0] - $r[1] => $rev [";
$ok = $rev == "$iv_b/$iv_m";
echo $ok ? 'OK' : 'Mismatch';
echo "]\n";
echo "In-CIDR-Test: ";
echo ipv6_in_cidr("$iv_b/$iv_m", "$iv_b/$iv_m") ? 'OK' : 'Fail';
echo "\n";
}
ipv6_selftest();
*/
 
$cache_ipv6_cidr2range = array();
function ipv6_cidr2range($baseip_or_cidr, $subnet='') {
# (C) 2012 ViaThinkSoft
# Version 1.1
# This function converts an CIDR notation <baseip>/<subnet> into an IPv6 address block array($low_ip, $high_ip)
 
global $cache_ipv6_cidr2range;
$vvv = $baseip_or_cidr.'|'.$subnet;
if (isset($cache_ipv6_cidr2range[$vvv])) return $cache_ipv6_cidr2range[$vvv];
 
if (strpos($baseip_or_cidr, '/') !== false) {
$tmp = explode('/', $baseip_or_cidr, 2);
$baseip_or_cidr = $tmp[0];
$subnet = $tmp[1];
unset($tmp);
}
 
if (($subnet < 0) || ($subnet > 128)) {
$cache_ipv6_cidr2range[$vvv] = false;
return false;
}
 
$maxint128 = gmp_sub(gmp_pow('2', 128), GMP_ONE); # TODO: GMP_TWO ?
$netmask = gmp_shiftl($maxint128, 128-$subnet);
$netmask = gmp_and($netmask, $maxint128); // crop to 128 bit
$wildcard = gmp_xor($maxint128, $netmask);
 
$x = gmp_and(ip2long6($baseip_or_cidr), $netmask);
$nums = $wildcard;
$low = long2ip6($x);
$high = long2ip6(gmp_add($x, $nums));
 
$out = array($low, $high);
$cache_ipv6_cidr2range[$vvv] = $out;
return $out;
}
 
$cache_ipv6_range2cidr = array();
function ipv6_range2cidr($baseip, $topip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
# This function converts an IPv6 address block into valid CIDR blocks (There may be multiple blocks!)
 
global $cache_ipv6_range2cidr;
$vvv = $baseip.'|'.$topip;
if (isset($cache_ipv6_range2cidr[$vvv])) return $cache_ipv6_range2cidr[$vvv];
 
$out = array();
if (ipv6_cmp($baseip, $topip) > 0) {
$cache_ipv6_range2cidr[$vvv] = false;
return false;
}
while (gmp_cmp(gmp_sub(ip2long6($baseip), GMP_ONE), ip2long6($topip)) != 0) {
$i = -1;
do {
$i++;
$range = ipv6_cidr2range($baseip, $i);
$l = $range[0];
$t = $range[1];
} while ((ipv6_cmp($l, $baseip) != 0) || (ipv6_cmp($t, $topip) > 0));
 
$out[] = "$baseip/$i";
$baseip = ipv6_add($t, GMP_ONE);
}
 
$cache_ipv6_range2cidr[$vvv] = $out;
return $out;
}
 
function ipv6_add($baseip, $num) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return long2ip6(gmp_add(ip2long6($baseip), $num));
}
 
function ipv6_sub($baseip, $num) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return long2ip6(gmp_sub(ip2long6($baseip), $num));
}
 
function ipv6_cmp($a, $b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return gmp_cmp(ip2long6($a), ip2long6($b));
}
 
$cache_ipv6_in_cidr = array();
function ipv6_in_cidr($haystack, $needle) {
# (C) 2012 ViaThinkSoft
# Version 1.1
 
global $cache_ipv6_in_cidr;
$vvv = $haystack.'|'.$needle;
if (isset($cache_ipv6_in_cidr[$vvv])) return $cache_ipv6_in_cidr[$vvv];
 
$x = explode('/', $haystack);
$ha = ipv6_cidr2range($x[0], $x[1]);
 
$x = explode('/', $needle);
if (!isset($x[1])) $x[1] = 128; // single IP
$ne = ipv6_cidr2range($x[0], $x[1]);
 
$ha_low = ip2long6($ha[0]);
$ha_hig = ip2long6($ha[1]);
$ne_low = ip2long6($ne[0]);
$ne_hig = ip2long6($ne[1]);
 
# HA: low[ ]high
# NE: low[ ]high
 
$out = (gmp_cmp($ne_low, $ha_low) >= 0) && (gmp_cmp($ne_hig, $ha_hig) <= 0);
$cache_ipv6_in_cidr[$vvv] = $out;
return $out;
}
 
// IMPORTANT! $cmp_ary[x]=y MUST HAVE x<=y !
function ipv6_merge_address_blocks($data, $debug = false) {
# (C) 2012-2013 ViaThinkSoft
# Version 2.2
 
if ($debug !== false) $STARTZEIT = time();
 
// 1. Convert IPs to numbers
 
$cmp_ary = array();
foreach ($data as $a => &$b) {
$a = ip2long6($a);
$b = ip2long6($b);
 
$cmp_ary[gmp_strval($a)] = gmp_strval($b);
unset($a);
unset($b);
}
 
// 2. Sort array
 
ksort($cmp_ary);
 
// 3. Merge the blocks in an intelligent way (and remove redundant blocks)
 
# Merge overlapping blocks
# [ ]
# [ ] -> [ ]
 
# Merge neighbor blocks
# [ ][ ] -> [ ]
 
# Remove redundant blocks
# [ ] -> [ ]
# [ ]
 
$merge_count = 0;
$redundant_deleted_count = 0;
$round_count = 0;
do {
if ($debug !== false) {
$LAUFZEIT = time() - $STARTZEIT;
echo $debug."Merging... $round_count rounds; merged $merge_count blocks; deleted $redundant_deleted_count redundant blocks; time: $LAUFZEIT seconds\r";
}
 
$round_count++;
 
$clean = true;
 
foreach ($cmp_ary as $a => &$b) {
foreach ($cmp_ary as $x => &$y) {
// x in range [a+1..b+1] ?
if (gmp_cmp(gmp_init($x), gmp_init($a)) <= 0) continue;
if (gmp_cmp(gmp_init($x), gmp_add(gmp_init($b), GMP_ONE)) > 0) break;
 
// Merge
$clean = false;
if (gmp_cmp(gmp_init($y), gmp_init($b)) > 0) {
$merge_count++;
$b = $y;
unset($cmp_ary[$x]);
} else {
$redundant_deleted_count++;
unset($cmp_ary[$x]);
}
}
}
} while (!$clean);
 
if ($debug !== false) {
$LAUFZEIT = time() - $STARTZEIT;
echo $debug."Merge completed. $round_count rounds; merged $merge_count blocks; deleted $redundant_deleted_count redundant blocks; time: $LAUFZEIT seconds\n";
}
 
// 4. Convert back to IPs
 
$out_ary = array();
foreach ($cmp_ary as $a => &$b) {
$a = long2ip6(gmp_init($a));
$b = long2ip6(gmp_init($b));
$out_ary[$a] = $b;
}
 
return $out_ary;
}
 
function ipv6_merge_arrays($data_a, $data_b) {
# (C) 2012 ViaThinkSoft
# Version 1.2
 
$normalized_data_a = array();
foreach ($data_a as $from => &$to) {
$normalized_data_a[ipv6_normalize($from)] = ipv6_normalize($to);
}
 
$normalized_data_b = array();
foreach ($data_b as $from => &$to) {
$normalized_data_b[ipv6_normalize($from)] = ipv6_normalize($to);
}
 
$data = array();
 
foreach ($normalized_data_a as $from => &$to) {
if (isset($normalized_data_b[$from])) {
$data[$from] = ipv6_max($to, $normalized_data_b[$from]);
} else {
$data[$from] = $to;
}
}
 
foreach ($normalized_data_b as $from => &$to) {
if (!isset($normalized_data_a[$from])) {
$data[$from] = $to;
}
}
 
return $data;
}
 
function ipv6_valid($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
return ip2long6($ip) !== false;
}
 
function ipv6_normalize($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
# Example:
# 2001:0000:0000::1 -> 2001::1
 
$long = ip2long6($ip);
if ($long == -1 || $long === FALSE) return false;
return long2ip6($long);
}
 
function ipv6_expand($ip) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
# Example:
# 2001::1 -> 2001:0000:0000:0000:0000:0000:0000:0000
 
$long = ip2long6($ip);
if ($long == -1 || $long === FALSE) return false;
return long2ip6($long, false);
}
 
function ipv6_min($ip_a, $ip_b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
if (ipv6_cmp($ip_a, $ip_b) == -1) {
return $ip_a;
} else {
return $ip_b;
}
}
 
function ipv6_max($ip_a, $ip_b) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
if (ipv6_cmp($ip_a, $ip_b) == 1) {
return $ip_a;
} else {
return $ip_b;
}
}
 
function ipv6_ipcount($data) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$cnt = gmp_init('0');
 
foreach ($data as $from => &$to) {
$cnt = gmp_add($cnt, gmp_sub(ip2long6($to), ip2long6($from)));
}
 
return gmp_strval($cnt, 10);
}
 
function ipv6_read_file($file) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$data = array();
 
$lines = file($file);
foreach ($lines as &$line) {
$rng = ipv6_line2range($line);
$data[$rng[0]] = $rng[1];
}
 
return $data;
}
 
function ipv6_line2range($line) {
# (C) 2012 ViaThinkSoft
# Version 1.0
 
$line = trim($line);
 
if (strpos($line, '/') !== false) {
$rng = ipv6_cidr2range($line);
} else {
$rng = explode('-', $line);
$rng[0] = trim($rng[0]);
$rng[1] = trim($rng[1]);
$rng[0] = ipv6_normalize($rng[0]);
if (!isset($rng[1])) $rng[1] = $rng[0];
$rng[1] = ipv6_normalize($rng[1]);
}
 
return $rng;
}
 
# ---
 
if (!function_exists('gmp_shiftl')) {
function gmp_shiftl($x, $n) { // shift left
// http://www.php.net/manual/en/ref.gmp.php#99788
return gmp_mul($x, gmp_pow('2', $n));
}
}
 
if (!function_exists('gmp_shiftr')) {
function gmp_shiftr($x, $n) { // shift right
// http://www.php.net/manual/en/ref.gmp.php#99788
return gmp_div($x, gmp_pow('2', $n));
}
}
 
$cache_ip2long6 = array();
function ip2long6($ipv6) {
// Source:
// http://www.netz-guru.de/2009/11/07/php-ipv6-ip2long-und-long2ip-funktionen/
// Slightly modified
 
global $cache_ip2long6;
if (isset($cache_ip2long6[$ipv6])) return $cache_ip2long6[$ipv6];
 
if ($ipv6 == '') $ipv6 = '::';
 
if (filter_var($ipv6, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$cache_ip2long6[$ipv6] = false;
return false;
}
 
$ip_n = @inet_pton($ipv6);
if ($ip_n === false) {
$cache_ip2long6[$ipv6] = false;
return false; // modified
}
$bytes = 16; // 16 bytes x 8 bit/byte = 128bit
$ipv6long = '';
 
while ($bytes > 0) {
$bin = sprintf('%08b',(ord($ip_n[$bytes-1])));
$ipv6long = $bin.$ipv6long;
$bytes--;
}
 
// $out = gmp_strval(gmp_init($ipv6long, 2), 10);
$out = gmp_init($ipv6long, 2);
$cache_ip2long6[$ipv6] = $out;
return $out;
}
 
$cache_long2ip6 = array();
function long2ip6($ipv6long, $compress=true) {
// Source:
// http://www.netz-guru.de/2009/11/07/php-ipv6-ip2long-und-long2ip-funktionen/
// Slightly modified
 
global $cache_long2ip6;
$vvv = ($compress ? 'T' : 'F').$ipv6long;
if (isset($cache_long2ip6[$vvv])) return $cache_long2ip6[$vvv];
 
// $bin = gmp_strval(gmp_init($ipv6long, 10), 2);
$bin = gmp_strval($ipv6long, 2);
if (strlen($bin) < 128) {
$pad = 128 - strlen($bin);
for ($i = 1; $i <= $pad; $i++) {
$bin = '0'.$bin;
}
}
 
$bytes = 0;
$ipv6 = '';
while ($bytes < 8) { // 16 bytes x 8 bit/byte = 128bit
$bin_part = substr($bin,($bytes*16),16);
$part = dechex(bindec($bin_part));
if (!$compress) {
$part = str_pad($part, 4, '0', STR_PAD_LEFT);
}
$ipv6 .= $part.':';
$bytes++;
}
 
if ($compress) {
$out = inet_ntop(inet_pton(substr($ipv6, 0, -1)));
} else {
$out = substr($ipv6, 0, strlen($ipv6)-1);
}
$cache_long2ip6[$vvv] = $out;
return $out;
}
 
# --- New 16,12,12
 
define('IPV6_BITS', 128);
 
$global_ipv6_distance = array();
function ipv6_distance($ipOrCIDR_Searchterm, $ipOrCIDR_Candidate) {
global $global_ipv6_distance;
$vvv = $ipOrCIDR_Searchterm.'|'.$ipOrCIDR_Candidate;
if (isset($global_ipv6_distance[$vvv])) return $global_ipv6_distance[$vvv];
 
$ary = ipv6_cidr_split($ipOrCIDR_Searchterm);
$ip = $ary[0];
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$global_ipv6_distance[$vvv] = false;
return false;
}
 
$ary = ipv6_cidr_split($ipOrCIDR_Candidate);
$ip = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV6_BITS) {
$global_ipv6_distance[$vvv] = false;
return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
}
if (!is_numeric($cidr_bits)) return false;
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$global_ipv6_distance[$vvv] = false;
return false;
}
 
$x = ipv6_trackdown($ipOrCIDR_Searchterm);
 
if (ipv6_in_cidr($x[0], $ip.'/'.$cidr_bits)) {
$ary = ipv6_cidr_split($x[0]);
$cidr_bits2 = $ary[1];
if ($cidr_bits2 > IPV6_BITS) {
$global_ipv6_distance[$vvv] = false;
return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
}
$out = $cidr_bits2-$cidr_bits;
$global_ipv6_distance[$vvv] = $out;
return $out;
}
 
$i = 0;
$max = false;
foreach ($x as &$y) {
if (ipv6_in_cidr($ip.'/'.$cidr_bits, $y)) {
$max = $i;
}
$i++;
}
 
$global_ipv6_distance[$vvv] = $max;
return $max;
}
 
function ipv6_cidr_split($ipOrCIDR) {
$ary = explode('/', $ipOrCIDR, 2);
$cidr_bits = isset($ary[1]) ? $ary[1] : IPV6_BITS;
if ($cidr_bits > IPV6_BITS) return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
if (!is_numeric($cidr_bits)) return false;
$ip = $ary[0];
return array($ip, $cidr_bits);
}
 
function ipv6_equals($ipOrCIDRA, $ipOrCIDRB) {
return ipv6_normalize_range($ipOrCIDRA) == ipv6_normalize_range($ipOrCIDRB);
}
 
function ipv6_cidr_min_ip($ipOrCIDR) {
$ary = ipv6_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV6_BITS) return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('0', IPV6_BITS-$cidr_bits);
 
return bin2ip($m);
}
 
function ipv6_cidr_max_ip($ipOrCIDR) {
$ary = ipv6_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV6_BITS) return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('1', IPV6_BITS-$cidr_bits);
 
return bin2ip($m);
}
 
function ipv6_normalize_range($ipOrCIDR) {
# 2001:1800::1/21
# --> 2001:1800::/21
 
# 2001:1af8:4100:a061:0001::1337
# --> 2001:1af8:4100:a061:1::1337/128
 
$ary = ipv6_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV6_BITS) return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$m = ip2bin($ipOrCIDR);
$m = substr($m, 0, $cidr_bits) . str_repeat('0', IPV6_BITS-$cidr_bits);
 
return bin2ip($m) . '/' . $cidr_bits;
}
 
function ipv6_trackdown($ipOrCIDR) {
$ary = ipv6_cidr_split($ipOrCIDR);
$ipOrCIDR = $ary[0];
$cidr_bits = $ary[1];
if ($cidr_bits > IPV6_BITS) return false; // throw new Exception('CIDR bits > '.IPV6_BITS);
if (!is_numeric($cidr_bits)) return false;
 
$out = array();
$m = ip2bin($ipOrCIDR);
for ($i=$cidr_bits; $i>=0; $i--) {
$m = substr($m, 0, $i) . str_repeat('0', IPV6_BITS-$i);
$out[] = bin2ip($m) . '/' . $i;
}
 
return $out;
}
 
function ipv6_sort($ary) {
$f = array();
foreach ($ary as $c) {
$a = explode('/', $c);
$ip = $a[0];
$bits = isset($a[1]) ? $a[1] : 128;
 
$d = ip2bin($ip);
 
# ord('*') must be smaller than ord('0')
$d = substr($d, 0, $bits).str_repeat('*', 128-$bits);
 
$f[$d] = $c;
}
 
return $f;
}
 
function ipv6_make_tree($ary) {
$ary = ipv6_sort($ary);
 
if (count($ary) == 0) return array();
 
$sub_begin = '';
$sub_begin_ip = '';
foreach ($ary as $n => $d) {
$sub_begin = substr($n, 0, strpos($n, '*'));
$sub_begin_ip = $d;
unset($ary[$n]);
break;
}
 
$sub = array();
$nonsub = array();
foreach ($ary as $n => $d) {
if (substr($n, 0, strlen($sub_begin)) == $sub_begin) {
$sub[$n] = $d;
} else {
$nonsub[$n] = $d;
}
}
 
$out = array();
$out[$sub_begin_ip] = ipv6_make_tree($sub);
 
$a = ipv6_make_tree($nonsub);
 
$out = array_merge($out, $a);
 
return $out;
}
 
# ---
 
if (!function_exists('ip2bin')) {
$cache_ip2bin = array();
function ip2bin($ip) {
# Source: http://php.net/manual/en/function.ip2long.php#104163
# modified by VTS
 
global $cache_ip2bin;
if (isset($cache_ip2bin[$ip])) return $cache_ip2bin[$ip];
 
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false) {
$out = base_convert(ip2long($ip), 10, 2);
$cache_ip2bin[$ip] = $out;
return $out;
}
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
$cache_ip2bin[$ip] = false;
return false;
}
if (($ip_n = inet_pton($ip)) === false) {
$cache_ip2bin[$ip] = false;
return false;
}
$bits = 15; // 16 x 8 bit = 128bit (ipv6)
$ipbin = ''; # added by vts to avoid warning
while ($bits >= 0) {
$bin = sprintf('%08b', (ord($ip_n[$bits])));
$ipbin = $bin.$ipbin;
$bits--;
}
 
$cache_ip2bin[$ip] = $ipbin;
return $ipbin;
}
}
 
if (!function_exists('bin2ip')) {
$cache_bin2ip = array();
function bin2ip($bin) {
# Source: http://php.net/manual/en/function.ip2long.php#104163
# modified by VTS
 
global $cache_bin2ip;
if (isset($cache_bin2ip[$bin])) return $cache_bin2ip[$bin];
 
if (strlen($bin) <= 32) { // 32bits (ipv4)
$out = long2ip(base_convert($bin, 2, 10));
$cache_bin2ip[$bin] = $out;
return $out;
}
if (strlen($bin) != 128) {
$cache_bin2ip[$bin] = false;
return false;
}
$pad = 128 - strlen($bin);
for ($i = 1; $i <= $pad; $i++) {
$bin = '0'.$bin;
}
$bits = 0;
$ipv6 = ''; # added by vts to avoid warning
while ($bits <= 7) {
$bin_part = substr($bin,($bits*16),16);
$ipv6 .= dechex(bindec($bin_part)) . ':';
$bits++;
}
 
$out = inet_ntop(inet_pton(substr($ipv6, 0, -1)));
$cache_bin2ip[$bin] = $out;
return $out;
}
}
 
# --- TEST
 
/*
assert(ipv6_normalize('2001:0000:0000::1') == '2001::1');
 
assert(ipv6_distance('2001:1ae0::/27', '2001:1af8::/29') == -2);
assert(ipv6_distance('2001:1af0::/28', '2001:1af8::/29') == -1);
assert(ipv6_distance('2001:1af8::/29', '2001:1af8::/29') == 0);
assert(ipv6_distance('2001:1af8::/30', '2001:1af8::/29') == 1);
assert(ipv6_distance('2001:1af8::/31', '2001:1af8::/29') == 2);
 
assert(ipv6_distance('2001:1af8:4100:a061:0001::1336/127', '2001:1af8:4100:a061:0001::1335/127') === false);
assert(ipv6_distance('2001:1af8:4100:a061:0001::1336/128', '2001:1af8:4100:a061:0001::1337/128') === false);
assert(ipv6_distance('2001:1af8:4100:a061:0001::1336', '2001:1af8:4100:a061:0001::1337') === false);
*/
 
/*
$test = '2001:1af8:4100:a061:0001::1337';
$x = ipv6_trackdown($test);
foreach ($x as &$cidr) {
$min = ipv6_cidr_min_ip($cidr);
$max = ipv6_cidr_max_ip($cidr);
echo "$cidr ($min - $max)\n";
}
*/
/trunk_oldversion/includes/mac_utils.inc.php
0,0 → 1,130
<?php
 
/*
* MAC utils for PHP
* Copyright 2017 Daniel Marschall, ViaThinkSoft
* Version 19 August 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
define('IEEE_MAC_REGISTRY', __DIR__ . '/web-data');
 
function mac_valid($mac) {
$mac = str_replace(array('-', ':'), '', $mac);
$mac = strtoupper($mac);
 
if (strlen($mac) != 12) return false;
 
$mac = preg_replace('@[0-9A-F]@', '', $mac);
 
return ($mac == '');
}
 
function _lookup_ieee_registry($file, $oui_name, $mac) {
$begin = substr($mac, 0, 2).'-'.substr($mac, 2, 2).'-'.substr($mac, 4, 2);
$f = file_get_contents($file);
 
$f = str_replace("\r", '', $f);
 
# We are using a positive-lookahead because entries like the MA-M references have a blank line between organization and address
preg_match_all('@^\s*'.preg_quote($begin, '@').'\s+\(hex\)\s+(\S+)\s+(.*)\n\n\s*(?=[0-9A-F])@ismU', "$f\n\nA", $m, PREG_SET_ORDER);
foreach ($m as $n) {
preg_match('@(\S+)\s+\(base 16\)(.*)$@ism', $n[2], $m);
 
if (preg_match('@(.+)\-(.+)@ism', $m[1], $o)) {
$z = hexdec(substr($mac, 6, 6));
$beg = hexdec($o[1]);
$end = hexdec($o[2]);
if (($z < $beg) || ($z > $end)) continue;
} else {
$beg = 0x000000;
$end = 0xFFFFFF;
}
 
$x = trim(preg_replace('@^\s+@ism', '', $m[2]));
 
# "PRIVATE" entries are only marked at the "(hex)" line, but not at the "(base16)" line
if ($x == '') $x = trim($n[1]);
 
$x = explode("\n", $x);
 
$ra_len = strlen(dechex($end-$beg));
 
$out = '';
$out .= sprintf("%-24s 0x%s\n", "IEEE $oui_name part:", substr($mac, 0, 12-$ra_len));
$out .= sprintf("%-24s 0x%s\n", "NIC specific part:", substr($mac, 12-$ra_len));
$out .= sprintf("%-24s %s\n", "Registrant:", $x[0]);
foreach ($x as $n => $y) {
if ($n == 0) continue;
else if ($n == 1) $out .= sprintf("%-24s %s\n", "Address of registrant:", $y);
else if ($n >= 2) $out .= sprintf("%-24s %s\n", "", $y);
}
 
// TODO: also print the date of last update of the OUI files
 
return $out;
}
 
return false;
}
 
function decode_mac($mac) {
if (!mac_valid($mac)) return false;
 
// Format MAC
$mac = strtoupper($mac);
$mac = preg_replace('@[^0-9A-F]@', '', $mac);
if (strlen($mac) != 12) {
# echo "Invalid MAC address\n";
return false;
}
$mac_ = preg_replace('@^(..)(..)(..)(..)(..)(..)$@', '\\1-\\2-\\3-\\4-\\5-\\6', $mac);
echo sprintf("%-24s %s\n", "MAC address:", $mac_);
 
// Empfaengergruppe
$ig = hexdec($mac[1]) & 1; // Bit #LSB+0 of Byte 1
$ig_ = ($ig == 0) ? '[0] Individual' : '[1] Group';
echo sprintf("%-24s %s\n", "I/G flag:", $ig_);
 
// Vergabestelle
$ul = hexdec($mac[1]) & 2; // Bit #LSB+1 of Byte 1
$ul_ = ($ul == 0) ? '[0] Universally Administered Address (UAA)' : '[1] Locally Administered Address (LAA)';
echo sprintf("%-24s %s\n", "U/L flag:", $ul_);
 
// Query IEEE registries
// TODO: gilt OUI nur bei Individual UAA?
if (
($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/mam.txt', 'OUI-28 (MA-M)', $mac)) ||
($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/oui36.txt', 'OUI-36 (MA-S)', $mac)) ||
# The IEEE Registration Authority distinguishes between IABs and OUI-36 values. Both are 36-bit values which may be used to generate EUI-48 values, but IABs may not be used to generate EUI-64 values.[6]
# Note: The Individual Address Block (IAB) is an inactive registry activity, which has been replaced by the MA-S registry product as of January 1, 2014.
($x = _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/iab.txt', 'IAB', $mac))
) {
return $x;
} else {
return _lookup_ieee_registry(IEEE_MAC_REGISTRY.'/oui.txt', 'OUI-24 (MA-L)', $mac);
}
 
// TODO
// FF-FF-FF-FF-FF-FF = Broadcast-Adresse
 
// TODO
// IP-Multicast
// 01-00-5E-00-00-00 bis 01-00-5E-7F-FF-FF (unterste 23 bit der MAC = unterste 23 Bit der IP) ...
// 224.0.0.1 -> 01-00-5e-00-00-01
// erste 4 Bits durch Class D konvention belegt. 5 bits sind unbekannt
 
// TODO: VRRP
// 00-00-5E-00-01-ID
}
/trunk_oldversion/includes/mac_utils.inc.phps
0,0 → 1,0
link mac_utils.inc.php
Property changes:
Added: svn:special
+*
\ No newline at end of property
/trunk_oldversion/includes/oid_illegality_rules
0,0 → 1,250
[1.3.6.1.4.1.37476.3.1.5.2]
 
-- Standard OID Illegality Rule Definition File
-- by Daniel Marschall and Olivier Dubuisson
-- Revision: 19 January 2020
-- This file contains all oid-info.com rules as of 2018_09_18_illegal_oid_table.csv
 
-- SYNTAX:
-- -- comment : comments are also allowed after a rule definition
-- 2.999.(11-).0 : the arc values 11 and below are illegal
-- 2.999.(11+).0 : the arc values 11 and above are illegal
-- 2.999.(1-5).0 : the arc values 1 to 5 are illegal
-- 2.999.(!3).0 : only arc 3 is valid, all others are invalid (added in version 2)
-- 2.999.*.0 : * is equal to (0+)
 
 
-- TODO: Add more constraints according to http://www.iana.org/assignments/smi-numbers/smi-numbers.xml
-- IANA REGISTRIES
-- 1.3.6.1 http://www.iana.org/assignments/smi-numbers/smi-numbers.xml
-- 1.3.6.1.1 http://www.iana.org/assignments/ldap-parameters/ldap-parameters-1.csv
-- 1.3.6.1.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-2.csv
-- 1.3.6.1.2.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-3.csv
-- 1.3.6.1.2.1.2.2.1.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-5.csv
-- 1.3.6.1.2.1.2.2.1.3.131 http://www.iana.org/assignments/smi-numbers/smi-numbers-6.csv
-- 1.3.6.1.2.1.10 http://www.iana.org/assignments/smi-numbers/smi-numbers-7.csv
-- 1.3.6.1.2.1.10.23 http://www.iana.org/assignments/smi-numbers/smi-numbers-8.csv
-- 1.3.6.1.2.1.10.166 http://www.iana.org/assignments/smi-numbers/smi-numbers-9.csv
-- 1.3.6.1.2.1.16 http://www.iana.org/assignments/smi-numbers/smi-numbers-10.csv
-- 1.3.6.1.2.1.16.20 http://www.iana.org/assignments/smi-numbers/smi-numbers-11.csv
-- 1.3.6.1.2.1.27 http://www.iana.org/assignments/smi-numbers/smi-numbers-13.csv
-- 1.3.6.1.2.1.27.4 (Registry is empty.)
-- 1.3.6.1.2.1.27.5 (Registry is empty.)
-- 1.3.6.1.2.1.28 ??????????????????????????????????
-- 1.3.6.1.2.1.28.2.1.24 http://www.iana.org/assignments/smi-numbers/smi-numbers-17.csv
-- 1.3.6.1.2.1.34 http://www.iana.org/assignments/smi-numbers/smi-numbers-18.csv
-- 1.3.6.1.2.1.153.4 (Registry is empty.)
-- 1.3.6.1.2.1.194.1.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-20.csv
-- 1.3.6.1.2.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-21.csv
-- 1.3.6.1.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-22.csv
-- 1.3.6.1.3.116 http://www.iana.org/assignments/smi-numbers/smi-numbers-23.csv
-- 1.3.6.1.4 http://www.iana.org/assignments/smi-numbers/smi-numbers-24.csv
-- 1.3.6.1.4.1 http://www.iana.org/assignments/enterprise-numbers
-- 1.3.6.1.5 http://www.iana.org/assignments/smi-numbers/smi-numbers-26.csv
-- 1.3.6.1.5.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-27.csv
-- 1.3.6.1.5.4 http://www.iana.org/assignments/smi-numbers/smi-numbers-28.csv
-- 1.3.6.1.5.5 http://www.iana.org/assignments/smi-numbers/smi-numbers-29.csv
-- 1.3.6.1.5.5.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-30.csv
-- 1.3.6.1.5.5.4 http://www.iana.org/assignments/smi-numbers/smi-numbers-31.csv
-- 1.3.6.1.5.5.8 http://www.iana.org/assignments/smi-numbers/smi-numbers-32.csv
-- 1.3.6.1.5.5.8.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-33.csv
-- 1.3.6.1.5.5.8.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-34.csv
-- 1.3.6.1.5.5.8.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-35.csv
-- 1.3.6.1.5.5.10 http://www.iana.org/assignments/smi-numbers/smi-numbers-36.csv
-- 1.3.6.1.5.5.11 http://www.iana.org/assignments/smi-numbers/ltans.csv
-- 1.3.6.1.5.5.11.0 http://www.iana.org/assignments/smi-numbers/ltans-module-identifiers.csv
-- 1.3.6.1.5.5.11.1 http://www.iana.org/assignments/smi-numbers/ltans-cms-content-types.csv
-- 1.3.6.1.5.5.11.2 http://www.iana.org/assignments/smi-numbers/ltans-ers-encryption-methods.csv
-- 1.3.6.1.5.5.12 http://www.iana.org/assignments/smi-numbers/smi-numbers-37.csv
-- 1.3.6.1.5.5.12.0 http://www.iana.org/assignments/smi-numbers/smi-numbers-38.csv
-- 1.3.6.1.5.5.12.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-39.csv
-- 1.3.6.1.5.5.12.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-40.csv
-- 1.3.6.1.5.5.12.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-41.csv
-- 1.3.6.1.5.5.12.4 http://www.iana.org/assignments/smi-numbers/smi-numbers-42.csv
-- 1.3.6.1.5.5.12.5 http://www.iana.org/assignments/smi-numbers/smi-numbers-43.csv
-- 1.3.6.1.5.5.12.6 http://www.iana.org/assignments/smi-numbers/smi-numbers-44.csv
-- 1.3.6.1.5.5.12.7 http://www.iana.org/assignments/smi-numbers/smi-numbers-45.csv
-- 1.3.6.1.5.5.13 http://www.iana.org/assignments/smi-numbers/smi-numbers-46.csv
-- 1.3.6.1.5.5.15 http://www.iana.org/assignments/smi-numbers/smi-numbers-47.csv
-- 1.3.6.1.5.5.15.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-48.csv
-- 1.3.6.1.5.5.15.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-49.csv
-- 1.3.6.1.5.6 http://www.iana.org/assignments/smi-numbers/smi-numbers-50.csv
-- 1.3.6.1.5.7 http://www.iana.org/assignments/smi-numbers/smi-numbers-51.csv
-- 1.3.6.1.5.7.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-52.csv
-- 1.3.6.1.5.7.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-53.csv
-- 1.3.6.1.5.7.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-54.csv
-- 1.3.6.1.5.7.4 http://www.iana.org/assignments/smi-numbers/smi-numbers-55.csv
-- 1.3.6.1.5.7.5 http://www.iana.org/assignments/smi-numbers/smi-numbers-56.csv
-- 1.3.6.1.5.7.6 http://www.iana.org/assignments/smi-numbers/smi-numbers-57.csv
-- 1.3.6.1.5.7.7 http://www.iana.org/assignments/smi-numbers/smi-numbers-58.csv
-- 1.3.6.1.6 http://www.iana.org/assignments/smi-numbers/smi-numbers-59.csv
-- 1.3.6.1.6.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-60.csv
-- 1.3.6.1.6.2 ??? Not listed in http://www.iana.org/assignments/smi-numbers/smi-numbers.xml
-- 1.3.6.1.6.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-61.csv
-- 1.3.6.1.7 http://www.iana.org/assignments/smi-numbers/smi-numbers-64.csv
-- 1.3.6.1.7.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-65.csv
-- 1.3.6.1.7.1.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-66.csv
-- 1.3.6.1.7.1.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-67.csv
-- 1.3.6.1.7.1.2.1 http://www.iana.org/assignments/smi-numbers/smi-numbers-68.csv
-- 1.3.6.1.7.1.2.2 http://www.iana.org/assignments/smi-numbers/smi-numbers-69.csv
-- 1.3.6.1.7.1.3 http://www.iana.org/assignments/smi-numbers/smi-numbers-70.csv
-- 1.3.6.1.8 http://www.iana.org/assignments/media-feature-tags/media-feature-tags.xhtml
-- 1.3.6.1.8.1 http://www.iana.org/assignments/media-feature-tags/media-feature-tags-1.csv
-- 1.3.6.1.8.2 (No registrations at this time.)
-- 1.3.6.1.8.3 http://www.iana.org/assignments/media-feature-tags/media-feature-tags-3.csv
-- 1.3.6.1.8.4 http://www.iana.org/assignments/media-feature-tags/media-feature-tags-4.csv
 
 
-- CATEGORY: Currently "not expected" OID arc values - once the RAs are reaching a specific arc value, these limits have to be increased
0.(10+) -- itu, currently max 9
1.(4+) -- iso, currently max 3
1.3.6.(2+) -- dod
1.3.6.1.(9+) -- internet
1.3.6.1.2.(3+) -- mgmt
1.3.6.1.2.1.(301+) -- mib-2 (Sep 2015: max 233)
1.3.6.1.2.1.0.* -- reserved
1.3.6.1.2.1.1.(10+) -- system (Sep 2015: max 9)
1.3.6.1.4.(2+) -- private (Sep 2015: max 1)
2.(1000+) -- joint-iso-itu-t (Sep 2015: max 51 & 999)
2.1.(124+) -- asn1 (Sep 2015: max 10 & 123)
2.5.29.(81+) -- OIDs underneath {joint-iso-itu-t(2) ds(5) certificateExtension(29)} have a number less or equal to 80 in the current edition of Rec. ITU-T X.509 | ISO/IEC 9594-8
2.16.840.1.113883.3.(10000+) -- externalUseRoots (Dec 2017: upper bound set to 10,000)
1.3.6.1.3.(147+) -- The highest experiment number is currently (Sep 2015): 126 , see http://www.iana.org/assignments/smi-numbers/smi-numbers.xml
-- Various vendors claim to have arcs higher than the current number: hippisw(147), ipsecSaMonModule(500), ipsecMIB(503), host(999), ppvpnTcMIB(1111), nhrpMIB(9999)
1.3.6.1.5.(8+) -- OIDs underneath 1.3.6.1.5 are not expected (at this point in time) to have a number greater than 7 ( http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-26 )
1.3.6.1.5.2.(6+) -- At this point in time (Apr 2019) OIDs allocated by Kerberos version 2 underneath 1.3.6.1.5.2 are not expected to have a number greater than 5.
-- see https://web.mit.edu/kerberos/krb5-oids/krb5-oids.asn
1.3.6.1.5.7.1.(5+) -- OIDs underneath 1.3.6.1.5.7.1 are not expected (at this point in time) to have a number greater than 4 ( https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-52 )
 
-- CATEGORY: Reserved
1.1.3.* -- Reserved for ISO/IEC 9834-3
 
-- CATEGORY: Unassigned country codes
1.2.1
1.2.2
1.2.6 -- was 1.3.6 meant?
1.2.10
1.2.16
1.2.39
1.2.110 -- According to the secretary of the ISO 3166 maintenance Agency (16 June 2003), country code 110 is un-assigned in ISO 3166-1; it does not represent any country
1.2.158 -- This OID is not used since Taiwan is not an ISO National Body. All OIDs for Taiwan are registered under {joint-iso-itu-t(2) country(16) taiwan(158)}
1.2.886 -- Country code 886 has been abused in 1998 because someone at Taiwan Chungwa Telecom originally believed 886 was an ITU assignment for Taiwan Numeric Code, but the 886 country code ( http://unstats.un.org/unsd/methods/m49/m49chang.htm#ftni ) was assigned to Yemen before that country merged with Democratic Yemen. Taiwan has NO RIGHT to use this arc. The Statistic Division of the United Nations may assign this arc to any country without any notice, so keep using this arc will be a big trouble. Note that the use of this illegal OID should be avoided in any new document and/or standard. All existing OID should be transfered to the 2.16.158 arc which is assigned to Taiwan. Also read Conflicts over Taiwan OIDs: http://www.alvestrand.no/objectid/taiwan.html
1.2.3166
1.2.57958
 
-- CATEGORY: Example OIDS
2.999.* -- OID 2.999 is only used for creating (informal) examples, hence child OIDs do not need to be described in the OID repository, as the same child OID can be reused by someone else for a different purpose
1.3.6.1.4.1.37476.9999.* -- ViaThinkSoft example OID (obsolete in favor of 2.999)
 
-- CATEGORY: Illegal usage (hijacking / collission)
1.3.6.1.2.1.1.7.* -- Illegal redefintion of 1.3.6.1.2.1.1.7 (defined in IETF RFC 1213 without child nodes) by agilent-wanstats.mib as "sysServices"
2.16.158.3 -- Institute for Information Industry claims to have this OID but the Registration Authority for the superior OID confirmed that this OID was never assigned to III
2.16.158.5 -- Taiwan-CA.com, Inc. (TaiCA) claims to have this OID but the Registration Authority for the superior OID confirmed that this OID was never assigned to them
2.16.158.6 -- CHIEF Telecom Inc. (www.chief.com.tw) claims to use this OID but it is illegal because Taiwan non-government organizations are registered under {joint-iso-itu-t(2) country(16) tw(158) organization(1)}
2.16.158.7 -- Organizations have OIDs under {joint-iso-itu-t(2) country(16) tw(158) organization(1)}
1.3.6.1.4.1.(65665+) -- There are illegal definitions of the arcs 65665, 76561 and 123456 found on the internet.
 
-- CATEGORY: Definitions
2.27.(128+) -- Child OIDs are limited to 127 so that the OID can encode in 2 octets.
0.(40+) -- According to Rec. ITU-T X.660 | ISO/IEC 9834-1, "the arcs beneath root arcs 0 and 1 are restricted to forty arcs numbered 0 to 39"
1.(40+) -- According to Rec. ITU-T X.660 | ISO/IEC 9834-1, "the arcs beneath root arcs 0 and 1 are restricted to forty arcs numbered 0 to 39"
1.0.1 -- International Standard ISO 1:2002 is about "Geometrical Product Specifications (GPS) -- Standard reference temperature for geometrical product specification and verification", hence does not define OIDs
1.0.16 -- International Standard ISO 16:1975 is about "Acoustics -- Standard tuning frequency (Standard musical pitch)", hence does not define OIDs
2.25.(340282366920938463463374607431768211456+) -- UUIDs cannot be greater than 2^128-1
1.3.6.1.4.1.37476.30.9.(2147483648+) -- The last arc (system ID) may only have 31 bits
 
-- CATEGORY: Cancelled, withdrawn and rejected OIDs
1.0.29192.2.2.3 -- This OID was allocated to the "Speck" family of block ciphers in ISO/IEC 29192-2 PDAM1 in 2017 but this proposed amendment has been cancelled
1.3.6.1.4.1.37476.9000.36 -- Withdrawn FreeOID by ViaThinkSoft (spam), https://www.viathinksoft.de/freeoid/display_oid.php?oid=36
2.16.840.1.113883.3.20 -- Rejected in the HL7 OID Registry
2.16.840.1.113883.13.(223-225) -- Entered in error in HL7 OID Registry
2.16.840.1.113883.3.24.6.1 -- Entered in error in HL7 OID Registry; The correct OID is 2.16.840.1.113883.4.344
2.16.840.1.113883.3.24.6.2 -- Entered in error in HL7 OID Registry; The correct OID is 2.16.840.1.113883.4.345
2.16.840.1.113883.3.41 -- Rejected by HL7 because it is a duplicate of 2.16.840.1.113883.6.14
2.16.840.1.113883.3.4831.3 -- rejected by HL7: http://www.hl7.org/oid/index.cfm?Comp_OID=2.16.840.1.113883.3.4831.3
 
-- CATEGORY: Misdefined in specifications
1.2.840.113549.1.9.16.0.999 -- According to IETF RFC Errata 3866 ( https://www.rfc-editor.org/errata_search.php?eid=3866 ), the correct number is 49 and not 999 as wrongly specified in IETF RFC 6210
1.0.10118.3.0.61 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 7} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
1.0.10118.3.0.62 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 8} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
1.0.10118.3.0.63 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 9} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
1.0.10118.3.0.64 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 10} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
1.0.10118.3.0.66 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 11} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
1.0.10118.3.0.67 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) hashAlgs(2) 12} (the mistake was found when proofreading ISO/IEC 10118-3:2018 for publication, so it will be corrected in a technical corrigendum or amendment)
0.0.24.752 -- There is a mistake in Rec. ITU-T X.792 (http://www.itu.int/ITU-T/formal-language/itu-t/x/x792/1999/AuditASN1Module.html) where number 752 is used instead of 792.
 
-- CATEGORY: Not assigned by IANA (probably mistyped)
1.3.6.1.5.5.7.3.0 -- OID 1.3.6.1.5.5.7.3.0 has not been assigned by IANA ( https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-1.3.6.1.5.5.7.3 )
1.3.6.1.5.5.1.4 -- Not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-30
1.3.6.1.5.5.1.5 -- Not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-30
1.3.6.1.5.5.1.6 -- Not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-30
1.3.6.1.5.5.1.7 -- Not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-30
1.3.6.1.5.5.1.8 -- Not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-30
1.3.6.1.2.1.10.10 -- OID not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-7
1.3.6.1.2.1.10.1 -- OID not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-7
1.3.6.1.2.1.10.2 -- OID not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-7
1.3.6.1.5.4.(1+) -- The only child OID defined in the SMI Security for Confidentiality Codes ( https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-28 ) is reserved(0)
1.3.6.1.2.1.10.9999 -- OID not allocated at https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-7
1.3.0 -- OID not defined at http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml
1.3.6.1.1.2.0 -- OID not defined at http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml
1.3.6.1.2.2.1.17 -- OID not defined at http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml
1.3.6.1.2.2.1.22 -- OID not defined at http://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml
 
-- CATEGORY: Not defined by IETF (probably mistyped)
1.3.6.1.6.3.1.2.2.6.1000 -- Not defined in IETF RFC 3418
1.3.6.1.2.1.10.18.6.1.(24+) -- IETF RFC 4805 ( https://tools.ietf.org/html/rfc4805 ) only defines 23 child OIDs of 1.3.6.1.2.1.10.18.6.1
1.3.6.1.2.1.10.18.8.1.(14+) -- IETF RFC 4805 ( https://tools.ietf.org/html/rfc4805 ) only defines 13 child OIDs of 1.3.6.1.2.1.10.18.8.1
1.3.6.1.2.1.3.1.(2+) -- According to IETF RFC 1213 ( https://tools.ietf.org/html/rfc1213 ), there is only one child OID underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) at(3) atTable(1)}
1.3.6.1.2.1.39.1.2.(2+) -- According to IETF RFC 1697 ( https://tools.ietf.org/html/rfc1697 ), there is only one child OID underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) rdbmsMIB(39) rdbmsObjects(1) rdbmsDbInfoTable(2)}
1.3.6.1.2.1.39.1.3.(2+) -- According to IETF RFC 1697 ( https://tools.ietf.org/html/rfc1697 ), there is only one child OID underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) rdbmsMIB(39) rdbmsObjects(1) rdbmsDbParamTable(3)}
1.3.6.1.2.1.39.3.1.(2+) -- According to IETF RFC 1697 ( https://tools.ietf.org/html/rfc1697 ), there is only one child OID underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) rdbmsMIB(39) rdbmsConformance(3) rdbmsCompliances(1)}
1.3.6.1.2.1.39.3.2.(2+) -- According to IETF RFC 1697 ( https://tools.ietf.org/html/rfc1697 ), there is only one child OID underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) rdbmsMIB(39) rdbmsConformance(3) rdbmsGroups(2)}
1.3.6.1.2.1.39.(4+) -- According to IETF RFC 1697 ( https://tools.ietf.org/html/rfc1697 ), there are only three child OIDs underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) rdbmsMIB(39)}
1.3.6.1.2.1.4.21.1.(14+) -- IETF RFC 1213 ( http://www.ietf.org/rfc/rfc1213.txt ) defines child OIDs up to number 13 underneath OID 1.3.6.1.2.1.4.21.1
1.3.6.1.1.1.3 -- OID 1.3.6.1.1.1.3 is not defined in IETF RFC 2307 ( https://tools.ietf.org/html/rfc2307.html ). directoryOperTable OBJECT-TYPE is identified by OID 1.3.6.1.4.1.358.4.6.1.3
1.3.6.1.2.1.99.1.1.(2+) -- IETF RFC 3433 ( https://tools.ietf.org/html/rfc3433.html ) defines only one child OID underneath OID 1.3.6.1.2.1.99.1.1
1.3.6.1.2.1.25.1.(8+) -- OIDs underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) host(25) hrSystem(1)} do not have a number greater than 7 in IETF RFC 2790 ( https://tools.ietf.org/html/rfc2790.html )
1.3.6.1.2.1.10.23.(5+) -- OIDs underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) transmission(10) ppp(23)} are not expected to have a number greater than 4 ( https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-8 )
1.3.6.1.2.1.4.(40+) -- Child OIDs of 1.3.6.1.2.1.4 do not have a number greater to 39 in IETF RFC 4293 ( https://datatracker.ietf.org/doc/rfc4293/ )
1.3.6.1.2.1.69.10 -- Not assigned in IETF RFC 4639 ( https://tools.ietf.org/html/rfc4639 )
1.3.6.1.2.1.69.4 -- Not assigned in IETF RFC 4639 ( https://tools.ietf.org/html/rfc4639 ), use {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) docsSubMgt(125)} instead
 
-- CATEGORY: Not assigned (probably mistyped)
2.16.840.1.113883.3.44.21 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) hl7(113883) externalUseRoots(3) stmarys(4421)}
2.16.840.1.11422 -- The correct OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) 114222}
2.16.840.1.(113526-) -- Childs OIDs of 2.16.840.1 have a number greater than or equal to 113,527
1.3.6.1.2.1.10.10.1.1.2 -- This OID is not defined in ACC-MIB (v1) ( http://www.mibdepot.com/cgi-bin/getmib3.cgi?win=mib_a&i=1&n=ACC-MIB&r=ericsson&f=mib_txt_12_3_1_5&v=v1&t=tree#dot5Group )
1.3.6.1.2.1.10.7.20 -- The correct OID is {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) powerEthernetMIB(105)}
1.3.6.1.2.1.10.7.300 -- The correct OID is {iso(1) member-body(2) us(840) ieee802dot3(10006) snmpmibs(300)}
1.3.6.1.2.1.39.1.4.2 -- The correct OID is {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) mib-2(1) transmission(10) sonetMIB(39) sonetObjects(1) sonetFarEndLine(4) sonetFarEndLineIntervalTable(2)}
1.3.6.1.2.2.2.1.(7+) -- OIDs underneath {iso(1) identified-organization(3) dod(6) internet(1) mgmt(2) pib(2) frameworkPib(2) frwkBasePibClasses(1)} cannot be greater than 6 because there are only 6 OBJECT-TYPEs defined in IETF RFC 3318 ( https://tools.ietf.org/html/rfc3318.html )
1.3.6.1.4.1.1226.685 -- The correct OID is 1.3.6.1.4.1.1226.1.685
1.3.6.1.4.1.23.2.8889 -- No such OID underneath {iso(1) identified-organization(3) dod(6) internet(1) private(4) enterprise(1) 23 mibDoc(2)}
1.3.12.999 -- Not assigned by Ecma International
0.0.0 -- Not a series of ITU-T Recommendations
0.3.18 -- Not an assigned DNIC
0.0.8.0 -- Not an H-series ITU-T Recommendation
0.0.23 -- The W-series of ITU-T Recommendations does not exist
2.16.840.1.113883.3.3724.1 -- The correct OID is 2.16.840.1.113883.3.3724
2.49.0.0.174.24900174 -- Invalid WMO OID, see http://alerting.worldweather.org/authorities.php , correct is 2.49.0.0.174.0
2.49.0.0.768.249007680 -- Invalid WMO OID, see http://alerting.worldweather.org/authorities.php , correct is 2.49.0.0.768.0
2.49.0.2.0.0 -- Invalid WMO OID, see http://alerting.worldweather.org/authorities.php , correct is 2.49.0.2.0
0.1.* -- There is no OID underneath OID 0.1
1.2.826.1004 -- The correct OID is 1.2.826.0.1004
1.2.826.1147 -- The correct OID is 1.2.826.0.1147
1.2.826.1296 -- The correct OID is 1.2.826.0.1296
1.2.840.63
1.2.840.802 -- The right OID for IEEE 802.3ad is 1.2.840.10006
1.2.840.1006
1.2.840.10008.421292 -- not assigned by DICOM
1.2.840.11789
2.2.840 -- was 1.2.840 meant?
2.16.840.1.113883.3.0 -- Not assigned by HL7
2.16.840.101 -- The right OID is {joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101)}
1.3.6.1.1.250
1.3.6.1.5.2.(0-1) -- kerberosV5
1.3.6.1.5.2.3.0 -- Not allocated by Kerberos version 2
1.3.6.1.5.2.4.0 -- Not allocated by Kerberos version 2
0.0.17.3303.(!127) -- The only child OID underneath 0.0.17.3303 is 127
 
-- END OF FILE --
/trunk_oldversion/includes/oid_plus.inc.php
0,0 → 1,21
<?php
 
error_reporting(E_ALL | E_NOTICE | E_DEPRECATED | E_STRICT);
 
// Note: There may not be a function include_all(), otherwise, global variables (e.g. for caching) cannot be used in the included units.
 
// Load Core Stuff
foreach (sorted_glob(__DIR__ . '/../core/*.php') as $filename) include_once $filename;
 
// Load Search Providers
// Load Authentification Providers
// Load Field Extenders
foreach (sorted_glob(__DIR__ . '/../plugins/*/*.php') as $filename) include_once $filename;
 
# ---
 
function sorted_glob($mask) {
$files = glob($mask);
sort($files);
return $files;
}
/trunk_oldversion/includes/oid_utils.inc.php
0,0 → 1,831
<?php
 
/*
* OID-Utilities for PHP
* Copyright 2011-2019 Daniel Marschall, ViaThinkSoft
* Version 2019-03-25
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
// All functions in this library are compatible with leading zeroes (not recommended) and leading dots
 
// TODO: change the function names, so that they have a uniform naming schema, and rename "oid identifier" into "asn.1 alphanumeric identifier"
// TODO: Function for finding a shared ancestor, e.g. oid_shared_ancestor('2.999.1.2.3', '2.999.4.5') == '2.999'
 
define('OID_DOT_FORBIDDEN', 0);
define('OID_DOT_OPTIONAL', 1);
define('OID_DOT_REQUIRED', 2);
 
/**
* Checks if an OID has a valid dot notation.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $oid (string)<br />
* An OID in dot notation.
* @param $allow_leading_zeroes (bool)<br />
* true of leading zeroes are allowed or not.
* @param $allow_leading_dot (bool)<br />
* true of leading dots are allowed or not.
* @return (bool) true if the dot notation is valid.
**/
function oid_valid_dotnotation($oid, $allow_leading_zeroes=true, $allow_leading_dot=false, $min_len=0) {
$regex = oid_validation_regex($allow_leading_zeroes, $allow_leading_dot, $min_len);
 
return preg_match($regex, $oid, $m) ? true : false;
}
 
/**
* Returns a full regular expression to validate an OID in dot-notation
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $allow_leading_zeroes (bool)<br />
* true of leading zeroes are allowed or not.
* @param $allow_leading_dot (bool)<br />
* true of leading dots are allowed or not.
* @return (string) The regular expression
**/
function oid_validation_regex($allow_leading_zeroes=true, $allow_leading_dot=false, $min_len=0) {
$leading_dot_policy = $allow_leading_dot ? OID_DOT_OPTIONAL : OID_DOT_FORBIDDEN;
 
$part_regex = oid_part_regex($min_len, $allow_leading_zeroes, $leading_dot_policy);
 
return '@^'.$part_regex.'$@';
}
 
/**
* Returns a partial regular expression which matches valid OIDs in dot notation.
* It can be inserted into regular expressions.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $min_len (int)<br />
* 0="." and greater will be recognized, but not ""<br />
* 1=".2" and greater will be recognized<br />
* 2=".2.999" and greater will be recognized (default)<br />
* etc.
* @param $allow_leading_zeroes (bool)<br />
* true: ".2.0999" will be recognized<br />
* false: ".2.0999" won't be recognized (default)
* @param $leading_dot_policy (int)<br />
* 0 (OID_DOT_FORBIDDEN): forbidden<br />
* 1 (OID_DOT_OPTIONAL) : optional (default)<br />
* 2 (OID_DOT_REQUIRED) : enforced
* @return (string) A regular expression which matches OIDs in dot notation
**/
function oid_part_regex($min_len=2, $allow_leading_zeroes=false, $leading_dot_policy=OID_DOT_OPTIONAL) {
switch ($leading_dot_policy) {
case 0: // forbidden
$lead_dot = '';
break;
case 1: // optional
$lead_dot = '\\.{0,1}';
break;
case 2: // enforced
$lead_dot = '\\.';
break;
default:
assert(false);
break;
}
 
$lead_zero = $allow_leading_zeroes ? '0*' : '';
$zero_till_thirtynine = '(([0-9])|([1-3][0-9]))'; // second arc is limited to 0..39 if root arc is 0..1
$singledot_option = ($min_len == 0) && ($leading_dot_policy != OID_DOT_FORBIDDEN) ? '|\\.' : '';
$only_root_option = ($min_len <= 1) ? '|('.$lead_dot.$lead_zero.'[0-2])' : '';
 
$regex = '
(
(
(
('.$lead_dot.$lead_zero.'[0-1])
\\.'.$lead_zero.$zero_till_thirtynine.'
(\\.'.$lead_zero.'(0|[1-9][0-9]*)){'.max(0, $min_len-2).',}
)|(
('.$lead_dot.$lead_zero.'[2])
(\\.'.$lead_zero.'(0|[1-9][0-9]*)){'.max(0, $min_len-1).',}
)
'.$only_root_option.'
'.$singledot_option.'
)
)';
 
// Remove the indentations which are used to maintain this large regular expression in a human friendly way
$regex = str_replace("\n", '', $regex);
$regex = str_replace("\r", '', $regex);
$regex = str_replace("\t", '', $regex);
$regex = str_replace(' ', '', $regex);
 
return $regex;
}
 
/**
* Searches all OIDs in $text and outputs them as array.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $text (string)<br />
* The text to be parsed
* @param $min_len (int)<br />
* 0="." and greater will be recognized, but not ""<br />
* 1=".2" and greater will be recognized<br />
* 2=".2.999" and greater will be recognized (default)<br />
* etc.
* @param $allow_leading_zeroes (bool)<br />
* true: ".2.0999" will be recognized<br />
* false: ".2.0999" won't be recognized (default)
* @param $leading_dot_policy (int)<br />
* 0 (OID_DOT_FORBIDDEN): forbidden<br />
* 1 (OID_DOT_OPTIONAL) : optional (default)<br />
* 2 (OID_DOT_REQUIRED) : enforced
* @param $requires_whitespace_delimiters (bool)<br />
* true: "2.999" will be recognized, as well as " 2.999 " (default)<br />
* false: "2.999!" will be reconigzed, as well as "2.999.c" (this might be used in in documentations with templates)
* @return (array<string>) An array of OIDs in dot notation
**/
function parse_oids($text, $min_len=2, $allow_leading_zeroes=false, $leading_dot_policy=OID_DOT_OPTIONAL, $requires_whitespace_delimiters=true) {
$regex = oid_detection_regex($min_len, $allow_leading_zeroes, $leading_dot_policy, $requires_whitespace_delimiters);
 
preg_match_all($regex, $text, $matches);
return $matches[1];
}
 
/**
* Returns a full regular expression for detecting OIDs in dot notation inside a text.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $min_len (int)<br />
* 0="." and greater will be recognized, but not ""<br />
* 1=".2" and greater will be recognized<br />
* 2=".2.999" and greater will be recognized (default)<br />
* etc.
* @param $allow_leading_zeroes (bool)<br />
* true: ".2.0999" will be recognized<br />
* false: ".2.0999" won't be recognized (default)
* @param $leading_dot_policy (int)<br />
* 0 (OID_DOT_FORBIDDEN): forbidden<br />
* 1 (OID_DOT_OPTIONAL) : optional (default)<br />
* 2 (OID_DOT_REQUIRED) : enforced
* @param $requires_whitespace_delimiters (bool)<br />
* true: "2.999" will be recognized, as well as " 2.999 " (default)<br />
* false: "2.999!" will be reconigzed, as well as "2.999.c" (this might be used in in documentations with templates)
* @return (string) The regular expression
**/
function oid_detection_regex($min_len=2, $allow_leading_zeroes=false, $leading_dot_policy=OID_DOT_OPTIONAL, $requires_whitespace_delimiters=true) {
if ($requires_whitespace_delimiters) {
// A fully qualified regular expression which can be used by preg_match()
$begin_condition = '(?<=^|\\s)';
$end_condition = '(?=\\s|$)';
} else {
// A partial expression which can be used inside another regular expression
$begin_condition = '(?<![\d])';
$end_condition = '(?![\d])';
}
 
$part_regex = oid_part_regex($min_len, $allow_leading_zeroes, $leading_dot_policy);
 
return '@'.$begin_condition.$part_regex.$end_condition.'@';
}
 
/**
* Returns the parent of an OID in dot notation or the OID itself, if it is the root.<br />
* Leading dots and leading zeroes are tolerated.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-16
* @param $oid (string)<br />
* An OID in dot notation.
* @return (string) The parent OID in dot notation.
**/
function oid_up($oid) {
$oid = sanitizeOID($oid, 'auto');
if ($oid === false) return false;
 
$p = strrpos($oid, '.');
if ($p === false) return $oid;
if ($p == 0) return '.';
 
return substr($oid, 0, $p);
}
 
/**
* Outputs the depth of an OID.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $oid (string) An OID in dot notation (with or without leading dot)
* @return (int) The depth of the OID, e.g. 2.999 and .2.999 has the length 2.
**/
function oid_len($oid) {
if ($oid == '') return 0;
if ($oid[0] == '.') $oid = substr($oid, 1);
return substr_count($oid, '.')+1;
}
function oid_depth($oid) {
return oid_len($oid);
}
 
/**
* Lists all parents of an OID.
* This function tolerates leading dots. The parent of '.' stays '.'.
* The OID will not be checked for validity!
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-17
* @param $oid (string)<br />
* An OID in dot notation.
* @return (array<string>) An array with all parent OIDs.
**/
function oid_parents($oid) {
$parents = array();
 
while (oid_len($oid) > 1) {
$oid = oid_up($oid);
$parents[] = $oid;
}
 
if (substr($oid, 0, 1) == '.') $parents[] = '.';
 
return $parents;
}
 
/*
assert(oid_parents('.1.2.999') == array('.1.2', '.1', '.'));
assert(oid_parents('1.2.999') == array('1.2', '1'));
assert(oid_parents('.') == array('.'));
assert(oid_parents('') == array());
*/
 
/**
* Sorts an array containing OIDs in dot notation.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $ary (array<string>)<br />
* An array of OIDs in dot notation.<br />
* This array will be changed by this method.
* @param $output_with_leading_dot (bool)<br />
* true: The array will be normalized to OIDs with a leading dot.
* false: The array will be normalized to OIDs without a leading dot. (default)
* @return Nothing
**/
function oidSort(&$ary, $output_with_leading_dot=false) {
$out = array();
 
$none = $output_with_leading_dot ? '.' : '';
 
$d = array();
foreach ($ary as &$oid) {
if (($oid == '') || ($oid == '.')) {
$out[] = $none;
} else {
$oid = sanitizeOID($oid, 'auto'); // strike leading zeroes
$bry = explode('.', $oid, 2);
$firstarc = $bry[0];
$rest = (isset($bry[1])) ? $bry[1] : '';
$d[$firstarc][] = $rest;
}
}
unset($oid);
ksort($d);
 
foreach ($d as $firstarc => &$data) {
oidSort($data);
foreach ($data as &$rest) {
$out[] = ($output_with_leading_dot ? '.' : '')."$firstarc" . (($rest != $none) ? ".$rest" : '');
}
}
unset($data);
 
$ary = $out;
}
 
/**
* Removes leading zeroes from an OID in dot notation.
* @author Daniel Marschall, ViaThinkSoft
* @version 2015-08-17
* @param $oid (string)<br />
* An OID in dot notation.
* @param $leading_dot (bool)<br />
* true: The OID is valid, if it contains a leading dot.<br />
* false (default): The OID is valid, if it does not contain a leading dot.
* 'auto: Allow both
* @return (mixed) The OID without leading dots, or <code>false</code> if the OID is syntactically wrong.
**/
$oid_sanitize_cache = array();
function sanitizeOID($oid, $leading_dot=false) {
if ($leading_dot) $leading_dot = substr($oid,0,1) == '.';
 
// We are using a cache, since this function is used very often by OID+
global $oid_sanitize_cache;
$v = ($leading_dot ? 'T' : 'F').$oid;
if (isset($oid_sanitize_cache[$v])) return $oid_sanitize_cache[$v];
 
if ($leading_dot) {
if ($oid == '.') return '';
} else {
if ($oid == '') return '';
}
 
$out = '';
$ary = explode('.', $oid);
foreach ($ary as $n => &$a) {
if (($leading_dot) && ($n == 0)) {
if ($a != '') return false;
continue;
}
 
if (!ctype_digit($a)) return false; // does contain something other than digits
 
// strike leading zeroes
$a = preg_replace("@^0+@", '', $a);
if ($a == '') $a = 0;
 
if (($leading_dot) || ($n != 0)) $out .= '.';
$out .= $a;
}
unset($a);
unset($ary);
 
$oid_sanitize_cache[$v] = $out;
return $out;
}
 
/**
* Shows the top arc of an OID.
* This function tolerates leading dots.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-16
* @param $oid (string)<br />
* An OID in dot notation.
* @return (mixed) The top arc of the OID or empty string if it is already the root ('.')
**/
function oid_toparc($oid) {
$leadingdot = substr($oid,0,1) == '.';
 
$oid = sanitizeOID($oid, $leadingdot);
if ($oid === false) return false;
 
if (!$leadingdot) $oid = '.'.$oid;
 
$p = strrpos($oid, '.');
if ($p === false) return false;
$r = substr($oid, $p+1);
 
if ($leadingdot) {
# if ($r == '') return '.';
return $r;
} else {
return substr($r, 1);
}
}
 
/**
* Calculates the distance between two OIDs.
* This function tolerates leading dots and leading zeroes.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-20
* @param $a (string)<br />
* An OID.
* @param $b (string)<br />
* An OID.
* @return (string) false if both OIDs do not have a child-parent or parent-child relation, e.g. oid_distance('2.999.1.2.3', '2.999.4.5') = false, or if one of the OIDs is syntactially invalid<br />
* >0 if $a is more specific than $b , e.g. oid_distance('2.999.1.2', '2.999') = 2<br />
* <0 if $a is more common than $b , e.g. oid_distance('2.999', '2.999.1.2') = -2
**/
function oid_distance($a, $b) {
if (substr($a,0,1) == '.') $a = substr($a,1);
if (substr($b,0,1) == '.') $b = substr($b,1);
 
$a = sanitizeOID($a, false);
if ($a === false) return false;
$b = sanitizeOID($b, false);
if ($b === false) return false;
 
$ary = explode('.', $a);
$bry = explode('.', $b);
 
$min_len = min(count($ary), count($bry));
 
for ($i=0; $i<$min_len; $i++) {
if ($ary[$i] != $bry[$i]) return false;
}
 
return count($ary) - count($bry);
}
 
/*
assert(oid_distance('2.999.1.2.3', '2.999.4.5') === false);
assert(oid_distance('2.999.1.2', '2.999') === 2);
assert(oid_distance('2.999', '2.999.1.2') === -2);
*/
 
/**
* Adds a leading dot to an OID.
* Leading zeroes are tolerated.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-20
* @param $oid (string)<br />
* An OID.
* @return (string) The OID with a leading dot or false if the OID is syntactially wrong.
**/
function oid_add_leading_dot($oid) {
$oid = sanitizeOID($oid, 'auto');
if ($oid === false) return false;
 
if ($oid[0] != '.') $oid = '.'.$oid;
return $oid;
}
 
/**
* Removes a leading dot to an OID.
* Leading zeroes are tolerated.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-20
* @param $oid (string)<br />
* An OID.
* @return (string) The OID without a leading dot or false if the OID is syntactially wrong.
**/
function oid_remove_leading_dot($oid) {
$oid = sanitizeOID($oid, 'auto');
if ($oid === false) return false;
 
if (substr($oid,0,1) == '.') $oid = substr($oid, 1);
return $oid;
}
 
 
# === OID-IRI NOTATION FUNCTIONS ===
 
if (!function_exists('mb_ord')) {
# http://stackoverflow.com/a/24755772/3544341
function mb_ord($char, $encoding = 'UTF-8') {
if ($encoding === 'UCS-4BE') {
list(, $ord) = (strlen($char) === 4) ? @unpack('N', $char) : @unpack('n', $char);
return $ord;
} else {
return mb_ord(mb_convert_encoding($char, 'UCS-4BE', $encoding), 'UCS-4BE');
}
}
}
 
function iri_char_valid($c, $firstchar, $lastchar) {
// see Rec. ITU-T X.660, clause 7.5
 
if (($firstchar || $lastchar) && ($c == '-')) return false;
 
if ($c == '-') return true;
if ($c == '.') return true;
if ($c == '_') return true;
if ($c == '~') return true;
if (($c >= '0') && ($c <= '9') && (!$firstchar)) return true;
if (($c >= 'A') && ($c <= 'Z')) return true;
if (($c >= 'a') && ($c <= 'z')) return true;
 
$v = mb_ord($c);
 
if (($v >= 0x000000A0) && ($v <= 0x0000DFFE)) return true;
if (($v >= 0x0000F900) && ($v <= 0x0000FDCF)) return true;
if (($v >= 0x0000FDF0) && ($v <= 0x0000FFEF)) return true;
if (($v >= 0x00010000) && ($v <= 0x0001FFFD)) return true;
if (($v >= 0x00020000) && ($v <= 0x0002FFFD)) return true;
if (($v >= 0x00030000) && ($v <= 0x0003FFFD)) return true;
if (($v >= 0x00040000) && ($v <= 0x0004FFFD)) return true;
if (($v >= 0x00050000) && ($v <= 0x0005FFFD)) return true;
if (($v >= 0x00060000) && ($v <= 0x0006FFFD)) return true;
if (($v >= 0x00070000) && ($v <= 0x0007FFFD)) return true;
if (($v >= 0x00080000) && ($v <= 0x0008FFFD)) return true;
if (($v >= 0x00090000) && ($v <= 0x0009FFFD)) return true;
if (($v >= 0x000A0000) && ($v <= 0x000AFFFD)) return true;
if (($v >= 0x000B0000) && ($v <= 0x000BFFFD)) return true;
if (($v >= 0x000C0000) && ($v <= 0x000CFFFD)) return true;
if (($v >= 0x000D0000) && ($v <= 0x000DFFFD)) return true;
if (($v >= 0x000E1000) && ($v <= 0x000EFFFD)) return true;
 
// Note: Rec. ITU-T X.660, clause 7.5.3 would also forbid ranges which are marked in ISO/IEC 10646 as "(This position shall not be used)"
// But tool implementers should be tolerate them, since these limitations can be removed in future.
 
return false;
}
 
function iri_arc_valid($arc, $allow_numeric=true) {
if ($arc == '') return false;
 
if ($allow_numeric && preg_match('@^(\\d+)$@', $arc, $m)) return true; # numeric arc
 
// Question: Should we strip RTL/LTR characters?
 
if (mb_substr($arc, 2, 2) == '--') return false; // see Rec. ITU-T X.660, clause 7.5.4
 
$array = array();
preg_match_all('/./u', $arc, $array, PREG_SET_ORDER);
$len = count($array);
foreach ($array as $i => $char) {
if (!iri_char_valid($char[0], $i==0, $i==$len-1)) return false;
}
 
return true;
}
 
/**
* Checks if an IRI identifier is valid or not.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-17
* @param $iri (string)<br />
* An OID in OID-IRI notation, e.g. /Example/test
* @return (bool) true if the IRI identifier is valid.
**/
function iri_valid($iri) {
if ($iri == '/') return true; // OK?
 
if (substr($iri, 0, 1) != '/') return false;
 
$ary = explode('/', $iri);
array_shift($ary);
foreach ($ary as $a) {
if (!iri_arc_valid($a)) return false;
}
 
return true;
}
 
/*
assert(iri_arc_valid('ABCDEF'));
assert(!iri_arc_valid('-ABCDEF'));
assert(!iri_arc_valid('ABCDEF-'));
assert(!iri_arc_valid(' ABCDEF'));
assert(!iri_arc_valid('2 ABCDEF'));
assert(!iri_arc_valid(''));
 
assert(!iri_valid(''));
assert(iri_valid('/'));
assert(iri_valid('/hello/world'));
assert(iri_valid('/123/world'));
assert(!iri_valid('/hello/0world'));
assert(!iri_valid('/hello/xo--test'));
assert(!iri_valid('/hello/-super-/sd'));
*/
 
/**
* Returns an associative array in the form 'ASN.1' => '/2/1' .
* @author Daniel Marschall, ViaThinkSoft
* @version 2018-01-05
* @see http://itu.int/go/X660
* @return (array) An associative array in the form 'ASN.1' => '/2/1' .
**/
function iri_get_long_arcs() {
$iri_long_arcs = array();
$iri_long_arcs['ASN.1'] = '/2/1';
$iri_long_arcs['Country'] = '/2/16';
$iri_long_arcs['International-Organizations'] = '/2/23';
$iri_long_arcs['UUID'] = '/2/25';
$iri_long_arcs['Tag-Based'] = '/2/27';
$iri_long_arcs['BIP'] = '/2/41';
$iri_long_arcs['Telebiometrics'] = '/2/42';
$iri_long_arcs['Cybersecurity'] = '/2/48';
$iri_long_arcs['Alerting'] = '/2/49';
$iri_long_arcs['OIDResolutionSystem'] = '/2/50';
$iri_long_arcs['GS1'] = '/2/51';
$iri_long_arcs['Example'] = '/2/999'; // English
$iri_long_arcs['Exemple'] = '/2/999'; // French
$iri_long_arcs['Ejemplo'] = '/2/999'; // Spanish
$iri_long_arcs["\u{0627}\u{0644}\u{0645}\u{062B}\u{0627}\u{0644}"] = '/2/999'; // Arabic
$iri_long_arcs["\u{8303}\u{4F8B}"] = '/2/999'; // Chinese
$iri_long_arcs["\u{041F}\u{0440}\u{0438}\u{043C}\u{0435}\u{0440}"] = '/2/999'; // Russian
$iri_long_arcs["\u{C608}\u{C81C}"] = '/2/999'; // Korean
$iri_long_arcs["\u{4F8B}"] = '/2/999'; // Japanese
$iri_long_arcs['Beispiel'] = '/2/999'; // German
return $iri_long_arcs;
}
 
/**
* Tries to shorten/simplify an IRI by applying "long arcs", e.g. /2/999/123 -> /Example/123 .
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-28
* @param $iri (string)<br />
* An OID in OID-IRI notation, e.g. /Example/test
* @return (string) The modified IRI.
**/
function iri_add_longarcs($iri) {
$iri_long_arcs = iri_get_long_arcs();
 
// TODO: $iri valid?
 
$ary = explode('/', $iri);
 
$ary_number_iri = $ary;
if ($ary_number_iri[1] == 'Joint-ISO-ITU-T') $ary_number_iri[1] = '2';
/*
if ($ary_number_iri[1] == '2') {
// TODO: /2/Example -> /2/999 -> /Example
} else {
// Currently, only long arcs inside .2 are defined
// return $iri;
}
*/
$number_iri = implode('/', $ary_number_iri);
 
foreach ($iri_long_arcs as $cur_longarc => $cur_iri) {
// TODO: $cur_iri valid?
 
if (strpos($number_iri.'/', $cur_iri.'/') === 0) {
$cnt = substr_count($cur_iri, '/');
for ($i=1; $i<$cnt; $i++) {
array_shift($ary);
}
$ary[0] = '';
$ary[1] = $cur_longarc;
$iri = implode('/', $ary);
break;
}
}
 
return $iri;
}
 
# === FUNCTIONS FOR OIDS IN ASN.1 NOTATION ===
 
/**
* Checks if an ASN.1 identifier is valid.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $id (string)<br />
* An ASN.1 identifier, e.g. "example". Not "example(99)" or "99" and not a path like "{ 2 999 }"
* Note: Use asn1_path_valid() for validating a whole ASN.1 notation path.
* @return (bool) true, if the identifier is valid: It begins with an lowercase letter and contains only 0-9, a-z, A-Z and "-"
**/
# TODO: umbenennen in asn1_alpha_id_valid
function oid_id_is_valid($id) {
return preg_match('/^([a-z][a-zA-Z0-9-]*)$/', $id);
}
 
/**
* Checks if the ASN.1 notation of an OID is valid.
* This function does not tolerate leading zeros.
* This function will fail (return false) if there are unresolved symbols, e.g. {iso test} is not valid while { iso 123 } is valid.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-17
* @param $asn (string)<br />
* An OID in ASN.1 notation.
* @return (bools) true if the identifier is valid.
**/
function asn1_path_valid($asn1) {
return asn1_to_dot($asn1) != false;
}
 
/**
* Returns an array of standardized ASN.1 alphanumeric identifiers which do not require a numeric identifier, e.g. { 2 example }
* The array has the form '0.0.a' -> '0.0.1'
* @author Daniel Marschall, ViaThinkSoft
* @version 2019-03-25
* @see http://www.oid-info.com/name-forms.htm
* @return (array) Associative array of standardized ASN.1 alphanumeric identifiers
**/
function asn1_get_standardized_array() {
 
// Taken from oid-info.com
// http://www.oid-info.com/name-forms.htm
$standardized = array();
$standardized['itu-t'] = '0';
$standardized['ccitt'] = '0';
$standardized['iso'] = '1';
$standardized['joint-iso-itu-t'] = '2';
$standardized['joint-iso-ccitt'] = '2';
$standardized['0.recommendation'] = '0.0';
$standardized['0.0.a'] = '0.0.1';
$standardized['0.0.b'] = '0.0.2';
$standardized['0.0.c'] = '0.0.3';
$standardized['0.0.d'] = '0.0.4';
$standardized['0.0.e'] = '0.0.5';
$standardized['0.0.f'] = '0.0.6';
$standardized['0.0.g'] = '0.0.7';
$standardized['0.0.h'] = '0.0.8';
$standardized['0.0.i'] = '0.0.9';
$standardized['0.0.j'] = '0.0.10';
$standardized['0.0.k'] = '0.0.11';
$standardized['0.0.l'] = '0.0.12';
$standardized['0.0.m'] = '0.0.13';
$standardized['0.0.n'] = '0.0.14';
$standardized['0.0.o'] = '0.0.15';
$standardized['0.0.p'] = '0.0.16';
$standardized['0.0.q'] = '0.0.17';
$standardized['0.0.r'] = '0.0.18';
$standardized['0.0.s'] = '0.0.19';
$standardized['0.0.t'] = '0.0.20';
$standardized['0.0.u'] = '0.0.21';
$standardized['0.0.v'] = '0.0.22';
$standardized['0.0.w'] = '0.0.23'; // actually, this OID does not exist
$standardized['0.0.x'] = '0.0.24';
$standardized['0.0.y'] = '0.0.25';
$standardized['0.0.z'] = '0.0.26';
$standardized['0.question'] = '0.1';
$standardized['0.administration'] = '0.2';
$standardized['0.network-operator'] = '0.3';
$standardized['0.identified-organization'] = '0.4';
$standardized['1.standard'] = '1.0';
$standardized['1.registration-authority'] = '1.1';
$standardized['1.member-body'] = '1.2';
$standardized['1.identified-organization'] = '1.3';
return $standardized;
}
 
/**
* Converts an OID in ASN.1 notation into an OID in dot notation and tries to resolve well-known identifiers.<br />
* e.g. {joint-iso-itu-t(2) example(999) 1 2 3} --> 2.999.1.2.3<br />
* e.g. {iso 3} --> 1.3
* This function does not tolerate leading zeros.
* This function will fail (return false) if there are unresolved symbols, e.g. {iso test} will not be resolved to 1.test
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-17
* @param $asn (string)<br />
* An OID in ASN.1 notation.
* @return (string) An OID in dot notation without leading dot or false if the path is invalid.
**/
function asn1_to_dot($asn) {
$standardized = asn1_get_standardized_array();
 
// Clean up
$asn = preg_replace('@^\\{(.+)\\}$@', '\\1', $asn, -1, $count);
if ($count == 0) return false; // { and } are required. The asn.1 path will NOT be trimmed by this function
 
// If identifier is set, apply it (no check if it overrides a standardized identifier)
$asn = preg_replace('|\s*([a-z][a-zA-Z0-9-]*)\s*\((\d+)\)|', ' \\2', $asn);
$asn = trim($asn);
 
// Set dots
$asn = preg_replace('|\s+|', '.', $asn);
 
// Apply standardized identifiers (case sensitive)
$asn .= '.';
foreach ($standardized as $s => $r) {
$asn = preg_replace("|^$s|", $r, $asn);
}
$asn = substr($asn, 0, strlen($asn)-1);
 
// Check if all numbers are OK
// -> every arc must be resolved
// -> numeric arcs must not have a leading zero
// -> invalid stuff will be recognized, e.g. a "(1)" without an identifier in front of it
$ary = explode('.', $asn);
foreach ($ary as $a) {
if (!preg_match('@^(0|([1-9]\\d*))$@', $a, $m)) return false;
}
 
return $asn;
}
 
/*
assert(asn1_to_dot('{2 999 (1)}') == false);
assert(asn1_to_dot('{2 999 test}') == false);
assert(asn1_to_dot('{2 999 1}') == '2.999.1');
assert(asn1_to_dot(' {2 999 1} ') == false);
assert(asn1_to_dot('2 999 1') == false);
assert(asn1_to_dot('{2 999 01}') == false);
assert(asn1_to_dot('{ 0 question 123 }') == '0.1.123');
assert(asn1_to_dot('{ iso }') == '1');
assert(asn1_to_dot('{ iso(1) }') == '1');
assert(asn1_to_dot('{ iso(2) }') == '2');
assert(asn1_to_dot('{ iso 3 }') == '1.3');
*/
 
/**
* "Soft corrects" an invalid ASN.1 identifier.<br />
* Attention, by "soft correcting" the ID, it is not authoritative anymore, and might not be able to be resolved by ORS.
* @author Daniel Marschall, ViaThinkSoft
* @version 2014-12-09
* @param $id (string)<br />
* An ASN.1 identifier.
* @param $append_id_prefix (bool)<br />
* true (default): If the identifier doesn't start with a-Z, the problem will be solved by prepending "id-" to the identifier.<br />
* false: If the identifier doesn't start with a-Z, then the problem cannot be solved (method returns empty string).
* @return (string) The "soft corrected" ASN.1 identifier.<br />
* Invalid characters will be removed.<br />
* Uncorrectable start elements (0-9 or "-") will be either removed or solved by prepending "id-" (see <code>$append_id_prefix</code>)<br />
* If the identifier begins with an upper case letter, the letter will be converted into lower case.
**/
function oid_soft_correct_id($id, $append_id_prefix = true) {
// Convert "_" to "-"
$id = str_replace('_', '-', $id);
 
// Remove invalid characters
$id = preg_replace('/[^a-zA-Z0-9-]+/', '', $id);
 
// Remove uncorrectable start elements (0-9 or "-")
if ($append_id_prefix) {
$id = preg_replace('/^([^a-zA-Z]+)/', 'id-$1', $id);
} else {
$id = preg_replace('/^([^a-zA-Z]+)/', '', $id);
}
 
// "Correct" upper case beginning letter by converting it to lower case
if (preg_match('/^[A-Z]/', $id)) {
$id = strtolower($id[0]) . substr($id, 1);
}
 
return $id;
}
 
/trunk_oldversion/includes/oidinfo_api.inc.php
0,0 → 1,1074
<?php
 
/*
* OID-Info.com API for PHP
* Copyright 2019 Daniel Marschall, ViaThinkSoft
* Version 2019-11-06
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
error_reporting(E_ALL | E_NOTICE | E_STRICT | E_DEPRECATED);
 
if(!defined('STDIN')) define('STDIN', fopen('php://stdin', 'rb'));
if(!defined('STDOUT')) define('STDOUT', fopen('php://stdout', 'wb'));
if(!defined('STDERR')) define('STDERR', fopen('php://stderr', 'wb'));
 
if (file_exists(__DIR__ . '/oid_utils.inc.phps')) require_once __DIR__ . '/oid_utils.inc.phps';
if (file_exists(__DIR__ . '/oid_utils.inc.php')) require_once __DIR__ . '/oid_utils.inc.php';
if (file_exists(__DIR__ . '/xml_utils.inc.phps')) require_once __DIR__ . '/xml_utils.inc.phps';
if (file_exists(__DIR__ . '/xml_utils.inc.php')) require_once __DIR__ . '/xml_utils.inc.php';
if (file_exists(__DIR__ . '/../includes/oid_utils.inc.php')) require_once __DIR__ . '/../includes/oid_utils.inc.php';
if (file_exists(__DIR__ . '/../includes/xml_utils.inc.php')) require_once __DIR__ . '/../includes/xml_utils.inc.php';
if (file_exists(__DIR__ . '/../../includes/oid_utils.inc.php')) require_once __DIR__ . '/../../includes/oid_utils.inc.php';
if (file_exists(__DIR__ . '/../../includes/xml_utils.inc.php')) require_once __DIR__ . '/../../includes/xml_utils.inc.php';
if (file_exists(__DIR__ . '/../../../includes/oid_utils.inc.php')) require_once __DIR__ . '/../../../includes/oid_utils.inc.php';
if (file_exists(__DIR__ . '/../../../includes/xml_utils.inc.php')) require_once __DIR__ . '/../../../includes/xml_utils.inc.php';
 
class OIDInfoException extends Exception {
}
 
class OIDInfoAPI {
 
# --- PART 0: Constants
 
// First digit of the ping result
// "-" = error
// "0" = OID does not exist
// "1" = OID does exist, but is not approved yet
// "2" = OID does exist and is accessible
/*private*/ const PING_IDX_EXISTS = 0;
 
// Second digit of the ping result
// "-" = error
// "0" = The OID may not be created
// "1" = OID is not an illegal OID, and none of its ascendant is a leaf and its parent OID is not frozen
/*private*/ const PING_IDX_MAY_CREATE = 1;
 
/*private*/ const SOFT_CORRECT_BEHAVIOR_NONE = 0;
/*private*/ const SOFT_CORRECT_BEHAVIOR_LOWERCASE_BEGINNING = 1;
/*private*/ const SOFT_CORRECT_BEHAVIOR_ALL_POSSIBLE = 2;
 
/*public*/ const DEFAULT_ILLEGALITY_RULE_FILE = __DIR__ . '/oid_illegality_rules';
 
# --- Part 1: "Ping API" for checking if OIDs are available or allowed to create
 
public $verbosePingProviders = array('https://misc.daniel-marschall.de/oid-repository/ping_oid.php?oid={OID}');
 
private $pingCache = array();
 
public $pingCacheMaxAge = 3600;
 
public function clearPingCache() {
$this->pingCache = array();
}
 
public function checkOnlineExists($oid) {
if (!self::strictCheckSyntax($oid)) return false;
 
$pingResult = $this->pingOID($oid);
$ret = $pingResult[self::PING_IDX_EXISTS] >= 1;
return $ret;
}
 
public function checkOnlineAvailable($oid) {
if (!self::strictCheckSyntax($oid)) return false;
 
$pingResult = $this->pingOID($oid);
$ret = $pingResult[self::PING_IDX_EXISTS] == 2;
return $ret;
}
 
public function checkOnlineAllowed($oid) {
if (!self::strictCheckSyntax($oid)) return false;
 
$pingResult = $this->pingOID($oid);
return $pingResult[self::PING_IDX_MAY_CREATE] == 1;
}
 
public function checkOnlineMayCreate($oid) {
if (!self::strictCheckSyntax($oid)) return false;
 
$pingResult = $this->pingOID($oid);
 
// OID is either illegal, or one of their parents are leaf or frozen
# if (!checkOnlineAllowed($oid)) return false;
if ($pingResult[self::PING_IDX_MAY_CREATE] == 0) return false;
 
// The OID exists already, so we don't need to create it again
# if ($this->checkOnlineExists($oid)) return false;
if ($pingResult[self::PING_IDX_EXISTS] >= 1) return false;
 
return true;
}
 
protected function pingOID($oid) {
if (isset($this->pingCache[$oid])) {
$cacheAge = $this->pingCache[$oid][0] - time();
if ($cacheAge <= $this->pingCacheMaxAge) {
return $this->pingCache[$oid][1];
}
}
 
if (count($this->verbosePingProviders) == 0) {
throw new OIDInfoException("No verbose ping provider available!");
}
 
$res = false;
foreach ($this->verbosePingProviders as $url) {
$url = str_replace('{OID}', $oid, $url);
$cn = @file_get_contents($url);
if ($cn === false) continue;
$loc_res = trim($cn);
if (strpos($loc_res, '-') === false) {
$res = $loc_res;
break;
}
}
if ($res === false) {
throw new OIDInfoException("Could not ping OID $oid status!");
}
 
// if ($this->pingCacheMaxAge >= 0) {
$this->pingCache[$oid] = array(time(), $res);
//}
 
return $res;
}
 
# --- PART 2: Syntax checking
 
public static function strictCheckSyntax($oid) {
return oid_valid_dotnotation($oid, false, false, 1);
}
 
// Returns false if $oid has wrong syntax
// Return an OID without leading dot or zeroes, if the syntax is acceptable
public static function trySanitizeOID($oid) {
// Allow leading dots and leading zeroes, but remove then afterwards
$ok = oid_valid_dotnotation($oid, true, true, 1);
if ($ok === false) return false;
 
return sanitizeOID($oid, $oid[0] == '.');
}
 
# --- PART 3: XML file creation
 
protected static function eMailValid($email) {
# TODO: use isemail project
 
if (empty($email)) return false;
 
if (strpos($email, '@') === false) return false;
 
$ary = explode('@', $email, 2);
if (!isset($ary[1])) return false;
if (strpos($ary[1], '.') === false) return false;
 
return true;
}
 
public function softCorrectEMail($email, $params) {
$email = str_replace(' ', '', $email);
$email = str_replace('&', '@', $email);
$email = str_replace('(at)', '@', $email);
$email = str_replace('[at]', '@', $email);
$email = str_replace('(dot)', '.', $email);
$email = str_replace('[dot]', '.', $email);
$email = trim($email);
 
if (!$params['allow_illegal_email'] && !self::eMailValid($email)) {
return '';
}
 
return $email;
}
 
public function softCorrectPhone($phone, $params) {
// TODO: if no "+", add "+1" , but only if address is in USA
// TODO: or use param to fixate country if it is not known
/*
NOTE: with german phone numbers, this will cause trouble, even if we assume "+49"
06223 / 1234
shall be
+49 6223 1234
and not
+49 06223 1234
*/
 
$phone = str_replace('-', ' ', $phone);
$phone = str_replace('.', ' ', $phone);
$phone = str_replace('/', ' ', $phone);
$phone = str_replace('(', ' ', $phone);
$phone = str_replace(')', ' ', $phone);
 
// HL7 registry has included this accidently
$phone = str_replace('&quot;', '', $phone);
 
$phone = trim($phone);
 
return $phone;
}
 
private static function strip_to_xhtml_light($str, $allow_strong_text=false) {
// <strong> is allowed in the XSD, but not <b>
$str = str_ireplace('<b>', '<strong>', $str);
$str = str_ireplace('</b>', '</strong>', $str);
 
if (!$allow_strong_text) {
// <strong> is only used for very important things like the word "deprecated". It should therefore not used for anything else
$str = str_ireplace('<strong>', '', $str);
$str = str_ireplace('</strong>', '', $str);
}
 
$str = preg_replace('@<\s*script.+<\s*/script.*>@isU', '', $str);
$str = preg_replace('@<\s*style.+<\s*/style.*>@isU', '', $str);
 
$str = preg_replace_callback(
'@<(\s*/{0,1}\d*)([^\s/>]+)(\s*[^>]*)>@i',
function ($treffer) {
// see http://oid-info.com/xhtml-light.xsd
$whitelist = array('a', 'br', 'code', 'em', 'font', 'img', 'li', 'strong', 'sub', 'sup', 'ul');
 
$pre = $treffer[1];
$tag = $treffer[2];
$attrib = $treffer[3];
if (in_array($tag, $whitelist)) {
return '<'.$pre.$tag.$attrib.'>';
} else {
return '';
}
}, $str);
 
return $str;
}
 
const OIDINFO_CORRECT_DESC_OPTIONAL_ENDING_DOT = 0;
const OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT = 1;
const OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT = 2;
 
public function correctDesc($desc, $params, $ending_dot_policy=self::OIDINFO_CORRECT_DESC_OPTIONAL_ENDING_DOT, $enforce_xhtml_light=false) {
$desc = trim($desc);
 
$desc = preg_replace('@<!\\[CDATA\\[(.+)\\]\\]>@ismU', '\\1', $desc);
 
if (substr_count($desc, '>') != substr_count($desc, '<')) {
$params['allow_html'] = false;
}
 
$desc = str_replace("\r", '', $desc);
 
if (!$params['allow_html']) {
// htmlentities_numeric() does this for us
/*
$desc = str_replace('&', '&amp;', $desc);
$desc = str_replace('<', '&lt;', $desc);
$desc = str_replace('>', '&gt;', $desc);
$desc = str_replace('"', '&quot;', $desc);
$desc = str_replace("'", '&#39;', $desc); // &apos; is not HTML. It is XML
*/
 
$desc = str_replace("\n", '<br />', $desc);
} else {
// Some problems we had with HL7 registry
$desc = preg_replace('@&lt;(/{0,1}(p|i|b|u|ul|li))&gt;@ismU', '<\\1>', $desc);
# preg_match_all('@&lt;[^ :\\@]+&gt;@ismU', $desc, $m);
# if (count($m[0]) > 0) print_r($m);
 
$desc = preg_replace('@<i>(.+)&lt;i/&gt;@ismU', '<i>\\1</i>', $desc);
$desc = str_replace('<p><p>', '</p><p>', $desc);
 
// <p> are not supported by oid-info.com
$desc = str_replace('<p>', '<br /><br />', $desc);
$desc = str_replace('</p>', '', $desc);
}
 
// Escape unicode characters as numeric &#...;
// The XML 1.0 standard does only has a few entities, but nothing like e.g. &euro; , so we prefer numeric
 
//$desc = htmlentities_numeric($desc, $params['allow_html']);
if (!$params['allow_html']) $desc = htmlentities($desc);
$desc = html_named_to_numeric_entities($desc);
 
// Remove HTML tags which are not allowed
if ($params['allow_html'] && (!$params['ignore_xhtml_light']) && $enforce_xhtml_light) {
// oid-info.com does only allow a few HTML tags
// see http://oid-info.com/xhtml-light.xsd
$desc = self::strip_to_xhtml_light($desc);
}
 
// Solve some XML problems...
$desc = preg_replace('@<\s*br\s*>@ismU', '<br/>', $desc); // auto close <br>
$desc = preg_replace('@(href\s*=\s*)(["\'])(.*)&([^#].*)(\2)@ismU', '\1\2\3&amp;\4\5', $desc); // fix "&" inside href-URLs to &amp;
// TODO: what do we do if there are more XHTML errors (e.g. additional open tags) which would make the XML invalid?
 
// "Trim" <br/>
do { $desc = preg_replace('@^\s*<\s*br\s*/{0,1}\s*>@isU', '', $desc, -1, $count); } while ($count > 0); // left trim
do { $desc = preg_replace('@<\s*br\s*/{0,1}\s*>\s*$@isU', '', $desc, -1, $count); } while ($count > 0); // right trim
 
// Correct double-encoded stuff
if (!isset($params['tolerant_htmlentities']) || $params['tolerant_htmlentities']) {
do {
$old_desc = $desc;
# Full list of entities: https://www.freeformatter.com/html-entities.html
# Max: 8 chars ( &thetasym; )
# Min: 2 chars ( lt,gt,ni,or,ne,le,ge,Mu,Nu,Xi,Pi,mu,nu,xi,pi )
$desc = preg_replace('@(&|&amp;)(#|&#35;)(\d+);@ismU', '&#\3;', $desc);
$desc = preg_replace('@(&|&amp;)([a-zA-Z0-9]{2,8});@ismU', '&\2;', $desc);
} while ($old_desc != $desc);
}
 
// TODO: use the complete list of oid-info.com
// TODO: Make this step optional using $params
/*
Array
(
[0] => Root OID for
[1] => OID for
[2] => OID identifying
[3] => Top arc for
[4] => Arc for
[5] => arc root
[6] => Node for
[7] => Leaf node for
[8] => This OID describes
[9] => [tT]his oid
[10] => This arc describes
[11] => This identifies
[12] => Identifies a
[13] => [Oo]bject [Ii]dentifier
[14] => Identifier for
[15] => This [Ii]dentifier is for
[16] => Identifiers used by
[17] => identifier$
[18] => This branch
[19] => Branch for
[20] => Child tree for
[21] => Child for
[22] => Subtree for
[23] => Sub-OID
[24] => Tree for
[25] => Child object
[26] => Parent OID
[27] => root for
[28] => Assigned for
[29] => Used to identify
[30] => Used in
[31] => Used for
[32] => For use by
[33] => Entry for
[34] => This is for
[35] => ["]?OID["]?
[36] => ^OID
[37] => OID$
[38] => oid
[39] => oid$
[40] => OIDs
)
$x = 'Root OID for ; OID for ; OID identifying ; Top arc for ; Arc for ; arc root; Node for ; Leaf node for ; This OID describes ; [tT]his oid ; This arc describes ; This identifies ; Identifies a ; [Oo]bject [Ii]dentifier; Identifier for ; This [Ii]dentifier is for ; Identifiers used by ; identifier$; This branch ; Branch for ; Child tree for ; Child for ; Subtree for ; Sub-OID; Tree for ; Child object; Parent OID; root for ; Assigned for ; Used to identify ; Used in ; Used for ; For use by ; Entry for ; This is for ; ["]?OID["]? ; ^OID ; OID$; oid ; oid$; OIDs';
$ary = explode('; ', $x);
print_r($ary);
*/
$desc = preg_replace("@^Root OID for the @i", '', $desc);
$desc = preg_replace("@^Root OID for @i", '', $desc);
$desc = preg_replace("@^OID root for the @i", '', $desc);
$desc = preg_replace("@^OID root for @i", '', $desc);
$desc = preg_replace("@^This OID will be used for @i", '', $desc);
$desc = preg_replace("@^This will be a generic OID for the @i", '', $desc);
$desc = preg_replace("@^OID for @i", '', $desc);
$desc = preg_replace("@ Root OID$@i", '', $desc);
$desc = preg_replace("@ OID$@i", '', $desc);
$desc = preg_replace("@ OID Namespace$@i", '', $desc);
$desc = preg_replace("@^OID for @i", '', $desc);
 
$desc = rtrim($desc);
if ($ending_dot_policy == self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT) {
if (($desc != '') && (substr($desc, -1)) != '.') $desc .= '.';
} else if ($ending_dot_policy == self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT) {
$desc = preg_replace('@\\.$@', '', $desc);
}
 
return $desc;
}
 
public function xmlAddHeader($firstName, $lastName, $email) {
// TODO: encode
 
$firstName = htmlentities_numeric($firstName);
if (empty($firstName)) {
throw new OIDInfoException("Please supply a first name");
}
 
$lastName = htmlentities_numeric($lastName);
if (empty($lastName)) {
throw new OIDInfoException("Please supply a last name");
}
 
$email = htmlentities_numeric($email);
if (empty($email)) {
throw new OIDInfoException("Please supply an email address");
}
 
// $out = "<!DOCTYPE oid-database>\n\n";
$out = '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
$out .= '<oid-database xmlns="http://oid-info.com"'."\n";
$out .= ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'."\n";
$out .= ' xsi:schemaLocation="http://oid-info.com '."\n";
$out .= ' http://oid-info.com/oid.xsd">'."\n";
$out .= "\t<submitter>\n";
$out .= "\t\t<first-name>$firstName</first-name>\n";
$out .= "\t\t<last-name>$lastName</last-name>\n";
$out .= "\t\t<email>$email</email>\n";
$out .= "\t</submitter>\n";
 
if (!self::eMailValid($email)) {
throw new OIDInfoException("eMail address '$email' is invalid");
}
 
return $out;
}
 
public function xmlAddFooter() {
return "</oid-database>\n";
}
 
/*
-- CODE TEMPLATE --
 
$params['allow_html'] = false; // Allow HTML in <description> and <information>
$params['allow_illegal_email'] = true; // We should allow it, because we don't know if the user has some kind of human-readable anti-spam technique
$params['soft_correct_behavior'] = OIDInfoAPI::SOFT_CORRECT_BEHAVIOR_NONE;
$params['do_online_check'] = false; // Flag to disable this online check, because it generates a lot of traffic and runtime.
$params['do_illegality_check'] = true;
$params['do_simpleping_check'] = true;
$params['auto_extract_name'] = '';
$params['auto_extract_url'] = '';
$params['always_output_comment'] = false; // Also output comment if there was an error (e.g. OID already existing)
$params['creation_allowed_check'] = true;
$params['tolerant_htmlentities'] = true;
$params['ignore_xhtml_light'] = false;
 
$elements['synonymous-identifier'] = ''; // string or array
$elements['description'] = '';
$elements['information'] = '';
 
$elements['first-registrant']['first-name'] = '';
$elements['first-registrant']['last-name'] = '';
$elements['first-registrant']['address'] = '';
$elements['first-registrant']['email'] = '';
$elements['first-registrant']['phone'] = '';
$elements['first-registrant']['fax'] = '';
$elements['first-registrant']['creation-date'] = '';
 
$elements['current-registrant']['first-name'] = '';
$elements['current-registrant']['last-name'] = '';
$elements['current-registrant']['address'] = '';
$elements['current-registrant']['email'] = '';
$elements['current-registrant']['phone'] = '';
$elements['current-registrant']['fax'] = '';
$elements['current-registrant']['modification-date'] = '';
 
$oid = '1.2.3';
 
$comment = 'test';
 
echo $oa->createXMLEntry($oid, $elements, $params, $comment);
*/
public function createXMLEntry($oid, $elements, $params, $comment='') {
// Backward compatibility
if (!isset($params['do_csv_check'])) $params['do_simpleping_check'] = true;
 
// Set default behavior
if (!isset($params['allow_html'])) $params['allow_html'] = false; // Allow HTML in <description> and <information>
if (!isset($params['allow_illegal_email'])) $params['allow_illegal_email'] = true; // We should allow it, because we don't know if the user has some kind of human-readable anti-spam technique
if (!isset($params['soft_correct_behavior'])) $params['soft_correct_behavior'] = self::SOFT_CORRECT_BEHAVIOR_NONE;
if (!isset($params['do_online_check'])) $params['do_online_check'] = false; // Flag to disable this online check, because it generates a lot of traffic and runtime.
if (!isset($params['do_illegality_check'])) $params['do_illegality_check'] = true;
if (!isset($params['do_simpleping_check'])) $params['do_simpleping_check'] = true;
if (!isset($params['auto_extract_name'])) $params['auto_extract_name'] = '';
if (!isset($params['auto_extract_url'])) $params['auto_extract_url'] = '';
if (!isset($params['always_output_comment'])) $params['always_output_comment'] = false; // Also output comment if there was an error (e.g. OID already existing)
if (!isset($params['creation_allowed_check'])) $params['creation_allowed_check'] = true;
if (!isset($params['tolerant_htmlentities'])) $params['tolerant_htmlentities'] = true;
if (!isset($params['ignore_xhtml_light'])) $params['ignore_xhtml_light'] = false;
 
$out = '';
if (!empty($comment)) $out .= "\t\t<!-- $comment -->\n";
 
if ($params['always_output_comment']) {
$err = $out;
} else {
$err = false;
}
 
if (isset($elements['dotted_oid'])) {
throw new OIDInfoException("'dotted_oid' in the \$elements array is not supported. Please use the \$oid argument.");
}
if (isset($elements['value'])) {
// TODO: WHAT SHOULD WE DO WITH THAT?
throw new OIDInfoException("'value' in the \$elements array is currently not supported.");
}
 
$bak_oid = $oid;
$oid = self::trySanitizeOID($oid);
if ($oid === false) {
fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Ignored '$bak_oid', because it is not a valid OID -->\n");
return $err;
}
 
if ($params['creation_allowed_check']) {
if (!$this->oidMayCreate($oid, $params['do_online_check'], $params['do_simpleping_check'], $params['do_illegality_check'])) {
fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n");
return $err;
}
} else {
if ($params['do_illegality_check'] && ($this->illegalOid($oid))) {
fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n");
return $err;
}
}
 
$elements['description'] = $this->correctDesc($elements['description'], $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, true);
$elements['information'] = $this->correctDesc($elements['information'], $params, self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT, true);
 
// Request by O.D. 26 August 2019
$elements['description'] = trim($elements['description']);
if (preg_match('@^[a-z]@', $elements['description'], $m)) {
$ending_dot_policy = self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT; // for description
if (($ending_dot_policy != self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT) && (strpos($elements['description'], ' ') === false)) { // <-- added by DM
$elements['description'] = '"' . $elements['description'] . '"';
}
}
// End request by O.D. 26. August 2019
 
if ($params['auto_extract_name'] || $params['auto_extract_url']) {
if (!empty($elements['information'])) $elements['information'] .= '<br /><br />';
if ($params['auto_extract_name'] || $params['auto_extract_url']) {
$elements['information'] .= 'Automatically extracted from <a href="'.$params['auto_extract_url'].'">'.$params['auto_extract_name'].'</a>.';
} else if ($params['auto_extract_name']) {
$elements['information'] .= 'Automatically extracted from '.$params['auto_extract_name'];
} else if ($params['auto_extract_url']) {
$hr_url = $params['auto_extract_url'];
// $hr_url = preg_replace('@^https{0,1}://@ismU', '', $hr_url);
$hr_url = preg_replace('@^http://@ismU', '', $hr_url);
$elements['information'] .= 'Automatically extracted from <a href="'.$params['auto_extract_url'].'">'.$hr_url.'</a>.';
}
}
 
// Validate ASN.1 ID
if (isset($elements['synonymous-identifier'])) {
if (!is_array($elements['synonymous-identifier'])) {
$elements['synonymous-identifier'] = array($elements['synonymous-identifier']);
}
foreach ($elements['synonymous-identifier'] as &$synid) {
if ($synid == '') {
$synid = null;
continue;
}
 
$behavior = $params['soft_correct_behavior'];
 
if ($behavior == self::SOFT_CORRECT_BEHAVIOR_NONE) {
if (!oid_id_is_valid($synid)) $synid = null;
} else if ($behavior == self::SOFT_CORRECT_BEHAVIOR_LOWERCASE_BEGINNING) {
$synid[0] = strtolower($synid[0]);
if (!oid_id_is_valid($synid)) $synid = null;
} else if ($behavior == self::SOFT_CORRECT_BEHAVIOR_ALL_POSSIBLE) {
$synid = oid_soft_correct_id($synid);
// if (!oid_id_is_valid($synid)) $synid = null;
} else {
throw new OIDInfoException("Unexpected soft-correction behavior for ASN.1 IDs");
}
}
}
 
// ATTENTION: the XML-generator will always add <dotted-oid> , but what will happen if additionally an
// asn1-path (<value>) is given? (the resulting OIDs might be inconsistent/mismatch)
if (isset($elements['value']) && (!asn1_path_valid($elements['value']))) {
unset($elements['value']);
}
 
// Validate IRI (currently not supported by oid-info.com, but the tag name is reserved)
if (isset($elements['iri'])) {
if (!is_array($elements['iri'])) {
$elements['iri'] = array($elements['iri']);
}
foreach ($elements['iri'] as &$iri) {
// Numeric-only nicht erlauben. Das wäre ja nur in einem IRI-Pfad gültig, aber nicht als einzelner Identifier
if (!iri_arc_valid($iri, false)) $iri = null;
}
}
 
if (isset($elements['first-registrant']['phone']))
$elements['first-registrant']['phone'] = $this->softCorrectPhone($elements['first-registrant']['phone'], $params);
 
if (isset($elements['current-registrant']['phone']))
$elements['current-registrant']['phone'] = $this->softCorrectPhone($elements['current-registrant']['phone'], $params);
 
if (isset($elements['first-registrant']['fax']))
$elements['first-registrant']['fax'] = $this->softCorrectPhone($elements['first-registrant']['fax'], $params);
 
if (isset($elements['current-registrant']['fax']))
$elements['current-registrant']['fax'] = $this->softCorrectPhone($elements['current-registrant']['fax'], $params);
 
if (isset($elements['first-registrant']['email']))
$elements['first-registrant']['email'] = $this->softCorrectEMail($elements['first-registrant']['email'], $params);
 
if (isset($elements['current-registrant']['email']))
$elements['current-registrant']['email'] = $this->softCorrectEMail($elements['current-registrant']['email'], $params);
 
// TODO: if name is empty, but address has 1 line, take it as firstname (but remove hyperlink)
 
$out_loc = '';
foreach ($elements as $name => $val) {
if (($name == 'first-registrant') || ($name == 'current-registrant')) {
$out_loc2 = '';
foreach ($val as $name2 => $val2) {
if (is_null($val2)) continue;
if (empty($val2)) continue;
 
if (!is_array($val2)) $val2 = array($val2);
 
foreach ($val2 as $val3) {
// if (is_null($val3)) continue;
if (empty($val3)) continue;
 
if ($name2 == 'address') {
// $val3 = htmlentities_numeric($val3);
$val3 = $this->correctDesc($val3, $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, true);
} else {
// $val3 = htmlentities_numeric($val3);
$val3 = $this->correctDesc($val3, $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, false);
}
$out_loc2 .= "\t\t\t<$name2>".$val3."</$name2>\n";
}
}
 
if (!empty($out_loc2)) {
$out_loc .= "\t\t<$name>\n";
$out_loc .= $out_loc2;
$out_loc .= "\t\t</$name>\n";
}
} else {
// if (is_null($val)) continue;
if (empty($val) && ($name != 'description')) continue; // description is mandatory, according to http://oid-info.com/oid.xsd
 
if (!is_array($val)) $val = array($val);
 
foreach ($val as $val2) {
// if (is_null($val2)) continue;
if (empty($val2) && ($name != 'description')) continue; // description is mandatory, according to http://oid-info.com/oid.xsd
 
if (($name != 'description') && ($name != 'information')) { // don't correctDesc description/information, because we already did it above.
// $val2 = htmlentities_numeric($val2);
$val2 = $this->correctDesc($val2, $params, self::OIDINFO_CORRECT_DESC_OPTIONAL_ENDING_DOT, false);
}
$out_loc .= "\t\t<$name>".$val2."</$name>\n";
}
}
}
 
if (!empty($out)) {
$out = "\t<oid>\n"."\t\t".trim($out)."\n";
} else {
$out = "\t<oid>\n";
}
$out .= "\t\t<dot-notation>$oid</dot-notation>\n";
$out .= $out_loc;
$out .= "\t</oid>\n";
 
return $out;
}
 
# --- PART 4: Offline check if OIDs are illegal
 
protected $illegality_rules = array();
 
public function clearIllegalityRules() {
$this->illegality_rules = array();
}
 
public function loadIllegalityRuleFile($file) {
if (!file_exists($file)) {
throw new OIDInfoException("Error: File '$file' does not exist");
}
 
$lines = file($file);
 
if ($lines === false) {
throw new OIDInfoException("Error: Could not load '$file'");
}
 
$signature = trim(array_shift($lines));
if (($signature != '[1.3.6.1.4.1.37476.3.1.5.1]') && ($signature != '[1.3.6.1.4.1.37476.3.1.5.2]')) {
throw new OIDInfoException("'$file' does not seem to a valid illegality rule file (file format OID does not match. Signature $signature unexpected)");
}
 
foreach ($lines as $line) {
// Remove comments
$ary = explode('--', $line);
$rule = trim($ary[0]);
 
if ($rule !== '') $this->addIllegalityRule($rule);
}
}
 
public function addIllegalityRule($rule) {
$test = $rule;
$test = preg_replace('@\\.\\(!\\d+\\)@ismU', '.0', $test); // added in ver 2
$test = preg_replace('@\\.\\(\\d+\\+\\)@ismU', '.0', $test);
$test = preg_replace('@\\.\\(\\d+\\-\\)@ismU', '.0', $test);
$test = preg_replace('@\\.\\(\\d+\\-\\d+\\)@ismU', '.0', $test);
$test = preg_replace('@\\.\\*@ismU', '.0', $test);
 
if (!oid_valid_dotnotation($test, false, false, 1)) {
throw new OIDInfoException("Illegal illegality rule '$rule'.");
}
 
$this->illegality_rules[] = $rule;
}
 
private static function bigint_cmp($a, $b) {
if (function_exists('bccomp')) {
return bccomp($a, $b);
}
 
if (function_exists('gmp_cmp')) {
return gmp_cmp($a, $b);
}
 
if ($a > $b) return 1;
if ($a < $b) return -1;
return 0;
}
 
public function illegalOID($oid, &$illegal_root='') {
$bak = $oid;
$oid = self::trySanitizeOID($oid);
if ($oid === false) {
$illegal_root = $bak;
return true; // is illegal
}
 
$rules = $this->illegality_rules;
 
foreach ($rules as $rule) {
$rule = str_replace(array('(', ')'), '', $rule);
 
$oarr = explode('.', $oid);
$rarr = explode('.', $rule);
 
if (count($oarr) < count($rarr)) continue;
 
$rulefit = true;
 
$illrootary = array();
 
$vararcs = 0;
$varsfit = 0;
for ($i=0; $i<count($rarr); $i++) {
$oelem = $oarr[$i];
$relem = $rarr[$i];
 
$illrootary[] = $oelem;
 
if ($relem == '*') $relem = '0+';
 
$startchar = substr($relem, 0, 1);
$endchar = substr($relem, -1, 1);
if ($startchar == '!') { // added in ver 2
$vararcs++;
$relem = substr($relem, 1, strlen($relem)-1); // cut away first char
$cmp = self::bigint_cmp($oelem, $relem) != 0;
if ($cmp) $varsfit++;
} else if ($endchar == '+') {
$vararcs++;
$relem = substr($relem, 0, strlen($relem)-1); // cut away last char
$cmp = self::bigint_cmp($oelem, $relem) >= 0;
if ($cmp) $varsfit++;
} else if ($endchar == '-') {
$vararcs++;
$relem = substr($relem, 0, strlen($relem)-1); // cut away last char
$cmp = self::bigint_cmp($oelem, $relem) <= 0;
if ($cmp) $varsfit++;
} else if (strpos($relem, '-') !== false) {
$vararcs++;
$limarr = explode('-', $relem);
$limmin = $limarr[0];
$limmax = $limarr[1];
$cmp_min = self::bigint_cmp($oelem, $limmin) >= 0;
$cmp_max = self::bigint_cmp($oelem, $limmax) <= 0;
if ($cmp_min && $cmp_max) $varsfit++;
} else {
if ($relem != $oelem) {
$rulefit = false;
break;
}
}
}
 
if ($rulefit && ($vararcs == $varsfit)) {
$illegal_root = implode('.', $illrootary);
return true; // is illegal
}
}
 
$illegal_root = '';
return false; // not illegal
}
 
# --- PART 5: Misc functions
 
function __construct() {
if (file_exists(self::DEFAULT_ILLEGALITY_RULE_FILE)) {
$this->loadIllegalityRuleFile(self::DEFAULT_ILLEGALITY_RULE_FILE);
}
}
 
public static function getPublicURL($oid) {
return "http://oid-info.com/get/$oid";
}
 
public function oidExisting($oid, $onlineCheck=true, $useSimplePingProvider=true) {
$bak_oid = $oid;
$oid = self::trySanitizeOID($oid);
if ($oid === false) {
throw new OIDInfoException("'$bak_oid' is not a valid OID");
}
 
$canuseSimplePingProvider = $useSimplePingProvider && $this->simplePingProviderAvailable();
if ($canuseSimplePingProvider) {
if ($this->simplePingProviderCheckOID($oid)) return true;
}
if ($onlineCheck) {
return $this->checkOnlineExists($oid);
}
if ((!$canuseSimplePingProvider) && (!$onlineCheck)) {
throw new OIDInfoException("No simple or verbose checking method chosen/available");
}
return false;
}
 
public function oidMayCreate($oid, $onlineCheck=true, $useSimplePingProvider=true, $illegalityCheck=true) {
$bak_oid = $oid;
$oid = self::trySanitizeOID($oid);
if ($oid === false) {
throw new OIDInfoException("'$bak_oid' is not a valid OID");
}
 
if ($illegalityCheck && $this->illegalOID($oid)) return false;
 
$canuseSimplePingProvider = $useSimplePingProvider && $this->simplePingProviderAvailable();
if ($canuseSimplePingProvider) {
if ($this->simplePingProviderCheckOID($oid)) return false;
}
if ($onlineCheck) {
return $this->checkOnlineMayCreate($oid);
}
if ((!$canuseSimplePingProvider) && (!$onlineCheck)) {
throw new OIDInfoException("No simple or verbose checking method chosen/available");
}
return true;
}
 
# --- PART 6: Simple Ping Providers
# TODO: Question ... can't these provider concepts (SPP and VPP) not somehow be combined?
 
protected $simplePingProviders = array();
 
public function addSimplePingProvider($addr) {
if (!isset($this->simplePingProviders[$addr])) {
if (strtolower(substr($addr, -4, 4)) == '.csv') {
$this->simplePingProviders[$addr] = new CSVSimplePingProvider($addr);
} else {
$this->simplePingProviders[$addr] = new OIDSimplePingProvider($addr);
// $this->simplePingProviders[$addr]->connect();
}
}
return $this->simplePingProviders[$addr];
}
 
public function removeSimplePingProvider($addr) {
$this->simplePingProviders[$addr]->disconnect();
unset($this->simplePingProviders[$addr]);
}
 
public function removeAllSimplePingProviders() {
foreach ($this->simplePingProviders as $addr => $obj) {
$this->removeSimplePingProvider($addr);
}
}
 
public function listSimplePingProviders() {
$out = array();
foreach ($this->simplePingProviders as $addr => $obj) {
$out[] = $addr;
}
return $out;
}
 
public function simplePingProviderCheckOID($oid) {
if (!$this->simplePingProviderAvailable()) {
throw new OIDInfoException("No simple ping providers available.");
}
 
$one_null = false;
foreach ($this->simplePingProviders as $addr => $obj) {
$res = $obj->queryOID($oid);
if ($res) return true;
if ($res !== false) $one_null = true;
}
 
return $one_null ? null : false;
}
 
public function simplePingProviderAvailable() {
return count($this->simplePingProviders) >= 1;
}
 
}
 
interface IOIDSimplePingProvider {
public function queryOID($oid);
public function disconnect();
public function connect();
}
 
class CSVSimplePingProvider implements IOIDSimplePingProvider {
protected $csvfile = '';
protected $lines = array();
protected $filemtime = 0;
 
public function queryOID($oid) {
$this->reloadCSV();
return in_array($oid, $this->lines);
}
 
public function disconnect() {
// Nothing
}
 
public function connect() {
// Nothing
}
 
// TODO: This cannot handle big CSVs. We need to introduce the old code of "2016-09-02_old_oidinfo_api_with_csv_reader.zip" here.
protected function reloadCSV() {
if (!file_exists($this->csvfile)) {
throw new OIDInfoException("File '".$this->csvfile."' does not exist");
}
$filemtime = filemtime($this->csvfile);
if ($filemtime != $this->filemtime) {
$this->lines = file($csvfile);
$this->filemtime = $filemtime;
}
}
 
function __construct($csvfile) {
$this->csvfile = $csvfile;
$this->reloadCSV();
}
}
 
 
class OIDSimplePingProvider implements IOIDSimplePingProvider {
protected $addr = '';
protected $connected = false;
protected $socket = null;
 
const SPP_MAX_CONNECTION_ATTEMPTS = 3; // TODO: Auslagern in OIDInfoAPI Klasse...?
 
const DEFAULT_PORT = 49500;
 
protected function spp_reader_init() {
$this->spp_reader_uninit();
 
$ary = explode(':', $this->addr);
$host = $ary[0];
$service_port = isset($ary[1]) ? $ary[1] : self::DEFAULT_PORT;
$address = @gethostbyname($host);
if ($address === false) {
echo "gethostbyname() failed.\n"; // TODO: exceptions? (Auch alle "echos" darunter)
return false;
}
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this->socket === false) {
echo "socket_create() failed: " . socket_strerror(socket_last_error()) . "\n";
return false;
}
$result = @socket_connect($this->socket, $address, $service_port);
if ($result === false) {
echo "socket_connect() failed: " . socket_strerror(socket_last_error($this->socket)) . "\n";
return false;
}
 
$this->connected = true;
}
 
protected function spp_reader_avail($oid, $failcount=0) {
$in = "${oid}\n\0"; // PHP's socket_send() does not send a trailing \n . There needs to be something after the \n ... :(
 
if ($failcount >= self::SPP_MAX_CONNECTION_ATTEMPTS) {
echo "Query $oid: CONNECTION FAILED!\n";
return null;
}
 
if (!$this->connected) {
$this->spp_reader_init();
}
 
$s = @socket_send($this->socket, $in, strlen($in), 0);
if ($s != strlen($in)) {
// echo "Query $oid: Sending failed\n";
$this->spp_reader_init();
if (!$this->socket) return null;
return $this->spp_reader_avail($oid, $failcount+1);
}
 
$out = @socket_read($this->socket, 2048);
if (trim($out) == '1') {
return true;
} else if (trim($out) == '0') {
return false;
} else {
// echo "Query $oid: Receiving failed\n";
$this->spp_reader_init();
if (!$this->socket) return null;
return $this->spp_reader_avail($oid, $failcount+1);
}
}
 
protected function spp_reader_uninit() {
if (!$this->connected) return;
@socket_close($this->socket);
$this->connected = false;
}
 
public function queryOID($oid) {
if (trim($oid) === 'bye') return null;
return $this->spp_reader_avail($oid);
}
 
public function disconnect() {
return $this->spp_reader_uninit();
}
 
public function connect() {
return $this->spp_reader_init();
}
 
function __construct($addr='localhost:49500') {
$this->addr = $addr;
}
 
}
/trunk_oldversion/includes/uuid_utils.inc.php
0,0 → 1,499
<?php
 
/*
* UUID utils for PHP
* Copyright 2011-2020 Daniel Marschall, ViaThinkSoft
* Version 2020-02-28
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
# This library requires either the GMP extension (or BCMath if gmp_supplement.inc.php is present)
 
if (file_exists(__DIR__ . '/mac_utils.inc.phps')) include_once __DIR__ . '/mac_utils.inc.phps';
if (file_exists(__DIR__ . '/gmp_supplement.inc.php')) include_once __DIR__ . '/gmp_supplement.inc.php';
 
define('UUID_NAMEBASED_NS_DNS', '6ba7b810-9dad-11d1-80b4-00c04fd430c8');
define('UUID_NAMEBASED_NS_URL', '6ba7b811-9dad-11d1-80b4-00c04fd430c8');
define('UUID_NAMEBASED_NS_OID', '6ba7b812-9dad-11d1-80b4-00c04fd430c8');
define('UUID_NAMEBASED_NS_X500_DN', '6ba7b814-9dad-11d1-80b4-00c04fd430c8');
 
function uuid_valid($uuid) {
$uuid = str_replace(array('-', '{', '}'), '', $uuid);
$uuid = strtoupper($uuid);
 
if (strlen($uuid) != 32) return false;
 
$uuid = preg_replace('@[0-9A-F]@', '', $uuid);
 
return ($uuid == '');
}
 
# TODO: Don't echo
function uuid_info($uuid) {
if (!uuid_valid($uuid)) return false;
 
# $uuid = str_replace(array('-', '{', '}'), '', $uuid);
$uuid = strtoupper($uuid);
$uuid = preg_replace('@[^0-9A-F]@', '', $uuid);
 
$x = hexdec(substr($uuid, 16, 1));
if ($x >= 14 /* 1110 */) $variant = 3;
else if ($x >= 12 /* 1100 */) $variant = 2;
else if ($x >= 8 /* 1000 */) $variant = 1;
else if ($x >= 0 /* 0000 */) $variant = 0;
 
 
switch ($variant) {
case 0:
echo sprintf("%-24s %s\n", "Variant:", "[0xx] NCS (reserved for backward compatibility)");
 
/*
* Internal structure of variant #0 UUIDs
*
* The first 6 octets are the number of 4 usec units of time that have
* passed since 1/1/80 0000 GMT. The next 2 octets are reserved for
* future use. The next octet is an address family. The next 7 octets
* are a host ID in the form allowed by the specified address family.
*
* Note that while the family field (octet 8) was originally conceived
* of as being able to hold values in the range [0..255], only [0..13]
* were ever used. Thus, the 2 MSB of this field are always 0 and are
* used to distinguish old and current UUID forms.
*
* +--------------------------------------------------------------+
* | high 32 bits of time | 0-3 .time_high
* +-------------------------------+-------------------------------
* | low 16 bits of time | 4-5 .time_low
* +-------+-----------------------+
* | reserved | 6-7 .reserved
* +---------------+---------------+
* | family | 8 .family
* +---------------+----------...-----+
* | node ID | 9-16 .node
* +--------------------------...-----+
*
*/
 
// Example of an UUID: 333a2276-0000-0000-0d00-00809c000000
 
# TODO: See https://github.com/cjsv/uuid/blob/master/Doc
 
# Timestamp: Count of 4us intervals since 01 Jan 1980 00:00:00 GMT
# 1/0,000004 = 250000
# Seconds between 1970 and 1980 : 315532800
# 250000*315532800=78883200000000
$timestamp = substr($uuid, 0, 12);
$ts = gmp_init($timestamp, 16);
$ts = gmp_add($ts, gmp_init("78883200000000"));
$ms = gmp_mod($ts, gmp_init("250000"));
$ts = gmp_div($ts, gmp_init("250000"));
$ts = gmp_strval($ts);
$ms = gmp_strval($ms);
$ts = gmdate('Y-m-d H:i:s', $ts)."'".str_pad($ms, 7, '0', STR_PAD_LEFT).' GMT';
echo sprintf("%-24s %s\n", "Timestamp:", "[0x$timestamp] $ts");
 
$reserved = substr($uuid, 12, 4);
echo sprintf("%-24s %s\n", "Reserved:", "0x$reserved");
 
# Family 13 (dds) looks like node is 00 | nnnnnn 000000.
# Family 2 is presumably (ip).
# Not sure if anything else was used.
$family_hex = substr($uuid, 16, 2);
$family_dec = hexdec($family_hex);
if ($family_dec == 2) {
$family_ = 'IP';
} else if ($family_dec == 13) {
$family_ = 'DDS (Data Link)';
} else {
$family_ = "Unknown ($family_dec)"; # There are probably no more families
}
echo sprintf("%-24s %s\n", "Family:", "[0x$family_hex = $family_dec] $family_");
 
$nodeid = substr($uuid, 18, 14);
echo sprintf("%-24s %s\n", "Node ID:", "0x$nodeid");
# TODO: interprete node id (the family specifies it)
 
break;
case 1:
echo sprintf("%-24s %s\n", "Variant:", "[10x] RFC 4122 (Leach-Mealling-Salz)");
 
$version = hexdec(substr($uuid, 12, 1));
switch ($version) {
case 1:
echo sprintf("%-24s %s\n", "Version:", "[1] Time-based with unique random host identifier");
 
# Timestamp: Count of 100ns intervals since 15 Oct 1582 00:00:00
# 1/0,0000001 = 10000000
$timestamp = substr($uuid, 13, 3).substr($uuid, 8, 4).substr($uuid, 0, 8);
$ts = gmp_init($timestamp, 16);
$ts = gmp_sub($ts, gmp_init("122192928000000000"));
$ms = gmp_mod($ts, gmp_init("10000000"));
$ts = gmp_div($ts, gmp_init("10000000"));
$ts = gmp_strval($ts);
$ms = gmp_strval($ms);
$ts = gmdate('Y-m-d H:i:s', $ts)."'".str_pad($ms, 7, '0', STR_PAD_LEFT).' GMT';
echo sprintf("%-24s %s\n", "Timestamp:", "[0x$timestamp] $ts");
 
$x = hexdec(substr($uuid, 16, 4));
$dec = $x & 0x3FFF; // The highest 2 bits are used by "variant" (10x)
$hex = substr($uuid, 16, 4);
echo sprintf("%-24s %s\n", "Clock ID:", "[0x$hex] $dec");
 
$x = substr($uuid, 20, 12);
$nodeid = '';
for ($i=0; $i<6; $i++) {
$nodeid .= substr($x, $i*2, 2);
if ($i != 5) $nodeid .= ':';
}
echo sprintf("%-24s %s\n", "Node ID:", "$nodeid");
 
if (function_exists('decode_mac')) {
echo "\nIn case that this Node ID is a MAC address, here is the interpretation of that MAC address:\n";
echo decode_mac($nodeid);
}
 
break;
case 2:
echo sprintf("%-24s %s\n", "Version:", "[2] DCE Security version");
 
# The time_low field (which represents an integer in the range [0, 232-1]) is interpreted as a local-ID; that is, an identifier (within the domain specified by clock_seq_low) meaningful to the local host. In the particular case of a POSIX host, when combined with a POSIX UID or POSIX GID domain in the clock_seq_low field (above), the time_low field represents a POSIX UID or POSIX GID, respectively.
$x = substr($uuid, 0, 8);
echo sprintf("%-24s %s\n", "Local ID:", "0x$x");
 
# The clock_seq_low field (which represents an integer in the range [0, 28-1]) is interpreted as a local domain (as represented by sec_rgy_domain_t; see sec_rgy_domain_t ); that is, an identifier domain meaningful to the local host. (Note that the data type sec_rgy_domain_t can potentially hold values outside the range [0, 28-1]; however, the only values currently registered are in the range [0, 2], so this type mismatch is not significant.) In the particular case of a POSIX host, the value sec_rgy_domain_person is to be interpreted as the "POSIX UID domain", and the value sec_rgy_domain_group is to be interpreted as the "POSIX GID domain".
$x = substr($uuid, 18, 2);
if ($x == '00') $domain_info = 'POSIX: User-ID / Non-POSIX: site-defined';
else if ($x == '01') $domain_info = 'POSIX: Group-ID / Non-POSIX: site-defined';
else $domain_info = 'site-defined';
echo sprintf("%-24s %s\n", "Local Domain:", "0x$x ($domain_info)");
 
# Timestamp: Count of 100ns intervals since 15 Oct 1582 00:00:00
# 1/0,0000001 = 10000000
$timestamp = substr($uuid, 13, 3).substr($uuid, 8, 4).'00000000';
$ts = gmp_init($timestamp, 16);
$ts = gmp_sub($ts, gmp_init("122192928000000000"));
$ms = gmp_mod($ts, gmp_init("10000000"));
$ts = gmp_div($ts, gmp_init("10000000"));
$ts = gmp_strval($ts);
$ms = gmp_strval($ms);
$ts_min = gmdate('Y-m-d H:i:s', $ts)."'".str_pad($ms, 7, '0', STR_PAD_LEFT).' GMT';
 
$timestamp = substr($uuid, 13, 3).substr($uuid, 8, 4).'FFFFFFFF';
$ts = gmp_init($timestamp, 16);
$ts = gmp_sub($ts, gmp_init("122192928000000000"));
$ms = gmp_mod($ts, gmp_init("10000000"));
$ts = gmp_div($ts, gmp_init("10000000"));
$ts = gmp_strval($ts);
$ms = gmp_strval($ms);
$ts_max = gmdate('Y-m-d H:i:s', $ts)."'".str_pad($ms, 7, '0', STR_PAD_LEFT).' GMT';
 
$timestamp = substr($uuid, 13, 3).substr($uuid, 8, 4).'xxxxxxxx';
echo sprintf("%-24s %s\n", "Timestamp:", "[0x$timestamp] $ts_min - $ts_max");
 
$x = hexdec(substr($uuid, 16, 2).'00');
$dec_min = $x & 0x3FFF; // The highest 2 bits are used by "variant" (10x)
$x = hexdec(substr($uuid, 16, 2).'FF');
$dec_max = $x & 0x3FFF; // The highest 2 bits are used by "variant" (10x)
$hex = substr($uuid, 16, 2).'xx';
echo sprintf("%-24s %s\n", "Clock ID:", "[0x$hex] $dec_min - $dec_max");
 
$x = substr($uuid, 20, 12);
$nodeid = '';
for ($i=0; $i<6; $i++) {
$nodeid .= substr($x, $i*2, 2);
if ($i != 5) $nodeid .= ':';
}
echo sprintf("%-24s %s\n", "Node ID:", "$nodeid");
 
if (function_exists('decode_mac')) {
echo "\nIn case that this Node ID is a MAC address, here is the interpretation of that MAC address:\n";
echo decode_mac($nodeid);
}
 
break;
case 3:
echo sprintf("%-24s %s\n", "Version:", "[3] Name-based (MD5 hash)");
 
$hash = str_replace('-', '', strtolower($uuid));
$hash[12] = '?'; // was overwritten by version
$hash[16] = '?'; // was partially overwritten by variant
 
echo sprintf("%-24s %s\n", "MD5(Namespace+Subject):", "$hash");
 
break;
case 4:
echo sprintf("%-24s %s\n", "Version:", "[4] Random");
 
$rand = '';
for ($i=0; $i<16; $i++) {
$bin = base_convert(substr($uuid, $i*2, 2), 16, 2);
$bin = str_pad($bin, 8, "0", STR_PAD_LEFT);
 
if ($i == 6) {
$bin[0] = 'x';
$bin[1] = 'x';
} else if ($i == 8) {
$bin[0] = 'x';
$bin[1] = 'x';
$bin[2] = 'x';
$bin[3] = 'x';
}
 
$rand .= "$bin ";
}
 
echo sprintf("%-24s %s\n", "Random bits:", trim($rand));
 
break;
case 5:
echo sprintf("%-24s %s\n", "Version:", "[5] Name-based (SHA-1 hash)");
 
$hash = str_replace('-', '', strtolower($uuid));
$hash[12] = '?'; // was overwritten by version
$hash[16] = '?'; // was partially overwritten by variant
$hash .= '????????'; // was cut off
 
echo sprintf("%-24s %s\n", "SHA1(Namespace+Subject):", "$hash");
 
 
break;
default:
echo sprintf("%-24s %s\n", "Version:", "[$version] Unknown");
break;
}
 
break;
case 2:
echo sprintf("%-24s %s\n", "Variant:", "[110] Reserved for Microsoft Corporation");
break;
case 3:
echo sprintf("%-24s %s\n", "Variant:", "[111] Reserved for future use");
break;
}
}
 
function uuid_canonize($uuid) {
if (!uuid_valid($uuid)) return false;
return oid_to_uuid(uuid_to_oid($uuid));
}
 
function oid_to_uuid($oid) {
if (!is_uuid_oid($oid)) return false;
 
if ($oid[0] == '.') {
$oid = substr($oid, 1);
}
$ary = explode('.', $oid);
$val = $ary[2];
 
$x = gmp_init($val, 10);
$y = gmp_strval($x, 16);
$y = str_pad($y, 32, "0", STR_PAD_LEFT);
return substr($y, 0, 8).'-'.
substr($y, 8, 4).'-'.
substr($y, 12, 4).'-'.
substr($y, 16, 4).'-'.
substr($y, 20, 12);
}
 
function is_uuid_oid($oid, $only_allow_root=false) {
if ($oid[0] == '.') $oid = substr($oid, 1); // remove leading dot
 
$ary = explode('.', $oid);
 
if ($only_allow_root) {
if (count($ary) != 3) return false;
}
 
if ($ary[0] != '2') return false;
if ($ary[1] != '25') return false;
for ($i=2; $i<count($ary); $i++) {
$v = $ary[$i];
if (!is_numeric($v)) return false;
if ($i == 2) {
// Must be in the range of 128 bit UUID
$test = gmp_init($v, 10);
if (strlen(gmp_strval($test, 16)) > 32) return false;
}
if ($v < 0) return false;
}
 
return true;
}
 
function uuid_to_oid($uuid) {
if (!uuid_valid($uuid)) return false;
 
$uuid = str_replace(array('-', '{', '}'), '', $uuid);
$x = gmp_init($uuid, 16);
return '2.25.'.gmp_strval($x, 10); # TODO: parameter with or without leading dot
}
 
function gen_uuid($prefer_timebased = true) {
if ($prefer_timebased) $uuid = gen_uuid_timebased();
if ($uuid === false) $uuid = gen_uuid_random();
return $uuid;
}
 
// Version 1 (Time based) UUID
function gen_uuid_timebased() {
# On Debian: aptitude install php-uuid
# extension_loaded('uuid')
if (function_exists('uuid_create')) {
# OSSP uuid extension like seen in php5-uuid at Debian 8
/*
$x = uuid_create($context);
uuid_make($context, UUID_MAKE_V1);
uuid_export($context, UUID_FMT_STR, $uuid);
return trim($uuid);
*/
 
# PECL uuid extension like seen in php-uuid at Debian 9
return trim(uuid_create(UUID_TYPE_TIME));
}
 
# On Debian: aptitude install uuid-runtime
$out = array();
exec('uuidgen -t', $out, $ec);
if ($ec == 0) return $out[0];
 
# TODO: Implement the time based generation routine ourselves!
# At the moment we cannot determine the time based UUID
return false;
}
 
// Version 2 (DCE Security) UUID
function gen_uuid_dce($domain, $id) {
# Start with a version 1 UUID
$uuid = gen_uuid_timebased();
 
# Add ID
$uuid = str_pad(dechex($id), 8, '0', STR_PAD_LEFT) . substr($uuid, 8);
 
# Add domain
$uuid = substr($uuid,0,21) . str_pad(dechex($domain), 2, '0', STR_PAD_LEFT) . substr($uuid, 23);
 
# Change version to 2
$uuid[14] = '2';
 
return $uuid;
}
 
// Version 3 (MD5 name based) UUID
function gen_uuid_md5_namebased($namespace_uuid, $name) {
if (!uuid_valid($namespace_uuid)) return false;
$namespace_uuid = uuid_canonize($namespace_uuid);
$namespace_uuid = str_replace('-', '', $namespace_uuid);
$namespace_uuid = hex2bin($namespace_uuid);
 
$hash = md5($namespace_uuid.$name);
$hash[12] = '3'; // Set version: 3 = MD5
$hash[16] = dechex(hexdec($hash[16]) & 0x3 | 0x8); // Set variant to "10xx" (RFC4122)
 
return substr($hash, 0, 8).'-'.
substr($hash, 8, 4).'-'.
substr($hash, 12, 4).'-'.
substr($hash, 16, 4).'-'.
substr($hash, 20, 12);
}
 
// Version 4 (Random) UUID
function gen_uuid_random() {
# On Debian: aptitude install php-uuid
# extension_loaded('uuid')
if (function_exists('uuid_create')) {
# OSSP uuid extension like seen in php5-uuid at Debian 8
/*
$x = uuid_create($context);
uuid_make($context, UUID_MAKE_V4);
uuid_export($context, UUID_FMT_STR, $uuid);
return trim($uuid);
*/
 
# PECL uuid extension like seen in php-uuid at Debian 9
return trim(uuid_create(UUID_TYPE_RANDOM));
}
 
# On Debian: aptitude install uuid-runtime
$out = array();
exec('uuidgen -r', $out, $ec);
if ($ec == 0) return $out[0];
 
# On Debian Jessie: UUID V4 (Random)
if (file_exists('/proc/sys/kernel/random/uuid')) {
return file_get_contents('/proc/sys/kernel/random/uuid');
}
 
# Make the UUID by ourselves
# Source: http://rogerstringer.com/2013/11/15/generate-uuids-php
return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0x4000,
mt_rand( 0, 0x3fff ) | 0x8000,
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
);
}
 
// Version 5 (SHA1 name based) UUID
function gen_uuid_sha1_namebased($namespace_uuid, $name) {
$namespace_uuid = str_replace('-', '', $namespace_uuid);
$namespace_uuid = hex2bin($namespace_uuid);
 
$hash = sha1($namespace_uuid.$name);
$hash[12] = '5'; // Set version: 5 = SHA1
$hash[16] = dechex(hexdec($hash[16]) & 0x3 | 0x8); // Set variant to "10xx" (RFC4122)
 
return substr($hash, 0, 8).'-'.
substr($hash, 8, 4).'-'.
substr($hash, 12, 4).'-'.
substr($hash, 16, 4).'-'.
substr($hash, 20, 12);
}
 
function uuid_numeric_value($uuid) {
$oid = uuid_to_oid($uuid);
if (!$oid) return false;
return substr($oid, strlen('2.25.'));
}
 
function uuid_c_syntax($uuid) {
$uuid = str_replace('{', '', $uuid);
return '{ 0x' . substr($uuid, 0, 8) .
', 0x' . substr($uuid, 9, 4) .
', 0x' . substr($uuid, 14, 4) .
', { 0x' . substr($uuid, 19, 2).
', 0x' . substr($uuid, 21, 2) .
', 0x' . substr($uuid, 24, 2) .
', 0x' . substr($uuid, 26, 2) .
', 0x' . substr($uuid, 28, 2) .
', 0x' . substr($uuid, 30, 2) .
', 0x' . substr($uuid, 32, 2) .
', 0x' . substr($uuid, 34, 2) . ' } }';
}
 
# ---
 
// http://php.net/manual/de/function.hex2bin.php#113057
if ( !function_exists( 'hex2bin' ) ) {
function hex2bin( $str ) {
$sbin = "";
$len = strlen( $str );
for ( $i = 0; $i < $len; $i += 2 ) {
$sbin .= pack( "H*", substr( $str, $i, 2 ) );
}
 
return $sbin;
}
}
/trunk_oldversion/includes/xml_utils.inc.php
0,0 → 1,190
<?php
 
/*
* XML Encoding Utilities
* Copyright 2011-2019 Daniel Marschall, ViaThinkSoft
* Version 1.7
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
 
// http://www.viathinksoft.de/?page=codelib&showid=89
 
// Unicode-proof htmlentities.
// Returns 'normal' chars as chars and weirdos as numeric html entites.
// Source: http://www.php.net/manual/en/function.htmlentities.php#107985 ; modified
// Modified by Daniel Marschall, ViaThinkSoft
function htmlentities_numeric($str, $allow_html=false, $encode_linebreaks=false) {
// Convert $str to UTF-8 if it is not already
if (mb_detect_encoding($str, "auto", true) != 'UTF-8') {
# $str = mb_convert_encoding($str, 'UTF-8', 'Windows-1252');
# $str = mb_convert_encoding($str, 'UTF-8', 'auto');
$str = mb_convert_encoding($str, 'UTF-8');
}
 
// get rid of existing entities else double-escape
// DM 24.08.2016 Auskommentiert wegen oid+ xml export
// $str = html_entity_decode(stripslashes($str),ENT_QUOTES,'UTF-8');
 
$ar = preg_split('/(?<!^)(?!$)/u', $str); // return array of every multi-byte character
$str2 = '';
foreach ($ar as $c) {
$o = ord($c);
if (
(strlen($c) > 1) || /* multi-byte [unicode] */
($o < 32 || $o > 126) || /* <- control / latin weirdos -> */
($o > 33 && $o < 40) || /* quotes + ampersand */
($o > 59 && $o < 63) /* html */
) {
// convert to numeric entity
$c = mb_encode_numericentity($c, array(0x0, 0xffff, 0, 0xffff), 'UTF-8');
 
if ($allow_html) {
if ($c == '&#60;') $c = '<';
if ($c == '&#62;') $c = '>';
if ($c == '&#61;') $c = '=';
if ($c == '&#34;') $c = '"';
if ($c == '&#39;') $c = '\'';
if ($c == '&#38;') $c = '&'; // DM 24.08.2016 Re-Aktiviert wegen oid+ xml export
}
 
if (!$encode_linebreaks) {
if ($allow_html) {
if ($c == "&#10;") $c = "<br />";
if ($c == "&#13;") $c = "<br />";
} else {
if ($c == "&#10;") $c = "\n";
if ($c == "&#13;") $c = "\r";
}
}
}
$str2 .= $c;
}
return $str2;
}
 
function ordUTF8($c, $index = 0, &$bytes = null) {
// http://de.php.net/manual/en/function.ord.php#78032
 
$len = strlen($c);
$bytes = 0;
 
if ($index >= $len) {
return false;
}
 
$h = ord($c{$index});
 
if ($h <= 0x7F) {
$bytes = 1;
return $h;
} else if ($h < 0xC2) {
return false;
} else if ($h <= 0xDF && $index < $len - 1) {
$bytes = 2;
return ($h & 0x1F) << 6 | (ord($c{$index + 1}) & 0x3F);
} else if ($h <= 0xEF && $index < $len - 2) {
$bytes = 3;
return ($h & 0x0F) << 12 | (ord($c{$index + 1}) & 0x3F) << 6
| (ord($c{$index + 2}) & 0x3F);
} else if ($h <= 0xF4 && $index < $len - 3) {
$bytes = 4;
return ($h & 0x0F) << 18 | (ord($c{$index + 1}) & 0x3F) << 12
| (ord($c{$index + 2}) & 0x3F) << 6
| (ord($c{$index + 3}) & 0x3F);
} else {
return false;
}
}
 
function utf16_to_utf8($str) {
// http://betamode.de/2008/09/08/php-utf-16-zu-utf-8-konvertieren/
// http://www.moddular.org/log/utf16-to-utf8
 
$c0 = ord($str[0]);
$c1 = ord($str[1]);
if ($c0 == 0xFE && $c1 == 0xFF) {
$be = true;
} else if ($c0 == 0xFF && $c1 == 0xFE) {
$be = false;
} else {
return $str;
}
$str = substr($str, 2);
$len = strlen($str);
$dec = '';
for ($i = 0; $i < $len; $i += 2) {
$c = ($be) ? ord($str[$i]) << 8 | ord($str[$i + 1]) :
ord($str[$i + 1]) << 8 | ord($str[$i]);
if ($c >= 0x0001 && $c <= 0x007F) {
$dec .= chr($c);
} else if ($c > 0x07FF) {
$dec .= chr(0xE0 | (($c >> 12) & 0x0F));
$dec .= chr(0x80 | (($c >> 6) & 0x3F));
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
} else {
$dec .= chr(0xC0 | (($c >> 6) & 0x1F));
$dec .= chr(0x80 | (($c >> 0) & 0x3F));
}
}
return $dec;
}
 
function html_named_to_numeric_entities($str) {
if (!function_exists('decodeNamedEntities')) {
function decodeNamedEntities($string) {
// https://stackoverflow.com/questions/20406599/how-to-encode-for-entity-igrave-not-defined-error-in-xml-feed
static $entities = NULL;
if (NULL === $entities) {
$entities = array_flip(
array_diff(
get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_HTML401, 'UTF-8'),
get_html_translation_table(HTML_ENTITIES, ENT_COMPAT | ENT_XML1, 'UTF-8')
)
);
}
return str_replace(array_keys($entities), $entities, $string);
}
}
 
if (!function_exists('mb_convert_encoding')) {
// https://riptutorial.com/php/example/15633/converting-unicode-characters-to-their-numeric-value-and-or-html-entities-using-php
function mb_convert_encoding($str, $to_encoding, $from_encoding = NULL) {
return iconv(($from_encoding === NULL) ? mb_internal_encoding() : $from_encoding, $to_encoding, $str);
}
}
 
if (!function_exists('mb_ord')) {
// https://riptutorial.com/php/example/15633/converting-unicode-characters-to-their-numeric-value-and-or-html-entities-using-php
function mb_ord($char, $encoding = 'UTF-8') {
if ($encoding === 'UCS-4BE') {
list(, $ord) = (strlen($char) === 4) ? @unpack('N', $char) : @unpack('n', $char);
return $ord;
} else {
return mb_ord(mb_convert_encoding($char, 'UCS-4BE', $encoding), 'UCS-4BE');
}
}
}
 
if (!function_exists('mb_htmlentities')) {
// https://riptutorial.com/php/example/15633/converting-unicode-characters-to-their-numeric-value-and-or-html-entities-using-php
function mb_htmlentities($string, $hex = true, $encoding = 'UTF-8') {
return preg_replace_callback('/[\x{80}-\x{10FFFF}]/u', function ($match) use ($hex) {
return sprintf($hex ? '&#x%X;' : '&#%d;', mb_ord($match[0]));
}, $string);
}
}
 
if (!mb_detect_encoding($str, 'UTF-8', true)) $str = utf8_encode($str);
return mb_htmlentities(decodeNamedEntities($str));
}
/trunk_oldversion/index.php
0,0 → 1,292
<?php
 
include_once __DIR__ . '/includes/oid_plus.inc.php';
include_once __DIR__ . '/includes/oid_utils.inc.php';
include_once __DIR__ . '/includes/config.inc.php';
include_once __DIR__ . '/includes/gui.inc.php';
 
define('START_PAGE', 'welcome');
 
$db = new OIDPlus(__DIR__ . '/db/local.conf', true);
 
// The inclusion of get_current_user() solves a Problem with suPHP, when multiple users run different instances of OID+ with the same SystemID
session_name('OIDPLUS_SESS_'.sha1(strtolower($db->getSystemID()).get_current_user()));
session_start();
 
$title = $db->getConfigValue('webinterface_title');
if ($title === false) $title = 'OID+ web interface';
 
$systemID = $db->getConfigValue('system_unique_id');
 
try {
$db->addDir(__DIR__ . '/db');
echo page_header($title, $systemID); // TODO: dynamischer titel, z.B. die aktuell angezeigte OID
} catch (VolcanoException $e) {
echo showException($e);
exit;
}
 
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : START_PAGE;
$query = isset($_REQUEST['query']) ? $_REQUEST['query'] : '';
 
# ---
 
if (isset($_REQUEST['new_auth_token'])) {
if (!isset($_SESSION['auth_tokens'])) {
$_SESSION['auth_tokens'] = array();
}
if (!in_array($_REQUEST['new_auth_token'], $_SESSION['auth_tokens'])) {
$_SESSION['auth_tokens'][] = $_REQUEST['new_auth_token'];
}
} else if (isset($_REQUEST['delete_all_auth_tokens'])) {
unset($_SESSION['auth_tokens']);
}
 
if (isset($_SESSION['auth_tokens'])) {
$auth_tokens = ' #'.implode(',',$_SESSION['auth_tokens']);
} else {
$auth_tokens = '';
}
 
$auth_token_count = (isset($_SESSION['auth_tokens'])) ? count($_SESSION['auth_tokens']) : 0;
 
# TODO: auth tokens schreiben bei allen "executed query" usw?
 
# ---
 
echo '<form action="index.php" method="get">';
echo '<table border="0" cellpadding="5" cellspacing="0" width="100%" id="headertable">';
 
echo '<tr>';
echo '<td colspan="2" align="center">';
echo '<h1>'.htmlentities($title).'</h1>';
echo '</td>';
echo '</tr>';
 
echo '<tr>';
echo '<td>';
if ($action != 'welcome') echo '<a href="?action=welcome">'; else echo '<b>';
echo 'Welcome';
if ($action != 'welcome') echo '</a>'; else echo '</b>';
echo ' | ';
 
if ($action != 'roots') echo '<a href="?action=roots">'; else echo '<b>';
echo 'Roots';
if ($action != 'roots') echo '</a>'; else echo '</b>';
echo ' (' . $db->count_roots() . ')';
echo ' | ';
 
if ($action != 'indexes') echo '<a href="?action=indexes">'; else echo '<b>';
echo 'Indexes';
if ($action != 'indexes') echo '</a>'; else echo '</b>';
echo ' (' . $db->count_indexes() . ')';
echo ' | ';
 
if ($action != 'list_all') echo '<a href="?action=list_all">'; else echo '<b>';
echo 'List all';
if ($action != 'list_all') echo '</a>'; else echo '</b>';
echo ' (' . $db->count_oids() . ')';
echo ' | ';
 
if ($action != 'auth_tokens') echo '<a href="?action=auth_tokens">'; else echo '<b>';
echo 'Auth tokens';
if ($action != 'auth_tokens') echo '</a>'; else echo '</b>';
echo ' ('.$auth_token_count.')';
echo '</td>';
echo '<td align="right">';
echo '<input type="hidden" name="action" value="query" />';
 
if ($action == 'roots') {
$query = 'oidplus:!listRoots';
} else if ($action == 'indexes') {
$query = 'oidplus:!listIndexes';
} else if ($action == 'list_all') {
$query = 'oidplus:!list';
} else if ($action == 'help') {
$query = 'help';
} else if ($action == 'show_oid') {
if (isset($_REQUEST['oid'])) {
$query = 'oidplus:'.$_REQUEST['oid'];
} else {
die('</td></tr></table><h2>Invalid request</h2><p>Paramter "oid" is missing</p>'.page_footer());
}
} else if ($action == 'show_index') {
if ($_REQUEST['index']) {
if (isset($_REQUEST['ns'])) {
$query = $_REQUEST['ns'].':'.$_REQUEST['index'];
} else {
$query = 'oidplus:'.$_REQUEST['index'];
}
} else {
die('</td></tr></table><h2>Invalid request</h2><p>Paramter "index" is missing</p>'.page_footer());
}
}
 
echo 'Manual query (<a href="?action=help">help</a>): <input size="50" type="text" name="query" value="'.htmlentities($query).'" />'."\n";
echo '<input type="submit" value="OK" />';
echo '</td>';
echo '</tr>';
echo '</table>';
echo '</form>';
 
# ---
 
try {
# TODO: codeduplikate vermeiden
if ($action == 'welcome') {
# TODO
include 'welcome.php';
} else if ($action == 'uuid_info') {
$uuid = $_REQUEST['uuid'];
 
if (!preg_match('@^([A-Fa-f0-9]{8}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{4}\\-[A-Fa-f0-9]{12})$@', $uuid, $m)) {
echo "\n\n<h2>Information about an UUID</h2>\n\n";
 
echo '<p><font color="red">';
echo 'Error: '.htmlentities($uuid).' is not a valid UUID.';
echo '</font></p>';
} else {
echo "\n\n<h2>Information about UUID $uuid</h2>\n\n";
 
$url = 'https://misc.daniel-marschall.de/tools/uuid_mac_decoder/interprete_uuid.php?uuid='.$uuid;
 
echo '<p class="green">Querying <a href="'.$url.'" target="_blank">'.htmlentities($url).'</a></p>';
 
$c = @file_get_contents($url);
 
if (preg_match('@<pre>(.*)</pre>@ismU', $c, $m)) {
echo showHTML($m[1], $db);
} else {
echo '<p><font color="red">';
echo 'Error while parsing <a href="'.$url.'" target="_blank">'.htmlentities($url).'</a>';
echo '</font></p>';
}
}
 
$query = '.'.uuid_to_oid($uuid);
if ($db->oidDescribed($query)) {
echo "\n\n<h2>Information about UUID OID ".htmlentities($query)."</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
}
 
# Alle OIDs durchgehen und schauen, ob namebased irgendwo passt
$x = $db->listAllOIDs('.');
foreach ($x as $oid) {
$query = $oid;
if (gen_uuid_md5_namebased(UUID_NAMEBASED_NS_OID, $oid) == $uuid) {
echo "\n\n<h2>Information about ".htmlentities($query)." (MD5 namebased UUID)</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
}
if (gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OID, $oid) == $uuid) {
echo "\n\n<h2>Information about ".htmlentities($query)." (SHA1 namebased UUID)</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
}
}
} else if ($action == 'roots') {
echo "\n\n<h2>Roots</h2>\n\n";
echo queryInfo($query);
$r = $db->findRoots();
foreach ($r as $root) {
echo "\n\n<h2>Root $root</h2>\n\n";
echo queryInfo("oidplus:$root");
ob_start();
$db->query('oidplus:'.$root.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
}
} else if ($action == 'indexes') {
echo "\n\n<h2>Indexes</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'list_all') {
echo "\n\n<h2>List all</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'help') {
echo "\n\n<h2>Help</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'show_oid') {
echo "\n\n<h2>OID ".htmlentities($_REQUEST['oid'])."</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'show_index') {
echo "\n\n<h2>Index ".htmlentities($_REQUEST['index'])."</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'query') {
echo "\n\n<h2>Query ".htmlentities($query)."</h2>\n\n";
echo queryInfo($query);
ob_start();
$db->query($query.$auth_tokens);
$cont = ob_get_contents();
ob_end_clean();
echo showHTML($cont, $db);
} else if ($action == 'auth_tokens') {
echo "\n\n<h2>Auth tokens</h2>\n\n";
 
echo '<form action="index.php" method="get">';
echo '<input type="hidden" name="action" value="'.htmlentities($action).'" />';
 
if ($auth_token_count == 0) {
echo "<p>No auth tokens have been added.</p>";
} else {
echo "<p><font color=\"red\">Registered auth tokens: $auth_token_count</font></p>";
}
 
echo '<p>Add new auth token: <input type="password" name="new_auth_token" value="" />'."\n";
echo '<input type="submit" value="Add"></p>';
 
echo '<p><a href="?action='.htmlentities($action).'&amp;delete_all_auth_tokens=1">Delete all tokens</a></p>';
 
echo '</form>';
} else {
echo '<p><font color="red">';
echo 'Unknown command "'.htmlentities($action).'"';
echo '</font></p>';
}
} catch (VolcanoException $e) {
echo showException($e);
exit;
}
 
# ---
 
session_write_close();
echo page_footer();
/trunk_oldversion/interface/dump/index.php
0,0 → 1,24
<?php
 
set_time_limit(0);
 
include_once __DIR__ . '/../../includes/oid_plus.inc.php';
include_once __DIR__ . '/../../includes/oid_utils.inc.php';
include_once __DIR__ . '/../../includes/config.inc.php';
include_once __DIR__ . '/../../includes/gui.inc.php';
 
# TODO: HTML header etc
 
$db = new OIDPlus(__DIR__ . '/../../db/local.conf', true);
$db->addDir(__DIR__ . '/../../db');
 
$x = $db->listAllOIDs('.');
foreach ($x as $oid) {
$query = $oid;
if (!$db->oidDescribed($query)) continue;
 
echo "<h2>$oid</h2>";
$cont = $db->showSingleOID($oid, '', OIDPlus::SEG_OIDDATA, false);
$cont = $db->filterRedactedEntries($cont);
showHTML($cont, $db, false);
}
/trunk_oldversion/interface/oidinfo/index.php
0,0 → 1,322
<?php
 
include_once __DIR__ . '/../../includes/config.inc.php';
 
if (!OIDINFO_EXPORT_ENABLED) {
die('Export disabled via switch OIDINFO_EXPORT_ENABLED.');
}
 
header("Content-type: text/xml");
 
set_time_limit(0);
 
include_once __DIR__ . '/../../includes/oid_plus.inc.php';
include_once __DIR__ . '/../../includes/oid_utils.inc.php';
include_once __DIR__ . '/../../includes/gui.inc.php';
include_once __DIR__ . '/../../includes/oidinfo_api.inc.php';
 
# TODO: mehr konfigurierbar...
# TODO ra(1)-person etc.... ra(2) --> regex ?
# URL of OID+ system
# Also add non-desription-fields, e.g. "whois" @freeoid
# exclude GenRoot (aber was ist mit UUID definitions?)
# Check if OID is available at oidinfo
# nach dem rausfiltern soll make_tabs erneut aufgerufen werden...
 
# FreeOID: versuchen, vor und nachname aufzusplitten?
 
$db = new OIDPlus(__DIR__ . '/../../db/local.conf', true);
$db->addDir(__DIR__ . '/../../db');
$x = $db->listAllOIDs('.');
 
$oa = new OIDInfoAPI();
 
if (defined('OIDINFO_EXPORT_SIMPLEPINGPROVIDER')) {
$oa->addSimplePingProvider(OIDINFO_EXPORT_SIMPLEPINGPROVIDER);
}
 
 
echo $oa->xmlAddHeader(OIDINFO_EXPORT_SUBMITTER_FIRST_NAME,
OIDINFO_EXPORT_SUBMITTER_LAST_NAME,
OIDINFO_EXPORT_SUBMITTER_EMAIL);
 
$params['allow_html'] = true; // TODO: allow_whitespaces !
$params['allow_illegal_email'] = true;
$params['soft_correct_behavior'] = OIDInfoAPI::SOFT_CORRECT_BEHAVIOR_NONE;
$params['do_online_check'] = false; // true;
$params['do_illegality_check'] = true;
$params['do_csv_check'] = true;
$params['auto_extract_name'] = '';
$params['auto_extract_url'] = '';
$params['always_output_comment'] = false;
$params['creation_allowed_check'] = defined('OIDINFO_EXPORT_SIMPLEPINGPROVIDER');
 
foreach ($x as $oid) {
$filtered = array();
 
$std_oid = substr($oid, 1);
 
if (!$db->oidDescribed($oid)) continue;
 
$cont = $db->showSingleOID($oid, '', OIDPlus::SEG_OIDDATA, true /*false*/);
$cont = $db->filterRedactedEntries($cont);
 
$ra_person_name = _filter($cont, 'ra(1)-person-name', false, false);
$ra_org_name = _filter($cont, 'ra(1)-name', false, false);
$pre_addr = '';
if ($ra_person_name != '') {
$xry = explode(' ', $ra_person_name, 2);
$prename = $xry[0];
$famname = $xry[1];
$pre_addr = $ra_org_name;
} else {
$prename = $ra_org_name;
$famname = '';
$pre_addr = '';
}
 
/*
$a_fto_curra_name = array();
_add($a_fto_curra_name, _filter($cont, 'ra(1)-name', false, false));
_add($a_fto_curra_name, _filter($cont, 'ra(1)-person-name', false, false));
$fto_curra_name = implode(' / ', $a_fto_curra_name);
*/
 
# naja... mit dem neuen code sieht das aus, als ob die VTS RA in MEINER adresse wäre...
 
$a_fto_curra_address_p = array();
_add($a_fto_curra_address_p, _filter($cont, 'ra(1)-person-org', false, false));
_add($a_fto_curra_address_p, _filter($cont, 'ra(1)-person-organisation', false, false));
_add($a_fto_curra_address_p, _filter($cont, 'ra(1)-person-address', false, false));
_add($a_fto_curra_address_p, _country(_filter($cont, 'ra(1)-person-country', false, false)));
$a_fto_curra_address_o = array();
_add($a_fto_curra_address_o, _filter($cont, 'ra(1)-org', false, false));
_add($a_fto_curra_address_o, _filter($cont, 'ra(1)-organisation', false, false));
_add($a_fto_curra_address_o, _filter($cont, 'ra(1)-address', false, false));
_add($a_fto_curra_address_o, _country(_filter($cont, 'ra(1)-country', false, false)));
if (implode("\n", $a_fto_curra_address_o) != '') {
$fto_curra_address = implode("\n", $a_fto_curra_address_o);
} else {
$fto_curra_address = implode("\n", $a_fto_curra_address_p);
}
if ($pre_addr != '') $fto_curra_address = $pre_addr."\n".$fto_curra_address;
$fto_curra_address = _formatHTML($fto_curra_address, false);
 
$fto_curra_email_p = _filter($cont, 'ra(1)-person-email', false, false);
$fto_curra_email_o = _filter($cont, 'ra(1)-email', false, false);
if ($fto_curra_email_o != '') {
$fto_curra_email = $fto_curra_email_o;
} else {
$fto_curra_email = $fto_curra_email_p;
}
 
$fto_curra_phone_p = _filter($cont, 'ra(1)-person-phone', false, false);
$fto_curra_phone_o = _filter($cont, 'ra(1)-phone', false, false);
if ($fto_curra_phone_o != '') {
$fto_curra_phone = $fto_curra_phone_o;
} else {
$fto_curra_phone = $fto_curra_phone_p;
}
 
$fto_curra_fax_p = _filter($cont, 'ra(1)-person-fax', false, false);
$fto_curra_fax_o = _filter($cont, 'ra(1)-fax', false, false);
if ($fto_curra_fax_o != '') {
$fto_curra_fax = $fto_curra_fax_o;
} else {
$fto_curra_fax = $fto_curra_fax_p;
}
 
$att_changed = _filter($cont, 'modified', false, false);
if ($att_changed == '') $att_changed = _filter($cont, 'changed', false, false);
$att_changed = _findDate($att_changed);
if ($att_changed == '0000-00-00') $att_changed = '';
 
$att_created = _filter($cont, 'created', false, false);
if ($att_created == '') $att_created = _filter($cont, 'assigned', false, false);
if ($att_created == '') $att_created = _filter($cont, 'allocated', false, false);
$att_created = _findDate($att_created);
if ($att_created == '0000-00-00') $att_created = '';
 
$att_asn1_id = explode("\n", trim(_filter($cont, 'identifier', false, false)));
 
$att_description = _filter($cont, 'description', false, false);
$att_information = _filter($cont, 'information', false, false) . "\n\n" . _filter($cont, 'comment', false, false);
$att_name = _filter($cont, 'name', false, false);
if (!empty($att_name)) {
$fto_desc = $att_name;
$fto_info = $att_description."\n\n".$att_information;
} else {
$fto_desc = $att_description;
$fto_info = $att_information;
}
 
$xry = explode('. ', $fto_desc, 2);
if (count($xry) > 1) {
$fto_desc = $xry[0];
$fto_info = (($xry[1] == '') ? $xry[1]."\n\n" : '').$fto_info;
}
 
if (($fto_desc == '') && isset($att_asn1_id[0])) {
$fto_desc = $att_asn1_id[0];
}
 
 
 
$rawdata = array();
 
$ary = explode("\n", $cont);
foreach ($ary as $a) {
$bry = explode(":", $a);
$b = trim($bry[0]);
 
if (($b == 'attribute') && (isset($bry[1]))) {
$val = strtoupper(trim($bry[1]));
if ($val == 'DRAFT') continue 2; // do not export this OID at all
if ($val == 'NOEXPORT') continue 2; // do not export this OID at all
}
 
if (isset($filtered[$b])) continue;
if (substr($b, 0, 3) == 'ra(') continue;
 
if ($b == 'index(uuid)') $a = 'UUID: '.trim($bry[1]);
if ($b == 'index(doi)') $a = 'DOI: '.trim($bry[1]);
if ($b == 'index(ipv4)') $a = 'IPv4: '.trim($bry[1]);
if ($b == 'index(ipv6)') $a = 'IPv6: '.trim($bry[1]);
if ($b == 'index(domain)') $a = 'Domain: '.trim($bry[1]);
if ($b == 'unicodelabel') $a = 'Unicode label (IRI): '.trim($bry[1]);
if ($b == 'attribute') $a = 'Attribute: '.ucfirst(trim($bry[1]));
 
$a = ucfirst($a);
 
$rawdata[] = $a;
}
$rawdata = implode("\n", $rawdata);
 
$fto_info .= "\n\n$rawdata"; // TODO: test
 
 
 
$fto_info = preg_replace('@^\n+@ism', '', $fto_info);
$fto_desc = preg_replace('@^\n+@ism', '', $fto_desc);
 
$fto_info = preg_replace('@\n+$@ism', '', $fto_info);
$fto_desc = preg_replace('@\n+$@ism', '', $fto_desc);
 
$fto_info = preg_replace('@\n{3,}$@ism', "\n\n", $fto_info);
$fto_desc = preg_replace('@\n{3,}$@ism', "\n\n", $fto_desc);
 
$use_monospace_desc = OIDINFO_EXPORT_SUBMITTER_ONLY_MONOSPACE;
if (!$use_monospace_desc) {
# Try to find evidence of ASCII art
if (strpos($fto_desc, '----') !== false) {
$use_monospace_desc = true;
}
}
 
$use_monospace_info = OIDINFO_EXPORT_SUBMITTER_ONLY_MONOSPACE;
if (!$use_monospace_info) {
# Try to find evidence of ASCII art
if (strpos($fto_info, '----') !== false) {
$use_monospace_info = true;
}
}
 
$fto_desc = _formatHTML($fto_desc, $use_monospace_desc);
$fto_info = _formatHTML($fto_info, $use_monospace_info);
 
# OID-Info does not accept <pre>.
$fto_desc = str_replace('<pre>', '<code>', $fto_desc);
$fto_info = str_replace('<pre>', '<code>', $fto_info);
$fto_desc = str_replace('</pre>', '</code>', $fto_desc);
$fto_info = str_replace('</pre>', '</code>', $fto_info);
 
$elements = array();
 
$elements['synonymous-identifier'] = $att_asn1_id;
$elements['description'] = $fto_desc;
$elements['information'] = $fto_info;
 
$elements['first-registrant']['first-name'] = '';
$elements['first-registrant']['last-name'] = '';
$elements['first-registrant']['address'] = '';
$elements['first-registrant']['email'] = '';
$elements['first-registrant']['phone'] = '';
$elements['first-registrant']['fax'] = '';
$elements['first-registrant']['creation-date'] = '';
if ($att_created != '') {
if ($att_changed == '') { // We only save the current RA, because if the OID was changed, we do not know the old RA
$elements['first-registrant']['first-name'] = $prename;
$elements['first-registrant']['last-name'] = $famname;
$elements['first-registrant']['address'] = $fto_curra_address;
$elements['first-registrant']['email'] = $fto_curra_email;
$elements['first-registrant']['phone'] = $fto_curra_phone;
$elements['first-registrant']['fax'] = $fto_curra_fax;
}
$elements['first-registrant']['creation-date'] = $att_created;
}
 
/*
$elements['current-registrant']['first-name'] = '';
$elements['current-registrant']['last-name'] = '';
$elements['current-registrant']['address'] = '';
$elements['current-registrant']['email'] = '';
$elements['current-registrant']['phone'] = '';
$elements['current-registrant']['fax'] = '';
$elements['current-registrant']['modification-date'] = '';
if ($att_changed != '') {
$elements['current-registrant']['first-name'] = $prename;
$elements['current-registrant']['last-name'] = $famname;
$elements['current-registrant']['address'] = $fto_curra_address;
$elements['current-registrant']['email'] = $fto_curra_email; // TODO: wieso gibt es da ein "<br />\n" , das dann zu "<br /><br />" wird ?
$elements['current-registrant']['phone'] = $fto_curra_phone;
$elements['current-registrant']['fax'] = $fto_curra_fax;
$elements['current-registrant']['modification-date'] = $att_changed;
}
*/
$elements['current-registrant']['first-name'] = $prename;
$elements['current-registrant']['last-name'] = $famname;
$elements['current-registrant']['address'] = $fto_curra_address;
$elements['current-registrant']['email'] = $fto_curra_email; // TODO: wieso gibt es da ein "<br />\n" , das dann zu "<br /><br />" wird ?
$elements['current-registrant']['phone'] = $fto_curra_phone;
$elements['current-registrant']['fax'] = $fto_curra_fax;
if ($att_changed != '') {
$elements['current-registrant']['modification-date'] = $att_changed;
}
 
echo $oa->createXMLEntry($std_oid, $elements, $params);
}
 
echo $oa->xmlAddFooter();
 
# ---
 
function _formatHTML($cont, $monospace) {
global $db;
return showHTML(trim($cont), $db, false, $monospace);
}
 
function _filter($cont, $name, $preg=false, $including_name=true) {
global $filtered;
$filtered[$name] = true;
 
global $db;
$res = $db->filterOutput($cont, $name, $preg, $including_name);
return trim($res);
}
 
function _add(&$a, $c) {
if ($c != '') $a[] = $c;
}
 
function _findDate($x) {
$ary = explode(' ', $x);
foreach ($ary as $v) {
if (preg_match('@\\d{4}-\\d{2}-\\d{2}@', $v)) return $v;
}
return false;
}
 
function _country($country) {
return Locale::getDisplayRegion('-'.$country, 'en');
}
 
/trunk_oldversion/interface/oidinfo/run.sh
0,0 → 1,4
#!/bin/bash
DIR=$( dirname "$0" )
php "$DIR"/index.php > "$DIR"/cache.xml
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+text/x-sh
\ No newline at end of property
/trunk_oldversion/plugins/.htaccess
0,0 → 1,3
Order Deny,Allow
Deny From All
 
/trunk_oldversion/plugins/auth/false.inc.php
0,0 → 1,35
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthFalse implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'false', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
return false;
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthFalse());
 
# --- TEST
 
/*
$x = new VolcanoAuthFalse();
assert(!$x->checkAuth('', ''));
*/
 
/trunk_oldversion/plugins/auth/ip.inc.php
0,0 → 1,44
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../includes/ip_function.inc.php';
require_once __DIR__ . '/../../includes/ipv4_functions.inc.php';
require_once __DIR__ . '/../../includes/ipv6_functions.inc.php';
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthIP implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'ip', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
$ip = get_real_ip();
if (strpos($candidate, ':') !== false) {
return ipv6_in_cidr($candidate, $ip);
} else {
return ipv4_in_cidr($candidate, $ip);
}
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthIP());
 
# --- TEST
 
/*
$x = new VolcanoAuthIP();
assert( $x->checkAuth('217/8', ''));
assert( $x->checkAuth('::1/128', ''));
*/
/trunk_oldversion/plugins/auth/md5.inc.php
0,0 → 1,37
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthMD5 implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'md5', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
return md5($token) === $candidate; // TODO salt
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthMD5());
 
# --- TEST
 
/*
$x = new VolcanoAuthMD5();
assert( $x->checkAuth('d41d8cd98f00b204e9800998ecf8427e', ''));
assert( $x->checkAuth('098f6bcd4621d373cade4e832627b4f6', 'test'));
assert(!$x->checkAuth('987bcab01b929eb2c07877b224215c92', 'xyz'));
*/
 
/trunk_oldversion/plugins/auth/plain.inc.php
0,0 → 1,37
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthPlain implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'plain', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
return $token === $candidate; // TODO case?
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthPlain());
 
# --- TEST
 
/*
$x = new VolcanoAuthPlain();
assert( $x->checkAuth('', ''));
assert( $x->checkAuth('test', 'test'));
assert(!$x->checkAuth('beta', 'xyz'));
*/
 
/trunk_oldversion/plugins/auth/sha1.inc.php
0,0 → 1,37
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthSHA1 implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'sha1', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
return sha1($token) === $candidate; // TODO salt
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthSHA1());
 
# --- TEST
 
/*
$x = new VolcanoAuthSHA1();
assert( $x->checkAuth('da39a3ee5e6b4b0d3255bfef95601890afd80709', ''));
assert( $x->checkAuth('a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 'test'));
assert(!$x->checkAuth('a295e0bdde1938d1fbfd343e5a3e569e868e1465', 'xyz'));
*/
 
/trunk_oldversion/plugins/auth/true.inc.php
0,0 → 1,35
<?php
 
# if (!interface_exists('VolcanoAuthProvider')) throw new Exception('Required interface "VolcanoAuthProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoAuthProvider.class.php';
 
class VolcanoAuthTrue implements VolcanoAuthProvider {
public static function checkId($id) {
return self::strEqual($id, 'true', true); // is always case insensitive
}
 
public static function checkAuth($candidate, $token) {
return true;
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerAuthProvider(new VolcanoAuthTrue());
 
# --- TEST
 
/*
$x = new VolcanoAuthTrue();
assert($x->checkAuth('', ''));
*/
 
/trunk_oldversion/plugins/field_extenders/1_depth.inc.php
0,0 → 1,22
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
 
class OIDDepthFieldExtender implements OIDPlusFieldExtenders {
public static function processOID($oid, &$out, &$oidplusobj) {
$out[] = 'oid-depth:'.self::oid_depth($oid);
}
 
protected static function oid_depth($oid) {
# TODO: in oid_utils hinzufügen
if ($oid == '.') return 0;
if ($oid[0] != '.') $oid = ".$oid";
return substr_count($oid, '.');
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new OIDDepthFieldExtender());
/trunk_oldversion/plugins/field_extenders/2_der.inc.php
0,0 → 1,16
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/OidDerConverter.class.phps';
 
class DEREncodingFieldExtender implements OIDPlusFieldExtenders {
public static function processOID($oid, &$out, &$oidplusobj) {
$out[] = 'der-encoding:'.OidDerConverter::hexarrayToStr(OidDerConverter::oidToDER($oid));
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new DEREncodingFieldExtender());
/trunk_oldversion/plugins/field_extenders/3_uuid.inc.php
0,0 → 1,39
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/uuid_utils.inc.php';
 
class UUIDFieldExtender implements OIDPlusFieldExtenders {
public static function processOID($oid, &$out, &$oidplusobj) {
$r = oid_to_uuid($oid);
 
if ($r === false) {
$uuid_level = 0;
} else {
if (oid_depth($oid) == 2) {
$uuid_level = 1;
} else {
$uuid_level = 2;
}
}
 
# TODO: more configuration values, e.g. to hide namebased UUIDs
 
if (($uuid_level == 0) || ($uuid_level == 2) || ($oidplusobj->getConfigValue('namebased_uuids_for_pure_uuids') == '1')) {
$out[] = 'namebased-uuid-sha1:'.gen_uuid_sha1_namebased(UUID_NAMEBASED_NS_OID, $oid);
$out[] = 'namebased-uuid-md5:'.gen_uuid_md5_namebased(UUID_NAMEBASED_NS_OID, $oid);
}
if ($uuid_level == 1) {
$out[] = 'uuid:'.$r;
}
if ($uuid_level == 2) {
$out[] = 'origin-uuid:'.$r;
}
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new UUIDFieldExtender());
/trunk_oldversion/plugins/field_extenders/4_oidinfo.inc.php
0,0 → 1,73
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/uuid_utils.inc.php';
 
// TODO: use oidinfo api phps
// TODO: output warning if OID is illegal!
 
class OIDInfoFieldExtender implements OIDPlusFieldExtenders {
public static function getURL($oid) {
if ($oid[0] == '.') {
$oid = substr($oid, 1);
}
 
return 'http://www.oid-info.com/get/'.$oid;
}
 
// currently not used
public static function oidMayBeCreated($oid) {
if ($oid[0] == '.') {
$oid = substr($oid, 1);
}
 
# Ping API
$v = @file_get_contents('https://www.viathinksoft.de/~daniel-marschall/oid-repository/ping_oid.php?oid='.$oid);
$v = substr($v, 1, 1);
if (trim($v) === '1') return true;
if (trim($v) === '0') return false;
 
// TODO: exception
return null;
}
 
public static function oidAvailable($oid) {
if ($oid[0] == '.') {
$oid = substr($oid, 1);
}
 
# Ping API
$v = @file_get_contents('https://www.viathinksoft.de/~daniel-marschall/oid-repository/ping_oid.php?oid='.$oid);
$v = substr($v, 0, 1);
if (trim($v) === '2') return true; // existing and approved
if (trim($v) === '1') return false; // not approved
if (trim($v) === '0') return false; // not existing
 
# Fallback
$url = self::getURL($oid);
$responsecode = get_http_response_code($url);
return ($responsecode == 200);
}
 
public static function processOID($oid, &$out, &$oidplusobj) {
if (self::oidAvailable($oid)) {
$url = self::getURL($oid);
$out[] = "cross-ref:$url";
}
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new OIDInfoFieldExtender());
 
# ---
 
# TODO: -> functions.inc.php
function get_http_response_code($theURL) {
# http://php.net/manual/de/function.get-headers.php#97684
$headers = get_headers($theURL);
return substr($headers[0], 9, 3);
}
/trunk_oldversion/plugins/field_extenders/5_asn1_search.inc.php
0,0 → 1,81
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/uuid_utils.inc.php';
 
class ASN1SearchFieldExtender implements OIDPlusFieldExtenders {
private static function detectDirectAsn1Notation($x, &$xx, $oidplusobj) {
# At your root, you can define your own asn1-notation
# FUT: as alternative, we could have "invisible" OIDs (cannot be queried) which give information about non-root OIDs
$asn1path = $oidplusobj->getValuesOf($x, 'asn1-notation', true);
if (count($asn1path) > 0) {
$oidplusobj->stripAttribs($x, 'asn1-notation');
 
$asn1path = trim($asn1path[0]);
if (!asn1_path_valid($asn1path)) {
throw new VolcanoException("ASN.1 notation '$asn1path' is invalid"); # TODO: source?
}
$asn1path = preg_replace('@^\\s*\\{(.+)\\}\\s*$@', '\\1', $asn1path);
 
$asn1path_neu = '';
$asn1path = str_replace("\t", ' ', $asn1path);
$z = explode(' ', $asn1path);
foreach ($z as $za) {
$za = trim($za);
if ($za == '') continue;
$asn1path_neu .= "$za ";
}
$asn1path_neu = trim($asn1path_neu);
 
$xx[] = $asn1path_neu;
return true;
}
 
return false;
}
 
public static function processOID($oid, &$out, &$oidplusobj) {
$xx = array();
 
$x = $oid;
do {
$toparc = oid_toparc($x);
 
if (self::detectDirectAsn1Notation($x, $xx, $oidplusobj)) break;
 
$ids = $oidplusobj->getIdentifiers($x);
 
$id = null;
foreach ($ids as $m) {
if (oid_id_is_valid($m)) {
$id = $m;
break;
}
}
 
if (is_null($id)) {
$xx[] = $toparc;
} else {
$xx[] = "$id($toparc)";
}
} while (($x = oid_up($x)) != '.');
 
$xx = array_reverse($xx);
 
if (count($xx) > 0) {
$asn1path = '{ '.implode(' ', $xx).' }';
 
if (!asn1_path_valid($asn1path)) {
throw new VolcanoException("ASN.1 notation '$asn1path' is invalid"); # TODO: source?
}
 
$out[] = "asn1-notation: $asn1path";
}
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new ASN1SearchFieldExtender());
/trunk_oldversion/plugins/field_extenders/6_iri_search.inc.php
0,0 → 1,78
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/oid_utils.inc.php';
require_once __DIR__ . '/../../includes/uuid_utils.inc.php';
 
class IRISearchFieldExtender implements OIDPlusFieldExtenders {
private static function detectDirectIRINotation($x, &$xx, $oidplusobj) {
# At your root, you can define your own iri-notation
# FUT: as alternative, we could have "invisible" OIDs (cannot be queried) which give information about non-root OIDs
$iripath = $oidplusobj->getValuesOf($x, 'iri-notation', true);
if (count($iripath) > 0) {
$oidplusobj->stripAttribs($x, 'iri-notation');
 
$iripath = trim($iripath[0]);
if (!iri_valid($iripath)) {
throw new VolcanoException("IRI notation '$iripath' is invalid"); # TODO: source?
}
 
$iripath = trim($iripath);
assert(substr($iripath, 0, 1) == '/');
$iripath = substr($iripath, 1);
 
$xx[] = $iripath;
return true;
}
 
return false;
}
 
public static function processOID($oid, &$out, &$oidplusobj) {
$xx = array();
 
$x = $oid;
do {
$toparc = oid_toparc($x);
 
if (self::detectDirectIRINotation($x, $xx, $oidplusobj)) break;
 
$ids = $oidplusobj->getUnicodeLabels($x);
 
$id = null;
foreach ($ids as $m) {
if (iri_arc_valid($m)) {
$id = $m;
break;
}
}
 
if (is_null($id)) {
$xx[] = $toparc;
} else {
$xx[] = $id;
}
} while (($x = oid_up($x)) != '.');
 
$xx = array_reverse($xx);
 
if (count($xx) > 0) {
$iripath = '/'.implode('/', $xx);
 
if (!iri_valid($iripath)) {
throw new VolcanoException("IRI notation '$iripath' is invalid"); # TODO: source?
}
 
# TODO: soll das auch für die existierenden "iri-notation" felder angewandt werden?
$iripath = iri_add_longarcs($iripath);
 
$out[] = "iri-notation: $iripath";
}
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new IRISearchFieldExtender());
/trunk_oldversion/plugins/field_extenders/7_doi_url.inc.php
0,0 → 1,43
<?php
 
# if (!interface_exists('OIDPlusFieldExtenders')) throw new Exception('Required interface "OIDPlusFieldExtenders" not found.');
# if (!class_exists('OIDPlus')) throw new Exception('Required class "OIDPlus" not found.');
 
require_once __DIR__ . '/../../core/OIDPlusFieldExtenders.class.php';
require_once __DIR__ . '/../../includes/uuid_utils.inc.php';
 
class DOILinkFieldExtender implements OIDPlusFieldExtenders {
 
public static function findDOI($oid, &$oidplusobj) {
$indexes = $oidplusobj->getDatasets($oid, 'index');
 
$found_doi = null;
foreach ($indexes as $index) {
$params = $index['attrib_params'];
$is_doi = false;
foreach ($params as $param) {
if (strtolower(trim($param)) == 'doi') {
$is_doi = true;
break;
}
}
 
if ($is_doi) {
$found_doi = trim($index['value']);
break;
}
}
 
return $found_doi;
}
 
public static function processOID($oid, &$out, &$oidplusobj) {
$doi = self::findDOI($oid, $oidplusobj);
if (!is_null($doi)) {
$out[] = "doi-resolve:http://dx.doi.org/$doi";
}
}
}
 
require_once __DIR__ . '/../../core/2_OIDPlus.class.php';
OIDPlus::registerFieldExtender(new DOILinkFieldExtender());
/trunk_oldversion/plugins/search/doi.inc.php
0,0 → 1,54
<?php
 
# TODO: das kann ohne suffix auskommen: http://dx.doi.org/10.1038/
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
 
class VolcanoSearchDOI implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'doi', true); // is always case insensitive
}
 
public static function calcDistance($candidate, $searchterm) {
$y = explode('/', $searchterm);
$x = explode('/', $candidate);
$dist = count($y)-count($x);
 
for ($i=0; $i<min(count($x),count($y)); $i++) {
if ($x[$i] != $y[$i]) return false;
}
 
return $dist;
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchDOI());
 
# --- TEST
 
$x = new VolcanoSearchDOI();
 
assert($x->calcDistance('10.1000', '10.1000/1') == 1);
assert($x->calcDistance('10.1000/1', '10.1000') == -1);
assert($x->calcDistance('10.1000', '10.1000') == 0);
assert($x->calcDistance('10.1001', '10.1000') === false);
 
assert($x->calcDistance('10.1000/1/2/3', '10.1000/1/2/3/4/5') == 2);
assert($x->calcDistance('10.1000/1/2/3', '10.1000/1/2/3') == 0);
assert($x->calcDistance('10.1000/1/2/3/4/5', '10.1000/1/2/3') == -2);
 
assert($x->calcDistance('10.1000/1/2/x', '10.1000/1/2/3/4/5') === false);
assert($x->calcDistance('10.1000/1/2/x', '10.1000/1/2/3') === false);
assert($x->calcDistance('10.1000/1/2/x/4/5', '10.1000/1/2/3') === false);
/trunk_oldversion/plugins/search/domain.inc.php
0,0 → 1,67
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
 
class VolcanoSearchDomain implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'domain', true); // is always case insensitive
}
 
protected static function tryNormalize($term) {
// TODO: also validate syntax
$ary = explode(':', $term);
$term = $ary[0];
if (substr($term, -1, 1) != '.') $term .= '.';
return $term;
}
 
public static function calcDistance($candidate, $searchterm) {
// TODO: punycode?
 
$candidate = self::tryNormalize($candidate);
$searchterm = self::tryNormalize($searchterm);
 
if (strlen($candidate) <= strlen($searchterm)) {
$cmp = substr($searchterm, strlen($searchterm)-strlen($candidate));
if (!self::strEqual($cmp, $candidate, true)) return false;
 
$subdoms = substr($searchterm, 0, strlen($searchterm)-strlen($candidate));
return substr_count($subdoms, '.');
} else {
$cmp = substr($candidate, strlen($candidate)-strlen($searchterm));
if (!self::strEqual($cmp, $searchterm, true)) return false;
 
$too_specific = substr($candidate, 0, strlen($candidate)-strlen($searchterm));
return -substr_count($too_specific, '.');
}
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchDomain());
 
# --- TEST
 
/*
$x = new VolcanoSearchDomain();
assert($x->calcDistance('de.', 'viathinksoft.DE.') == 1);
assert($x->calcDistance('de.', 'viathinksoft.de.') == 1);
assert($x->calcDistance('viathinksoft.de.', 'viathinksoft.de.') == 0);
assert($x->calcDistance('viathinksoft.DE.', 'viathinksoft.de.') == 0);
assert($x->calcDistance('www.viathinksoft.de.', 'viathinksoft.de.') == -1);
 
assert($x->calcDistance('de.', 'viathinksoft.xx.') === false);
assert($x->calcDistance('viathinksoft.de.', 'viathinksoft.xx.') === false);
assert($x->calcDistance('www.viathinksoft.de.', 'viathinksoft.xx.') === false);
*/
/trunk_oldversion/plugins/search/ipv4.inc.php
0,0 → 1,45
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
require_once __DIR__ . '/../../includes/ipv4_functions.inc.php';
 
class VolcanoSearchIPv4 implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'ipv4', true); // is always case insensitive
}
 
public static function calcDistance($candidate, $searchterm) {
return ipv4_distance($searchterm, $candidate); // TODO: richtig rum?
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchIPv4());
 
# --- TEST
 
/*
$x = new VolcanoSearchIPv4();
 
assert($x->calcDistance('192.168.0.0/16', '192.168.64.0/18') === 2);
assert($x->calcDistance('192.168.64.0/18', '192.168.64.0/18') === 0);
assert($x->calcDistance('192.168.64.0/20', '192.168.64.0/18') === -2);
 
assert($x->calcDistance('192.168.69.200/31', '192.168.69.202/31') === false);
assert($x->calcDistance('192.168.69.200/32', '192.168.69.201/32') === false);
assert($x->calcDistance('192.168.69.200', '192.168.69.201') === false);
 
assert($x->calcDistance('95.211.38.42/32', '95.211.38.42') === 0);
assert($x->calcDistance('95.211.38.42', '95.211.38.42/32') === 0);
*/
/trunk_oldversion/plugins/search/ipv6.inc.php
0,0 → 1,42
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
require_once __DIR__ . '/../../includes/ipv6_functions.inc.php';
 
class VolcanoSearchIPv6 implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'ipv6', true); // is always case insensitive
}
 
public static function calcDistance($candidate, $searchterm) {
return ipv6_distance($searchterm, $candidate); // TODO: richtig rum?
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchIPv6());
 
# --- TEST
 
/*
$x = new VolcanoSearchIPv6();
assert($x->calcDistance('2001:1ae0::/27', '2001:1af8::/29') == 2);
assert($x->calcDistance('2001:1af8::/29', '2001:1af8::/29') == 0);
assert($x->calcDistance('2001:1af8::/31', '2001:1af8::/29') == -2);
 
assert($x->calcDistance('2002:1af8:4100:a061:0001::1335/127', '2001:1af8:4100:a061:0001::1336/127') === false);
assert($x->calcDistance('2001:1af8:4100:a061:0001::1337/128', '2001:1af8:4100:a061:0001::1336/128') === false);
assert($x->calcDistance('2001:1af8:4100:a061:0001::1337', '2001:1af8:4100:a061:0001::1336') === false);
*/
 
/trunk_oldversion/plugins/search/str.inc.php
0,0 → 1,37
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
 
class VolcanoSearchStr implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'str', true); // is always case insensitive
}
 
public static function calcDistance($candidate, $searchterm) {
return (self::strEqual($candidate, $searchterm, false)) ? 0 : -1;
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchStr());
 
# --- TEST
 
/*
$x = new VolcanoSearchStr();
assert($x->calcDistance('a', 'a') == 0);
assert($x->calcDistance('a', 'A') == -1);
assert($x->calcDistance('a', 'b') == -1);
*/
 
/trunk_oldversion/plugins/search/stri.inc.php
0,0 → 1,37
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
 
class VolcanoSearchStrI implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'stri', true); // is always case insensitive
}
 
public static function calcDistance($candidate, $searchterm) {
return (self::strEqual($candidate, $searchterm, true)) ? 0 : -1;
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchStrI());
 
# --- TEST
 
/*
$x = new VolcanoSearchStrI();
assert($x->calcDistance('a', 'a') == 0);
assert($x->calcDistance('a', 'A') == 0);
assert($x->calcDistance('a', 'b') == -1);
*/
 
/trunk_oldversion/plugins/search/uuid.inc.php
0,0 → 1,54
<?php
 
# if (!interface_exists('VolcanoSearchProvider')) throw new Exception('Required interface "VolcanoSearchProvider" not found.');
# if (!class_exists('VolcanoDB')) throw new Exception('Required class "VolcanoDB" not found.');
 
require_once __DIR__ . '/../../core/VolcanoSearchProvider.class.php';
 
class VolcanoSearchUUID implements VolcanoSearchProvider {
public static function checkId($id) {
return self::strEqual($id, 'guid', true) || self::strEqual($id, 'uuid', true); // is always case insensitive
}
 
protected static function tryNormalize($term) {
// TODO: also validate syntax
$term = str_replace('{', '', $term);
$term = str_replace('}', '', $term);
$term = strtolower($term);
return $term;
}
 
public static function calcDistance($candidate, $searchterm) {
$candidate = self::tryNormalize($candidate);
$searchterm = self::tryNormalize($searchterm);
 
if ($candidate == $searchterm) {
return 0;
} else {
return false;
}
}
 
protected static function strEqual($str1, $str2, $caseInsensitive = false) {
if ($caseInsensitive) {
return strtolower($str1) == strtolower($str2);
} else {
return $str1 == $str2;
}
}
}
 
require_once __DIR__ . '/../../core/1_VolcanoDB.class.php';
VolcanoDB::registerSearchProvider(new VolcanoSearchUUID());
 
# --- TEST
 
/*
$x = new VolcanoSearchUUID();
 
assert($x->calcDistance('fd3c657c-0728-4769-b608-db5ece442c97', '8338af1c-61ea-41c1-aded-c836846ae22d') === false);
assert($x->calcDistance('fd3c657c-0728-4769-b608-db5ece442c97', 'fd3c657c-0728-4769-b608-db5ece442c97') === 0);
assert($x->calcDistance('fd3c657c-0728-4769-b608-db5ece442c97', '{FD3c657c-0728-4769-b608-db5ece442C97}') === 0);
assert($x->calcDistance('{fd3C657C-0728-4769-b608-db5ece442c97}', 'fd3c657c-0728-4769-b608-db5ece442c97') === 0);
*/
 
/trunk_oldversion/style.css
0,0 → 1,31
body {
background:#F2EADC;
color:black;
font-family:'Times New Roman';
}
 
h1 {
font-family:Arial;
font-size:30px;
}
 
a:link, a:visited {
color:darkblue;
}
 
p.green {
font-size:14px;
}
 
p.green a:link, p.green a:visited {
color:green;
}
 
a:hover, p.green a:hover {
color:#DD0000;
}
 
#headertable {
background:#EDDC21;
color:black;
}
Property changes:
Added: svn:mime-type
+text/css
\ No newline at end of property
/trunk_oldversion/welcome.php
0,0 → 1,16
<h2>Welcome</h2>
 
<p>This web service has no welcome page defined.</p>
 
<pre>
/\\\\\ /\\\\\\\\\\\ /\\\\\\\\\\\\
/\\\///\\\ \/////\\\/// \/\\\////////\\\
/\\\/ \///\\\ \/\\\ \/\\\ \//\\\ /\\\
/\\\ \//\\\ \/\\\ \/\\\ \/\\\ \/\\\
\/\\\ \/\\\ \/\\\ \/\\\ \/\\\ /\\\\\\\\\\\
\//\\\ /\\\ \/\\\ \/\\\ \/\\\ \/////\\\///
\///\\\ /\\\ \/\\\ \/\\\ /\\\ \/\\\
\///\\\\\/ /\\\\\\\\\\\ \/\\\\\\\\\\\\/ \///
\///// \/////////// \////////////
 
</pre>
/trunk_oldversion/whois.php
0,0 → 1,48
<?php
 
#xxx TODO: debug
#$argc++;
#$argv[] = 'oidplus:!listRoots';
 
 
# TODO: try to find out namespace!
 
 
if (php_sapi_name() == 'cli') {
header('HTTP/1.1 400 Bad Request');
echo "Error: This script can only run in webserver mode\n"; # TODO: +STDERR?
exit(2);
}
 
include_once __DIR__ . '/includes/oid_plus.inc.php';
 
header('Content-Type:text/plain');
 
$db = new OIDPlus(__DIR__ . '/db/local.conf', true);
 
$title = 'OID+ web interface [BETA]';
 
try {
$db->addDir(__DIR__ . '/db');
} catch (VolcanoException $e) {
header('HTTP/1.1 500 Internal Server Error');
$title = 'Database error';
$msg = $e->getMessage();
$msg = str_replace(__DIR__, '.', $msg);
echo "$title\n\n";
echo "An internal error occurred while reading the Volcano database. Please contact the administrator and try again later.\n\n"; # TODO: +STDERR?
echo "Error message:\n\n";
echo "$msg\n";
exit;
}
 
if (!isset($_REQUEST['query'])) {
echo "Syntax: ?query=<query>\n";
exit(2);
}
 
# echo "$title\n\n";
 
$args = $_REQUEST['query'];
 
$db->query($args);
/trunk_oldversion/whois_cli
0,0 → 1,50
#!/usr/bin/php
<?php
 
#xxx TODO: debug
#$argc++;
#$argv[] = 'oidplus:!listRoots';
 
 
# TODO: try to find out namespace!
 
 
if (php_sapi_name() != 'cli') {
header('HTTP/1.1 400 Bad Request');
echo "Error: This script can only run in CLI mode\n"; # TODO: +STDERR?
exit(2);
}
 
include_once __DIR__ . '/includes/oid_plus.inc.php';
 
header('Content-Type:text/plain');
 
$db = new OIDPlus(__DIR__ . '/db/local.conf', true);
 
$title = 'OID+ web interface [BETA]';
 
try {
$db->addDir(__DIR__ . '/db');
} catch (VolcanoException $e) {
header('HTTP/1.1 500 Internal Server Error');
$title = 'Database error';
$msg = $e->getMessage();
$msg = str_replace(__DIR__, '.', $msg);
echo "$title\n\n";
echo "An internal error occurred while reading the Volcano database. Please contact the administrator and try again later.\n\n"; # TODO: +STDERR?
echo "Error message:\n\n";
echo "$msg\n";
exit;
}
 
if ($argc != 2) {
echo "Syntax: $argv[0] <query>\n";
exit(2);
}
 
# echo "$title\n\n";
 
array_shift($argv);
$args = implode(' ', $argv);
 
$db->query($args);
Property changes:
Added: svn:executable
+*
\ No newline at end of property