CINXE.COM

[Apache-SVN] Contents of /httpd/httpd/trunk/modules/metadata/mod_mime_magic.c

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- ViewVC :: http://www.viewvc.org/ --> <head> <title>[Apache-SVN] Contents of /httpd/httpd/trunk/modules/metadata/mod_mime_magic.c</title> <meta name="generator" content="ViewVC 1.1.26" /> <link rel="shortcut icon" href="/vc-static/images/favicon.ico" /> <link rel="stylesheet" href="/vc-static/styles.css" type="text/css" /> </head> <body> <div class="vc_navheader"> <table><tr> <td><strong><a href="/viewvc?view=roots"><span class="pathdiv">/</span></a><a href="/viewvc/?pathrev=1873985">[Apache-SVN]</a><span class="pathdiv">/</span><a href="/viewvc/httpd/?pathrev=1873985">httpd</a><span class="pathdiv">/</span><a href="/viewvc/httpd/httpd/?pathrev=1873985">httpd</a><span class="pathdiv">/</span><a href="/viewvc/httpd/httpd/trunk/?pathrev=1873985">trunk</a><span class="pathdiv">/</span><a href="/viewvc/httpd/httpd/trunk/modules/?pathrev=1873985">modules</a><span class="pathdiv">/</span><a href="/viewvc/httpd/httpd/trunk/modules/metadata/?pathrev=1873985">metadata</a><span class="pathdiv">/</span><a href="/viewvc/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?view=log&amp;pathrev=1873985">mod_mime_magic.c</a></strong></td> <td style="text-align: right;"></td> </tr></table> </div> <div style="float: right; padding: 5px;"><a href="http://www.viewvc.org/" title="ViewVC Home"><img src="/vc-static/images/viewvc-logo.png" alt="ViewVC logotype" width="240" height="70" /></a></div> <h1>Contents of /httpd/httpd/trunk/modules/metadata/mod_mime_magic.c</h1> <p style="margin:0;"> <a href="/viewvc/httpd/httpd/trunk/modules/metadata/?pathrev=1873985"><img src="/vc-static/images/back_small.png" class="vc_icon" alt="Parent Directory" /> Parent Directory</a> | <a href="/viewvc/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?view=log&amp;pathrev=1873985"><img src="/vc-static/images/log.png" class="vc_icon" alt="Revision Log" /> Revision Log</a> </p> <hr /> <div class="vc_summary"> Revision <a href="/viewvc?view=revision&amp;revision=1873985"><strong>1873985</strong></a> - (<a href="/viewvc/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?annotate=1873985&amp;pathrev=1873985"><strong>show annotations</strong></a>) (<a href="/viewvc/httpd/httpd/trunk/modules/metadata/mod_mime_magic.c?revision=1873985&amp;view=co&amp;pathrev=1873985"><strong>download</strong></a>) <br /><em>Thu Feb 13 18:15:57 2020 UTC</em> (4 years, 9 months ago) by <em>mrumph</em> <br />File MIME type: text/plain <br />File size: 74104 byte(s) <pre class="vc_log">Fix spelling errors found by codespell. [skip ci] </pre> </div> <div id="vc_file"> <table cellspacing="0" cellpadding="0"> <tr class="vc_row_odd" id="l1"> <td class="vc_file_line_number"><a href="#l1">1</a></td> <td class="vc_file_line_text">/* Licensed to the Apache Software Foundation (ASF) under one or more</td> </tr> <tr class="vc_row_odd" id="l2"> <td class="vc_file_line_number"><a href="#l2">2</a></td> <td class="vc_file_line_text"> * contributor license agreements. See the NOTICE file distributed with</td> </tr> <tr class="vc_row_odd" id="l3"> <td class="vc_file_line_number"><a href="#l3">3</a></td> <td class="vc_file_line_text"> * this work for additional information regarding copyright ownership.</td> </tr> <tr class="vc_row_odd" id="l4"> <td class="vc_file_line_number"><a href="#l4">4</a></td> <td class="vc_file_line_text"> * The ASF licenses this file to You under the Apache License, Version 2.0</td> </tr> <tr class="vc_row_odd" id="l5"> <td class="vc_file_line_number"><a href="#l5">5</a></td> <td class="vc_file_line_text"> * (the &quot;License&quot;); you may not use this file except in compliance with</td> </tr> <tr class="vc_row_odd" id="l6"> <td class="vc_file_line_number"><a href="#l6">6</a></td> <td class="vc_file_line_text"> * the License. You may obtain a copy of the License at</td> </tr> <tr class="vc_row_odd" id="l7"> <td class="vc_file_line_number"><a href="#l7">7</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l8"> <td class="vc_file_line_number"><a href="#l8">8</a></td> <td class="vc_file_line_text"> * <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></td> </tr> <tr class="vc_row_odd" id="l9"> <td class="vc_file_line_number"><a href="#l9">9</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l10"> <td class="vc_file_line_number"><a href="#l10">10</a></td> <td class="vc_file_line_text"> * Unless required by applicable law or agreed to in writing, software</td> </tr> <tr class="vc_row_odd" id="l11"> <td class="vc_file_line_number"><a href="#l11">11</a></td> <td class="vc_file_line_text"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</td> </tr> <tr class="vc_row_odd" id="l12"> <td class="vc_file_line_number"><a href="#l12">12</a></td> <td class="vc_file_line_text"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</td> </tr> <tr class="vc_row_odd" id="l13"> <td class="vc_file_line_number"><a href="#l13">13</a></td> <td class="vc_file_line_text"> * See the License for the specific language governing permissions and</td> </tr> <tr class="vc_row_odd" id="l14"> <td class="vc_file_line_number"><a href="#l14">14</a></td> <td class="vc_file_line_text"> * limitations under the License.</td> </tr> <tr class="vc_row_odd" id="l15"> <td class="vc_file_line_number"><a href="#l15">15</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l16"> <td class="vc_file_line_number"><a href="#l16">16</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l17"> <td class="vc_file_line_number"><a href="#l17">17</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l18"> <td class="vc_file_line_number"><a href="#l18">18</a></td> <td class="vc_file_line_text"> * mod_mime_magic: MIME type lookup via file magic numbers</td> </tr> <tr class="vc_row_odd" id="l19"> <td class="vc_file_line_number"><a href="#l19">19</a></td> <td class="vc_file_line_text"> * Copyright (c) 1996-1997 Cisco Systems, Inc.</td> </tr> <tr class="vc_row_odd" id="l20"> <td class="vc_file_line_number"><a href="#l20">20</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l21"> <td class="vc_file_line_number"><a href="#l21">21</a></td> <td class="vc_file_line_text"> * This software was submitted by Cisco Systems to the Apache Software Foundation in July</td> </tr> <tr class="vc_row_odd" id="l22"> <td class="vc_file_line_number"><a href="#l22">22</a></td> <td class="vc_file_line_text"> * 1997. Future revisions and derivatives of this source code must</td> </tr> <tr class="vc_row_odd" id="l23"> <td class="vc_file_line_number"><a href="#l23">23</a></td> <td class="vc_file_line_text"> * acknowledge Cisco Systems as the original contributor of this module.</td> </tr> <tr class="vc_row_odd" id="l24"> <td class="vc_file_line_number"><a href="#l24">24</a></td> <td class="vc_file_line_text"> * All other licensing and usage conditions are those of the Apache Software Foundation.</td> </tr> <tr class="vc_row_odd" id="l25"> <td class="vc_file_line_number"><a href="#l25">25</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l26"> <td class="vc_file_line_number"><a href="#l26">26</a></td> <td class="vc_file_line_text"> * Some of this code is derived from the free version of the file command</td> </tr> <tr class="vc_row_odd" id="l27"> <td class="vc_file_line_number"><a href="#l27">27</a></td> <td class="vc_file_line_text"> * originally posted to comp.sources.unix. Copyright info for that program</td> </tr> <tr class="vc_row_odd" id="l28"> <td class="vc_file_line_number"><a href="#l28">28</a></td> <td class="vc_file_line_text"> * is included below as required.</td> </tr> <tr class="vc_row_odd" id="l29"> <td class="vc_file_line_number"><a href="#l29">29</a></td> <td class="vc_file_line_text"> * ---------------------------------------------------------------------------</td> </tr> <tr class="vc_row_odd" id="l30"> <td class="vc_file_line_number"><a href="#l30">30</a></td> <td class="vc_file_line_text"> * - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.</td> </tr> <tr class="vc_row_odd" id="l31"> <td class="vc_file_line_number"><a href="#l31">31</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l32"> <td class="vc_file_line_number"><a href="#l32">32</a></td> <td class="vc_file_line_text"> * This software is not subject to any license of the American Telephone and</td> </tr> <tr class="vc_row_odd" id="l33"> <td class="vc_file_line_number"><a href="#l33">33</a></td> <td class="vc_file_line_text"> * Telegraph Company or of the Regents of the University of California.</td> </tr> <tr class="vc_row_odd" id="l34"> <td class="vc_file_line_number"><a href="#l34">34</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l35"> <td class="vc_file_line_number"><a href="#l35">35</a></td> <td class="vc_file_line_text"> * Permission is granted to anyone to use this software for any purpose on any</td> </tr> <tr class="vc_row_odd" id="l36"> <td class="vc_file_line_number"><a href="#l36">36</a></td> <td class="vc_file_line_text"> * computer system, and to alter it and redistribute it freely, subject to</td> </tr> <tr class="vc_row_odd" id="l37"> <td class="vc_file_line_number"><a href="#l37">37</a></td> <td class="vc_file_line_text"> * the following restrictions:</td> </tr> <tr class="vc_row_odd" id="l38"> <td class="vc_file_line_number"><a href="#l38">38</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l39"> <td class="vc_file_line_number"><a href="#l39">39</a></td> <td class="vc_file_line_text"> * 1. The author is not responsible for the consequences of use of this</td> </tr> <tr class="vc_row_odd" id="l40"> <td class="vc_file_line_number"><a href="#l40">40</a></td> <td class="vc_file_line_text"> * software, no matter how awful, even if they arise from flaws in it.</td> </tr> <tr class="vc_row_odd" id="l41"> <td class="vc_file_line_number"><a href="#l41">41</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l42"> <td class="vc_file_line_number"><a href="#l42">42</a></td> <td class="vc_file_line_text"> * 2. The origin of this software must not be misrepresented, either by</td> </tr> <tr class="vc_row_odd" id="l43"> <td class="vc_file_line_number"><a href="#l43">43</a></td> <td class="vc_file_line_text"> * explicit claim or by omission. Since few users ever read sources, credits</td> </tr> <tr class="vc_row_odd" id="l44"> <td class="vc_file_line_number"><a href="#l44">44</a></td> <td class="vc_file_line_text"> * must appear in the documentation.</td> </tr> <tr class="vc_row_odd" id="l45"> <td class="vc_file_line_number"><a href="#l45">45</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l46"> <td class="vc_file_line_number"><a href="#l46">46</a></td> <td class="vc_file_line_text"> * 3. Altered versions must be plainly marked as such, and must not be</td> </tr> <tr class="vc_row_odd" id="l47"> <td class="vc_file_line_number"><a href="#l47">47</a></td> <td class="vc_file_line_text"> * misrepresented as being the original software. Since few users ever read</td> </tr> <tr class="vc_row_odd" id="l48"> <td class="vc_file_line_number"><a href="#l48">48</a></td> <td class="vc_file_line_text"> * sources, credits must appear in the documentation.</td> </tr> <tr class="vc_row_odd" id="l49"> <td class="vc_file_line_number"><a href="#l49">49</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l50"> <td class="vc_file_line_number"><a href="#l50">50</a></td> <td class="vc_file_line_text"> * 4. This notice may not be removed or altered.</td> </tr> <tr class="vc_row_odd" id="l51"> <td class="vc_file_line_number"><a href="#l51">51</a></td> <td class="vc_file_line_text"> * -------------------------------------------------------------------------</td> </tr> <tr class="vc_row_odd" id="l52"> <td class="vc_file_line_number"><a href="#l52">52</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l53"> <td class="vc_file_line_number"><a href="#l53">53</a></td> <td class="vc_file_line_text"> * For compliance with Mr Darwin&#39;s terms: this has been very significantly</td> </tr> <tr class="vc_row_odd" id="l54"> <td class="vc_file_line_number"><a href="#l54">54</a></td> <td class="vc_file_line_text"> * modified from the free &quot;file&quot; command.</td> </tr> <tr class="vc_row_odd" id="l55"> <td class="vc_file_line_number"><a href="#l55">55</a></td> <td class="vc_file_line_text"> * - all-in-one file for compilation convenience when moving from one</td> </tr> <tr class="vc_row_odd" id="l56"> <td class="vc_file_line_number"><a href="#l56">56</a></td> <td class="vc_file_line_text"> * version of Apache to the next.</td> </tr> <tr class="vc_row_odd" id="l57"> <td class="vc_file_line_number"><a href="#l57">57</a></td> <td class="vc_file_line_text"> * - Memory allocation is done through the Apache API&#39;s apr_pool_t structure.</td> </tr> <tr class="vc_row_odd" id="l58"> <td class="vc_file_line_number"><a href="#l58">58</a></td> <td class="vc_file_line_text"> * - All functions have had necessary Apache API request or server</td> </tr> <tr class="vc_row_odd" id="l59"> <td class="vc_file_line_number"><a href="#l59">59</a></td> <td class="vc_file_line_text"> * structures passed to them where necessary to call other Apache API</td> </tr> <tr class="vc_row_odd" id="l60"> <td class="vc_file_line_number"><a href="#l60">60</a></td> <td class="vc_file_line_text"> * routines. (i.e. usually for logging, files, or memory allocation in</td> </tr> <tr class="vc_row_odd" id="l61"> <td class="vc_file_line_number"><a href="#l61">61</a></td> <td class="vc_file_line_text"> * itself or a called function.)</td> </tr> <tr class="vc_row_odd" id="l62"> <td class="vc_file_line_number"><a href="#l62">62</a></td> <td class="vc_file_line_text"> * - struct magic has been converted from an array to a single-ended linked</td> </tr> <tr class="vc_row_odd" id="l63"> <td class="vc_file_line_number"><a href="#l63">63</a></td> <td class="vc_file_line_text"> * list because it only grows one record at a time, it&#39;s only accessed</td> </tr> <tr class="vc_row_odd" id="l64"> <td class="vc_file_line_number"><a href="#l64">64</a></td> <td class="vc_file_line_text"> * sequentially, and the Apache API has no equivalent of realloc().</td> </tr> <tr class="vc_row_odd" id="l65"> <td class="vc_file_line_number"><a href="#l65">65</a></td> <td class="vc_file_line_text"> * - Functions have been changed to get their parameters from the server</td> </tr> <tr class="vc_row_odd" id="l66"> <td class="vc_file_line_number"><a href="#l66">66</a></td> <td class="vc_file_line_text"> * configuration instead of globals. (It should be reentrant now but has</td> </tr> <tr class="vc_row_odd" id="l67"> <td class="vc_file_line_number"><a href="#l67">67</a></td> <td class="vc_file_line_text"> * not been tested in a threaded environment.)</td> </tr> <tr class="vc_row_odd" id="l68"> <td class="vc_file_line_number"><a href="#l68">68</a></td> <td class="vc_file_line_text"> * - Places where it used to print results to stdout now saves them in a</td> </tr> <tr class="vc_row_odd" id="l69"> <td class="vc_file_line_number"><a href="#l69">69</a></td> <td class="vc_file_line_text"> * list where they&#39;re used to set the MIME type in the Apache request</td> </tr> <tr class="vc_row_odd" id="l70"> <td class="vc_file_line_number"><a href="#l70">70</a></td> <td class="vc_file_line_text"> * record.</td> </tr> <tr class="vc_row_odd" id="l71"> <td class="vc_file_line_number"><a href="#l71">71</a></td> <td class="vc_file_line_text"> * - Command-line flags have been removed since they will never be used here.</td> </tr> <tr class="vc_row_odd" id="l72"> <td class="vc_file_line_number"><a href="#l72">72</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l73"> <td class="vc_file_line_number"><a href="#l73">73</a></td> <td class="vc_file_line_text"> * Ian Kluft &lt;ikluft@cisco.com&gt;</td> </tr> <tr class="vc_row_odd" id="l74"> <td class="vc_file_line_number"><a href="#l74">74</a></td> <td class="vc_file_line_text"> * Engineering Information Framework</td> </tr> <tr class="vc_row_odd" id="l75"> <td class="vc_file_line_number"><a href="#l75">75</a></td> <td class="vc_file_line_text"> * Central Engineering</td> </tr> <tr class="vc_row_odd" id="l76"> <td class="vc_file_line_number"><a href="#l76">76</a></td> <td class="vc_file_line_text"> * Cisco Systems, Inc.</td> </tr> <tr class="vc_row_odd" id="l77"> <td class="vc_file_line_number"><a href="#l77">77</a></td> <td class="vc_file_line_text"> * San Jose, CA, USA</td> </tr> <tr class="vc_row_odd" id="l78"> <td class="vc_file_line_number"><a href="#l78">78</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l79"> <td class="vc_file_line_number"><a href="#l79">79</a></td> <td class="vc_file_line_text"> * Initial installation July/August 1996</td> </tr> <tr class="vc_row_odd" id="l80"> <td class="vc_file_line_number"><a href="#l80">80</a></td> <td class="vc_file_line_text"> * Misc bug fixes May 1997</td> </tr> <tr class="vc_row_odd" id="l81"> <td class="vc_file_line_number"><a href="#l81">81</a></td> <td class="vc_file_line_text"> * Submission to Apache Software Foundation July 1997</td> </tr> <tr class="vc_row_odd" id="l82"> <td class="vc_file_line_number"><a href="#l82">82</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l83"> <td class="vc_file_line_number"><a href="#l83">83</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l84"> <td class="vc_file_line_number"><a href="#l84">84</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l85"> <td class="vc_file_line_number"><a href="#l85">85</a></td> <td class="vc_file_line_text">#include &quot;apr.h&quot;</td> </tr> <tr class="vc_row_odd" id="l86"> <td class="vc_file_line_number"><a href="#l86">86</a></td> <td class="vc_file_line_text">#include &quot;apr_strings.h&quot;</td> </tr> <tr class="vc_row_odd" id="l87"> <td class="vc_file_line_number"><a href="#l87">87</a></td> <td class="vc_file_line_text">#include &quot;apr_lib.h&quot;</td> </tr> <tr class="vc_row_odd" id="l88"> <td class="vc_file_line_number"><a href="#l88">88</a></td> <td class="vc_file_line_text">#define APR_WANT_STRFUNC</td> </tr> <tr class="vc_row_odd" id="l89"> <td class="vc_file_line_number"><a href="#l89">89</a></td> <td class="vc_file_line_text">#include &quot;apr_want.h&quot;</td> </tr> <tr class="vc_row_odd" id="l90"> <td class="vc_file_line_number"><a href="#l90">90</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l91"> <td class="vc_file_line_number"><a href="#l91">91</a></td> <td class="vc_file_line_text">#if APR_HAVE_UNISTD_H</td> </tr> <tr class="vc_row_odd" id="l92"> <td class="vc_file_line_number"><a href="#l92">92</a></td> <td class="vc_file_line_text">#include &lt;unistd.h&gt;</td> </tr> <tr class="vc_row_odd" id="l93"> <td class="vc_file_line_number"><a href="#l93">93</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l94"> <td class="vc_file_line_number"><a href="#l94">94</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l95"> <td class="vc_file_line_number"><a href="#l95">95</a></td> <td class="vc_file_line_text">#include &quot;ap_config.h&quot;</td> </tr> <tr class="vc_row_odd" id="l96"> <td class="vc_file_line_number"><a href="#l96">96</a></td> <td class="vc_file_line_text">#include &quot;httpd.h&quot;</td> </tr> <tr class="vc_row_odd" id="l97"> <td class="vc_file_line_number"><a href="#l97">97</a></td> <td class="vc_file_line_text">#include &quot;http_config.h&quot;</td> </tr> <tr class="vc_row_odd" id="l98"> <td class="vc_file_line_number"><a href="#l98">98</a></td> <td class="vc_file_line_text">#include &quot;http_request.h&quot;</td> </tr> <tr class="vc_row_odd" id="l99"> <td class="vc_file_line_number"><a href="#l99">99</a></td> <td class="vc_file_line_text">#include &quot;http_core.h&quot;</td> </tr> <tr class="vc_row_odd" id="l100"> <td class="vc_file_line_number"><a href="#l100">100</a></td> <td class="vc_file_line_text">#include &quot;http_log.h&quot;</td> </tr> <tr class="vc_row_odd" id="l101"> <td class="vc_file_line_number"><a href="#l101">101</a></td> <td class="vc_file_line_text">#include &quot;http_protocol.h&quot;</td> </tr> <tr class="vc_row_odd" id="l102"> <td class="vc_file_line_number"><a href="#l102">102</a></td> <td class="vc_file_line_text">#include &quot;util_script.h&quot;</td> </tr> <tr class="vc_row_odd" id="l103"> <td class="vc_file_line_number"><a href="#l103">103</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l104"> <td class="vc_file_line_number"><a href="#l104">104</a></td> <td class="vc_file_line_text">/* ### this isn&#39;t set by configure? does anybody set this? */</td> </tr> <tr class="vc_row_odd" id="l105"> <td class="vc_file_line_number"><a href="#l105">105</a></td> <td class="vc_file_line_text">#ifdef HAVE_UTIME_H</td> </tr> <tr class="vc_row_odd" id="l106"> <td class="vc_file_line_number"><a href="#l106">106</a></td> <td class="vc_file_line_text">#include &lt;utime.h&gt;</td> </tr> <tr class="vc_row_odd" id="l107"> <td class="vc_file_line_number"><a href="#l107">107</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l108"> <td class="vc_file_line_number"><a href="#l108">108</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l109"> <td class="vc_file_line_number"><a href="#l109">109</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l110"> <td class="vc_file_line_number"><a href="#l110">110</a></td> <td class="vc_file_line_text"> * data structures and related constants</td> </tr> <tr class="vc_row_odd" id="l111"> <td class="vc_file_line_number"><a href="#l111">111</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l112"> <td class="vc_file_line_number"><a href="#l112">112</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l113"> <td class="vc_file_line_number"><a href="#l113">113</a></td> <td class="vc_file_line_text">#define MODNAME &quot;mod_mime_magic&quot;</td> </tr> <tr class="vc_row_odd" id="l114"> <td class="vc_file_line_number"><a href="#l114">114</a></td> <td class="vc_file_line_text">#define MIME_MAGIC_DEBUG 0</td> </tr> <tr class="vc_row_odd" id="l115"> <td class="vc_file_line_number"><a href="#l115">115</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l116"> <td class="vc_file_line_number"><a href="#l116">116</a></td> <td class="vc_file_line_text">#define MIME_BINARY_UNKNOWN &quot;application/octet-stream&quot;</td> </tr> <tr class="vc_row_odd" id="l117"> <td class="vc_file_line_number"><a href="#l117">117</a></td> <td class="vc_file_line_text">#define MIME_TEXT_UNKNOWN &quot;text/plain&quot;</td> </tr> <tr class="vc_row_odd" id="l118"> <td class="vc_file_line_number"><a href="#l118">118</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l119"> <td class="vc_file_line_number"><a href="#l119">119</a></td> <td class="vc_file_line_text">#define MAXMIMESTRING 256</td> </tr> <tr class="vc_row_odd" id="l120"> <td class="vc_file_line_number"><a href="#l120">120</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l121"> <td class="vc_file_line_number"><a href="#l121">121</a></td> <td class="vc_file_line_text">/* HOWMANY must be at least 4096 to make gzip -dcq work */</td> </tr> <tr class="vc_row_odd" id="l122"> <td class="vc_file_line_number"><a href="#l122">122</a></td> <td class="vc_file_line_text">#define HOWMANY 4096</td> </tr> <tr class="vc_row_odd" id="l123"> <td class="vc_file_line_number"><a href="#l123">123</a></td> <td class="vc_file_line_text">/* SMALL_HOWMANY limits how much work we do to figure out text files */</td> </tr> <tr class="vc_row_odd" id="l124"> <td class="vc_file_line_number"><a href="#l124">124</a></td> <td class="vc_file_line_text">#define SMALL_HOWMANY 1024</td> </tr> <tr class="vc_row_odd" id="l125"> <td class="vc_file_line_number"><a href="#l125">125</a></td> <td class="vc_file_line_text">#define MAXDESC 50 /* max leng of text description */</td> </tr> <tr class="vc_row_odd" id="l126"> <td class="vc_file_line_number"><a href="#l126">126</a></td> <td class="vc_file_line_text">#define MAXstring 64 /* max leng of &quot;string&quot; types */</td> </tr> <tr class="vc_row_odd" id="l127"> <td class="vc_file_line_number"><a href="#l127">127</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l128"> <td class="vc_file_line_number"><a href="#l128">128</a></td> <td class="vc_file_line_text">struct magic {</td> </tr> <tr class="vc_row_odd" id="l129"> <td class="vc_file_line_number"><a href="#l129">129</a></td> <td class="vc_file_line_text"> struct magic *next; /* link to next entry */</td> </tr> <tr class="vc_row_odd" id="l130"> <td class="vc_file_line_number"><a href="#l130">130</a></td> <td class="vc_file_line_text"> int lineno; /* line number from magic file */</td> </tr> <tr class="vc_row_odd" id="l131"> <td class="vc_file_line_number"><a href="#l131">131</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l132"> <td class="vc_file_line_number"><a href="#l132">132</a></td> <td class="vc_file_line_text"> short flag;</td> </tr> <tr class="vc_row_odd" id="l133"> <td class="vc_file_line_number"><a href="#l133">133</a></td> <td class="vc_file_line_text">#define INDIR 1 /* if &#39;&gt;(...)&#39; appears, */</td> </tr> <tr class="vc_row_odd" id="l134"> <td class="vc_file_line_number"><a href="#l134">134</a></td> <td class="vc_file_line_text">#define UNSIGNED 2 /* comparison is unsigned */</td> </tr> <tr class="vc_row_odd" id="l135"> <td class="vc_file_line_number"><a href="#l135">135</a></td> <td class="vc_file_line_text"> short cont_level; /* level of &quot;&gt;&quot; */</td> </tr> <tr class="vc_row_odd" id="l136"> <td class="vc_file_line_number"><a href="#l136">136</a></td> <td class="vc_file_line_text"> struct {</td> </tr> <tr class="vc_row_odd" id="l137"> <td class="vc_file_line_number"><a href="#l137">137</a></td> <td class="vc_file_line_text"> char type; /* byte short long */</td> </tr> <tr class="vc_row_odd" id="l138"> <td class="vc_file_line_number"><a href="#l138">138</a></td> <td class="vc_file_line_text"> long offset; /* offset from indirection */</td> </tr> <tr class="vc_row_odd" id="l139"> <td class="vc_file_line_number"><a href="#l139">139</a></td> <td class="vc_file_line_text"> } in;</td> </tr> <tr class="vc_row_odd" id="l140"> <td class="vc_file_line_number"><a href="#l140">140</a></td> <td class="vc_file_line_text"> long offset; /* offset to magic number */</td> </tr> <tr class="vc_row_odd" id="l141"> <td class="vc_file_line_number"><a href="#l141">141</a></td> <td class="vc_file_line_text"> unsigned char reln; /* relation (0=eq, &#39;&gt;&#39;=gt, etc) */</td> </tr> <tr class="vc_row_odd" id="l142"> <td class="vc_file_line_number"><a href="#l142">142</a></td> <td class="vc_file_line_text"> char type; /* int, short, long or string. */</td> </tr> <tr class="vc_row_odd" id="l143"> <td class="vc_file_line_number"><a href="#l143">143</a></td> <td class="vc_file_line_text"> char vallen; /* length of string value, if any */</td> </tr> <tr class="vc_row_odd" id="l144"> <td class="vc_file_line_number"><a href="#l144">144</a></td> <td class="vc_file_line_text">#define BYTE 1</td> </tr> <tr class="vc_row_odd" id="l145"> <td class="vc_file_line_number"><a href="#l145">145</a></td> <td class="vc_file_line_text">#define SHORT 2</td> </tr> <tr class="vc_row_odd" id="l146"> <td class="vc_file_line_number"><a href="#l146">146</a></td> <td class="vc_file_line_text">#define LONG 4</td> </tr> <tr class="vc_row_odd" id="l147"> <td class="vc_file_line_number"><a href="#l147">147</a></td> <td class="vc_file_line_text">#define STRING 5</td> </tr> <tr class="vc_row_odd" id="l148"> <td class="vc_file_line_number"><a href="#l148">148</a></td> <td class="vc_file_line_text">#define DATE 6</td> </tr> <tr class="vc_row_odd" id="l149"> <td class="vc_file_line_number"><a href="#l149">149</a></td> <td class="vc_file_line_text">#define BESHORT 7</td> </tr> <tr class="vc_row_odd" id="l150"> <td class="vc_file_line_number"><a href="#l150">150</a></td> <td class="vc_file_line_text">#define BELONG 8</td> </tr> <tr class="vc_row_odd" id="l151"> <td class="vc_file_line_number"><a href="#l151">151</a></td> <td class="vc_file_line_text">#define BEDATE 9</td> </tr> <tr class="vc_row_odd" id="l152"> <td class="vc_file_line_number"><a href="#l152">152</a></td> <td class="vc_file_line_text">#define LESHORT 10</td> </tr> <tr class="vc_row_odd" id="l153"> <td class="vc_file_line_number"><a href="#l153">153</a></td> <td class="vc_file_line_text">#define LELONG 11</td> </tr> <tr class="vc_row_odd" id="l154"> <td class="vc_file_line_number"><a href="#l154">154</a></td> <td class="vc_file_line_text">#define LEDATE 12</td> </tr> <tr class="vc_row_odd" id="l155"> <td class="vc_file_line_number"><a href="#l155">155</a></td> <td class="vc_file_line_text"> union VALUETYPE {</td> </tr> <tr class="vc_row_odd" id="l156"> <td class="vc_file_line_number"><a href="#l156">156</a></td> <td class="vc_file_line_text"> unsigned char b;</td> </tr> <tr class="vc_row_odd" id="l157"> <td class="vc_file_line_number"><a href="#l157">157</a></td> <td class="vc_file_line_text"> unsigned short h;</td> </tr> <tr class="vc_row_odd" id="l158"> <td class="vc_file_line_number"><a href="#l158">158</a></td> <td class="vc_file_line_text"> unsigned long l;</td> </tr> <tr class="vc_row_odd" id="l159"> <td class="vc_file_line_number"><a href="#l159">159</a></td> <td class="vc_file_line_text"> char s[MAXstring];</td> </tr> <tr class="vc_row_odd" id="l160"> <td class="vc_file_line_number"><a href="#l160">160</a></td> <td class="vc_file_line_text"> unsigned char hs[2]; /* 2 bytes of a fixed-endian &quot;short&quot; */</td> </tr> <tr class="vc_row_odd" id="l161"> <td class="vc_file_line_number"><a href="#l161">161</a></td> <td class="vc_file_line_text"> unsigned char hl[4]; /* 2 bytes of a fixed-endian &quot;long&quot; */</td> </tr> <tr class="vc_row_odd" id="l162"> <td class="vc_file_line_number"><a href="#l162">162</a></td> <td class="vc_file_line_text"> } value; /* either number or string */</td> </tr> <tr class="vc_row_odd" id="l163"> <td class="vc_file_line_number"><a href="#l163">163</a></td> <td class="vc_file_line_text"> unsigned long mask; /* mask before comparison with value */</td> </tr> <tr class="vc_row_odd" id="l164"> <td class="vc_file_line_number"><a href="#l164">164</a></td> <td class="vc_file_line_text"> char nospflag; /* suppress space character */</td> </tr> <tr class="vc_row_odd" id="l165"> <td class="vc_file_line_number"><a href="#l165">165</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l166"> <td class="vc_file_line_number"><a href="#l166">166</a></td> <td class="vc_file_line_text"> /* NOTE: this string is suspected of overrunning - find it! */</td> </tr> <tr class="vc_row_odd" id="l167"> <td class="vc_file_line_number"><a href="#l167">167</a></td> <td class="vc_file_line_text"> char desc[MAXDESC]; /* description */</td> </tr> <tr class="vc_row_odd" id="l168"> <td class="vc_file_line_number"><a href="#l168">168</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l169"> <td class="vc_file_line_number"><a href="#l169">169</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l170"> <td class="vc_file_line_number"><a href="#l170">170</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l171"> <td class="vc_file_line_number"><a href="#l171">171</a></td> <td class="vc_file_line_text"> * data structures for tar file recognition</td> </tr> <tr class="vc_row_odd" id="l172"> <td class="vc_file_line_number"><a href="#l172">172</a></td> <td class="vc_file_line_text"> * --------------------------------------------------------------------------</td> </tr> <tr class="vc_row_odd" id="l173"> <td class="vc_file_line_number"><a href="#l173">173</a></td> <td class="vc_file_line_text"> * Header file for public domain tar (tape archive) program.</td> </tr> <tr class="vc_row_odd" id="l174"> <td class="vc_file_line_number"><a href="#l174">174</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l175"> <td class="vc_file_line_number"><a href="#l175">175</a></td> <td class="vc_file_line_text"> * @(#)tar.h 1.20 86/10/29 Public Domain. Created 25 August 1985 by John</td> </tr> <tr class="vc_row_odd" id="l176"> <td class="vc_file_line_number"><a href="#l176">176</a></td> <td class="vc_file_line_text"> * Gilmore, ihnp4!hoptoad!gnu.</td> </tr> <tr class="vc_row_odd" id="l177"> <td class="vc_file_line_number"><a href="#l177">177</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l178"> <td class="vc_file_line_number"><a href="#l178">178</a></td> <td class="vc_file_line_text"> * Header block on tape.</td> </tr> <tr class="vc_row_odd" id="l179"> <td class="vc_file_line_number"><a href="#l179">179</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l180"> <td class="vc_file_line_number"><a href="#l180">180</a></td> <td class="vc_file_line_text"> * I&#39;m going to use traditional DP naming conventions here. A &quot;block&quot; is a big</td> </tr> <tr class="vc_row_odd" id="l181"> <td class="vc_file_line_number"><a href="#l181">181</a></td> <td class="vc_file_line_text"> * chunk of stuff that we do I/O on. A &quot;record&quot; is a piece of info that we</td> </tr> <tr class="vc_row_odd" id="l182"> <td class="vc_file_line_number"><a href="#l182">182</a></td> <td class="vc_file_line_text"> * care about. Typically many &quot;record&quot;s fit into a &quot;block&quot;.</td> </tr> <tr class="vc_row_odd" id="l183"> <td class="vc_file_line_number"><a href="#l183">183</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l184"> <td class="vc_file_line_number"><a href="#l184">184</a></td> <td class="vc_file_line_text">#define RECORDSIZE 512</td> </tr> <tr class="vc_row_odd" id="l185"> <td class="vc_file_line_number"><a href="#l185">185</a></td> <td class="vc_file_line_text">#define NAMSIZ 100</td> </tr> <tr class="vc_row_odd" id="l186"> <td class="vc_file_line_number"><a href="#l186">186</a></td> <td class="vc_file_line_text">#define TUNMLEN 32</td> </tr> <tr class="vc_row_odd" id="l187"> <td class="vc_file_line_number"><a href="#l187">187</a></td> <td class="vc_file_line_text">#define TGNMLEN 32</td> </tr> <tr class="vc_row_odd" id="l188"> <td class="vc_file_line_number"><a href="#l188">188</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l189"> <td class="vc_file_line_number"><a href="#l189">189</a></td> <td class="vc_file_line_text">union record {</td> </tr> <tr class="vc_row_odd" id="l190"> <td class="vc_file_line_number"><a href="#l190">190</a></td> <td class="vc_file_line_text"> char charptr[RECORDSIZE];</td> </tr> <tr class="vc_row_odd" id="l191"> <td class="vc_file_line_number"><a href="#l191">191</a></td> <td class="vc_file_line_text"> struct header {</td> </tr> <tr class="vc_row_odd" id="l192"> <td class="vc_file_line_number"><a href="#l192">192</a></td> <td class="vc_file_line_text"> char name[NAMSIZ];</td> </tr> <tr class="vc_row_odd" id="l193"> <td class="vc_file_line_number"><a href="#l193">193</a></td> <td class="vc_file_line_text"> char mode[8];</td> </tr> <tr class="vc_row_odd" id="l194"> <td class="vc_file_line_number"><a href="#l194">194</a></td> <td class="vc_file_line_text"> char uid[8];</td> </tr> <tr class="vc_row_odd" id="l195"> <td class="vc_file_line_number"><a href="#l195">195</a></td> <td class="vc_file_line_text"> char gid[8];</td> </tr> <tr class="vc_row_odd" id="l196"> <td class="vc_file_line_number"><a href="#l196">196</a></td> <td class="vc_file_line_text"> char size[12];</td> </tr> <tr class="vc_row_odd" id="l197"> <td class="vc_file_line_number"><a href="#l197">197</a></td> <td class="vc_file_line_text"> char mtime[12];</td> </tr> <tr class="vc_row_odd" id="l198"> <td class="vc_file_line_number"><a href="#l198">198</a></td> <td class="vc_file_line_text"> char chksum[8];</td> </tr> <tr class="vc_row_odd" id="l199"> <td class="vc_file_line_number"><a href="#l199">199</a></td> <td class="vc_file_line_text"> char linkflag;</td> </tr> <tr class="vc_row_odd" id="l200"> <td class="vc_file_line_number"><a href="#l200">200</a></td> <td class="vc_file_line_text"> char linkname[NAMSIZ];</td> </tr> <tr class="vc_row_odd" id="l201"> <td class="vc_file_line_number"><a href="#l201">201</a></td> <td class="vc_file_line_text"> char magic[8];</td> </tr> <tr class="vc_row_odd" id="l202"> <td class="vc_file_line_number"><a href="#l202">202</a></td> <td class="vc_file_line_text"> char uname[TUNMLEN];</td> </tr> <tr class="vc_row_odd" id="l203"> <td class="vc_file_line_number"><a href="#l203">203</a></td> <td class="vc_file_line_text"> char gname[TGNMLEN];</td> </tr> <tr class="vc_row_odd" id="l204"> <td class="vc_file_line_number"><a href="#l204">204</a></td> <td class="vc_file_line_text"> char devmajor[8];</td> </tr> <tr class="vc_row_odd" id="l205"> <td class="vc_file_line_number"><a href="#l205">205</a></td> <td class="vc_file_line_text"> char devminor[8];</td> </tr> <tr class="vc_row_odd" id="l206"> <td class="vc_file_line_number"><a href="#l206">206</a></td> <td class="vc_file_line_text"> } header;</td> </tr> <tr class="vc_row_odd" id="l207"> <td class="vc_file_line_number"><a href="#l207">207</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l208"> <td class="vc_file_line_number"><a href="#l208">208</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l209"> <td class="vc_file_line_number"><a href="#l209">209</a></td> <td class="vc_file_line_text">/* The magic field is filled with this if uname and gname are valid. */</td> </tr> <tr class="vc_row_odd" id="l210"> <td class="vc_file_line_number"><a href="#l210">210</a></td> <td class="vc_file_line_text">#define TMAGIC &quot;ustar &quot; /* 7 chars and a null */</td> </tr> <tr class="vc_row_odd" id="l211"> <td class="vc_file_line_number"><a href="#l211">211</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l212"> <td class="vc_file_line_number"><a href="#l212">212</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l213"> <td class="vc_file_line_number"><a href="#l213">213</a></td> <td class="vc_file_line_text"> * file-function prototypes</td> </tr> <tr class="vc_row_odd" id="l214"> <td class="vc_file_line_number"><a href="#l214">214</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l215"> <td class="vc_file_line_number"><a href="#l215">215</a></td> <td class="vc_file_line_text">static int ascmagic(request_rec *, unsigned char *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l216"> <td class="vc_file_line_number"><a href="#l216">216</a></td> <td class="vc_file_line_text">static int is_tar(unsigned char *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l217"> <td class="vc_file_line_number"><a href="#l217">217</a></td> <td class="vc_file_line_text">static int softmagic(request_rec *, unsigned char *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l218"> <td class="vc_file_line_number"><a href="#l218">218</a></td> <td class="vc_file_line_text">static int tryit(request_rec *, unsigned char *, apr_size_t, int);</td> </tr> <tr class="vc_row_odd" id="l219"> <td class="vc_file_line_number"><a href="#l219">219</a></td> <td class="vc_file_line_text">static int zmagic(request_rec *, unsigned char *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l220"> <td class="vc_file_line_number"><a href="#l220">220</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l221"> <td class="vc_file_line_number"><a href="#l221">221</a></td> <td class="vc_file_line_text">static int getvalue(server_rec *, struct magic *, char **);</td> </tr> <tr class="vc_row_odd" id="l222"> <td class="vc_file_line_number"><a href="#l222">222</a></td> <td class="vc_file_line_text">static int hextoint(int);</td> </tr> <tr class="vc_row_odd" id="l223"> <td class="vc_file_line_number"><a href="#l223">223</a></td> <td class="vc_file_line_text">static char *getstr(server_rec *, char *, char *, int, int *);</td> </tr> <tr class="vc_row_odd" id="l224"> <td class="vc_file_line_number"><a href="#l224">224</a></td> <td class="vc_file_line_text">static int parse(server_rec *, apr_pool_t *p, char *, int);</td> </tr> <tr class="vc_row_odd" id="l225"> <td class="vc_file_line_number"><a href="#l225">225</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l226"> <td class="vc_file_line_number"><a href="#l226">226</a></td> <td class="vc_file_line_text">static int match(request_rec *, unsigned char *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l227"> <td class="vc_file_line_number"><a href="#l227">227</a></td> <td class="vc_file_line_text">static int mget(request_rec *, union VALUETYPE *, unsigned char *,</td> </tr> <tr class="vc_row_odd" id="l228"> <td class="vc_file_line_number"><a href="#l228">228</a></td> <td class="vc_file_line_text"> struct magic *, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l229"> <td class="vc_file_line_number"><a href="#l229">229</a></td> <td class="vc_file_line_text">static int mcheck(request_rec *, union VALUETYPE *, struct magic *);</td> </tr> <tr class="vc_row_odd" id="l230"> <td class="vc_file_line_number"><a href="#l230">230</a></td> <td class="vc_file_line_text">static void mprint(request_rec *, union VALUETYPE *, struct magic *);</td> </tr> <tr class="vc_row_odd" id="l231"> <td class="vc_file_line_number"><a href="#l231">231</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l232"> <td class="vc_file_line_number"><a href="#l232">232</a></td> <td class="vc_file_line_text">static int uncompress(request_rec *, int,</td> </tr> <tr class="vc_row_odd" id="l233"> <td class="vc_file_line_number"><a href="#l233">233</a></td> <td class="vc_file_line_text"> unsigned char **, apr_size_t);</td> </tr> <tr class="vc_row_odd" id="l234"> <td class="vc_file_line_number"><a href="#l234">234</a></td> <td class="vc_file_line_text">static long from_oct(int, char *);</td> </tr> <tr class="vc_row_odd" id="l235"> <td class="vc_file_line_number"><a href="#l235">235</a></td> <td class="vc_file_line_text">static int fsmagic(request_rec *r, const char *fn);</td> </tr> <tr class="vc_row_odd" id="l236"> <td class="vc_file_line_number"><a href="#l236">236</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l237"> <td class="vc_file_line_number"><a href="#l237">237</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l238"> <td class="vc_file_line_number"><a href="#l238">238</a></td> <td class="vc_file_line_text"> * includes for ASCII substring recognition formerly &quot;names.h&quot; in file</td> </tr> <tr class="vc_row_odd" id="l239"> <td class="vc_file_line_number"><a href="#l239">239</a></td> <td class="vc_file_line_text"> * command</td> </tr> <tr class="vc_row_odd" id="l240"> <td class="vc_file_line_number"><a href="#l240">240</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l241"> <td class="vc_file_line_number"><a href="#l241">241</a></td> <td class="vc_file_line_text"> * Original notes: names and types used by ascmagic in file(1). These tokens are</td> </tr> <tr class="vc_row_odd" id="l242"> <td class="vc_file_line_number"><a href="#l242">242</a></td> <td class="vc_file_line_text"> * here because they can appear anywhere in the first HOWMANY bytes, while</td> </tr> <tr class="vc_row_odd" id="l243"> <td class="vc_file_line_number"><a href="#l243">243</a></td> <td class="vc_file_line_text"> * tokens in /etc/magic must appear at fixed offsets into the file. Don&#39;t</td> </tr> <tr class="vc_row_odd" id="l244"> <td class="vc_file_line_number"><a href="#l244">244</a></td> <td class="vc_file_line_text"> * make HOWMANY too high unless you have a very fast CPU.</td> </tr> <tr class="vc_row_odd" id="l245"> <td class="vc_file_line_number"><a href="#l245">245</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l246"> <td class="vc_file_line_number"><a href="#l246">246</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l247"> <td class="vc_file_line_number"><a href="#l247">247</a></td> <td class="vc_file_line_text">/* these types are used to index the apr_table_t &#39;types&#39;: keep em in sync! */</td> </tr> <tr class="vc_row_odd" id="l248"> <td class="vc_file_line_number"><a href="#l248">248</a></td> <td class="vc_file_line_text">/* HTML inserted in first because this is a web server module now */</td> </tr> <tr class="vc_row_odd" id="l249"> <td class="vc_file_line_number"><a href="#l249">249</a></td> <td class="vc_file_line_text">#define L_HTML 0 /* HTML */</td> </tr> <tr class="vc_row_odd" id="l250"> <td class="vc_file_line_number"><a href="#l250">250</a></td> <td class="vc_file_line_text">#define L_C 1 /* first and foremost on UNIX */</td> </tr> <tr class="vc_row_odd" id="l251"> <td class="vc_file_line_number"><a href="#l251">251</a></td> <td class="vc_file_line_text">#define L_FORT 2 /* the oldest one */</td> </tr> <tr class="vc_row_odd" id="l252"> <td class="vc_file_line_number"><a href="#l252">252</a></td> <td class="vc_file_line_text">#define L_MAKE 3 /* Makefiles */</td> </tr> <tr class="vc_row_odd" id="l253"> <td class="vc_file_line_number"><a href="#l253">253</a></td> <td class="vc_file_line_text">#define L_PLI 4 /* PL/1 */</td> </tr> <tr class="vc_row_odd" id="l254"> <td class="vc_file_line_number"><a href="#l254">254</a></td> <td class="vc_file_line_text">#define L_MACH 5 /* some kinda assembler */</td> </tr> <tr class="vc_row_odd" id="l255"> <td class="vc_file_line_number"><a href="#l255">255</a></td> <td class="vc_file_line_text">#define L_ENG 6 /* English */</td> </tr> <tr class="vc_row_odd" id="l256"> <td class="vc_file_line_number"><a href="#l256">256</a></td> <td class="vc_file_line_text">#define L_PAS 7 /* Pascal */</td> </tr> <tr class="vc_row_odd" id="l257"> <td class="vc_file_line_number"><a href="#l257">257</a></td> <td class="vc_file_line_text">#define L_MAIL 8 /* Electronic mail */</td> </tr> <tr class="vc_row_odd" id="l258"> <td class="vc_file_line_number"><a href="#l258">258</a></td> <td class="vc_file_line_text">#define L_NEWS 9 /* Usenet Netnews */</td> </tr> <tr class="vc_row_odd" id="l259"> <td class="vc_file_line_number"><a href="#l259">259</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l260"> <td class="vc_file_line_number"><a href="#l260">260</a></td> <td class="vc_file_line_text">static const char *const types[] =</td> </tr> <tr class="vc_row_odd" id="l261"> <td class="vc_file_line_number"><a href="#l261">261</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l262"> <td class="vc_file_line_number"><a href="#l262">262</a></td> <td class="vc_file_line_text"> &quot;text/html&quot;, /* HTML */</td> </tr> <tr class="vc_row_odd" id="l263"> <td class="vc_file_line_number"><a href="#l263">263</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;c program text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l264"> <td class="vc_file_line_number"><a href="#l264">264</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;fortran program text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l265"> <td class="vc_file_line_number"><a href="#l265">265</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;make commands text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l266"> <td class="vc_file_line_number"><a href="#l266">266</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;pl/1 program text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l267"> <td class="vc_file_line_number"><a href="#l267">267</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;assembler program text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l268"> <td class="vc_file_line_number"><a href="#l268">268</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;English text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l269"> <td class="vc_file_line_number"><a href="#l269">269</a></td> <td class="vc_file_line_text"> &quot;text/plain&quot;, /* &quot;pascal program text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l270"> <td class="vc_file_line_number"><a href="#l270">270</a></td> <td class="vc_file_line_text"> &quot;message/rfc822&quot;, /* &quot;mail text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l271"> <td class="vc_file_line_number"><a href="#l271">271</a></td> <td class="vc_file_line_text"> &quot;message/news&quot;, /* &quot;news text&quot;, */</td> </tr> <tr class="vc_row_odd" id="l272"> <td class="vc_file_line_number"><a href="#l272">272</a></td> <td class="vc_file_line_text"> &quot;application/binary&quot;, /* &quot;can&#39;t happen error on names.h/types&quot;, */</td> </tr> <tr class="vc_row_odd" id="l273"> <td class="vc_file_line_number"><a href="#l273">273</a></td> <td class="vc_file_line_text"> 0</td> </tr> <tr class="vc_row_odd" id="l274"> <td class="vc_file_line_number"><a href="#l274">274</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l275"> <td class="vc_file_line_number"><a href="#l275">275</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l276"> <td class="vc_file_line_number"><a href="#l276">276</a></td> <td class="vc_file_line_text">static const struct names {</td> </tr> <tr class="vc_row_odd" id="l277"> <td class="vc_file_line_number"><a href="#l277">277</a></td> <td class="vc_file_line_text"> const char *name;</td> </tr> <tr class="vc_row_odd" id="l278"> <td class="vc_file_line_number"><a href="#l278">278</a></td> <td class="vc_file_line_text"> short type;</td> </tr> <tr class="vc_row_odd" id="l279"> <td class="vc_file_line_number"><a href="#l279">279</a></td> <td class="vc_file_line_text">} names[] = {</td> </tr> <tr class="vc_row_odd" id="l280"> <td class="vc_file_line_number"><a href="#l280">280</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l281"> <td class="vc_file_line_number"><a href="#l281">281</a></td> <td class="vc_file_line_text"> /* These must be sorted by eye for optimal hit rate */</td> </tr> <tr class="vc_row_odd" id="l282"> <td class="vc_file_line_number"><a href="#l282">282</a></td> <td class="vc_file_line_text"> /* Add to this list only after substantial meditation */</td> </tr> <tr class="vc_row_odd" id="l283"> <td class="vc_file_line_number"><a href="#l283">283</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l284"> <td class="vc_file_line_number"><a href="#l284">284</a></td> <td class="vc_file_line_text"> &quot;&lt;html&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l285"> <td class="vc_file_line_number"><a href="#l285">285</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l286"> <td class="vc_file_line_number"><a href="#l286">286</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l287"> <td class="vc_file_line_number"><a href="#l287">287</a></td> <td class="vc_file_line_text"> &quot;&lt;HTML&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l288"> <td class="vc_file_line_number"><a href="#l288">288</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l289"> <td class="vc_file_line_number"><a href="#l289">289</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l290"> <td class="vc_file_line_number"><a href="#l290">290</a></td> <td class="vc_file_line_text"> &quot;&lt;head&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l291"> <td class="vc_file_line_number"><a href="#l291">291</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l292"> <td class="vc_file_line_number"><a href="#l292">292</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l293"> <td class="vc_file_line_number"><a href="#l293">293</a></td> <td class="vc_file_line_text"> &quot;&lt;HEAD&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l294"> <td class="vc_file_line_number"><a href="#l294">294</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l295"> <td class="vc_file_line_number"><a href="#l295">295</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l296"> <td class="vc_file_line_number"><a href="#l296">296</a></td> <td class="vc_file_line_text"> &quot;&lt;title&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l297"> <td class="vc_file_line_number"><a href="#l297">297</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l298"> <td class="vc_file_line_number"><a href="#l298">298</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l299"> <td class="vc_file_line_number"><a href="#l299">299</a></td> <td class="vc_file_line_text"> &quot;&lt;TITLE&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l300"> <td class="vc_file_line_number"><a href="#l300">300</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l301"> <td class="vc_file_line_number"><a href="#l301">301</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l302"> <td class="vc_file_line_number"><a href="#l302">302</a></td> <td class="vc_file_line_text"> &quot;&lt;h1&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l303"> <td class="vc_file_line_number"><a href="#l303">303</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l304"> <td class="vc_file_line_number"><a href="#l304">304</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l305"> <td class="vc_file_line_number"><a href="#l305">305</a></td> <td class="vc_file_line_text"> &quot;&lt;H1&gt;&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l306"> <td class="vc_file_line_number"><a href="#l306">306</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l307"> <td class="vc_file_line_number"><a href="#l307">307</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l308"> <td class="vc_file_line_number"><a href="#l308">308</a></td> <td class="vc_file_line_text"> &quot;&lt;!--&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l309"> <td class="vc_file_line_number"><a href="#l309">309</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l310"> <td class="vc_file_line_number"><a href="#l310">310</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l311"> <td class="vc_file_line_number"><a href="#l311">311</a></td> <td class="vc_file_line_text"> &quot;&lt;!DOCTYPE HTML&quot;, L_HTML</td> </tr> <tr class="vc_row_odd" id="l312"> <td class="vc_file_line_number"><a href="#l312">312</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l313"> <td class="vc_file_line_number"><a href="#l313">313</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l314"> <td class="vc_file_line_number"><a href="#l314">314</a></td> <td class="vc_file_line_text"> &quot;/*&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l315"> <td class="vc_file_line_number"><a href="#l315">315</a></td> <td class="vc_file_line_text"> }, /* must precede &quot;The&quot;, &quot;the&quot;, etc. */</td> </tr> <tr class="vc_row_odd" id="l316"> <td class="vc_file_line_number"><a href="#l316">316</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l317"> <td class="vc_file_line_number"><a href="#l317">317</a></td> <td class="vc_file_line_text"> &quot;#include&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l318"> <td class="vc_file_line_number"><a href="#l318">318</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l319"> <td class="vc_file_line_number"><a href="#l319">319</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l320"> <td class="vc_file_line_number"><a href="#l320">320</a></td> <td class="vc_file_line_text"> &quot;char&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l321"> <td class="vc_file_line_number"><a href="#l321">321</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l322"> <td class="vc_file_line_number"><a href="#l322">322</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l323"> <td class="vc_file_line_number"><a href="#l323">323</a></td> <td class="vc_file_line_text"> &quot;The&quot;, L_ENG</td> </tr> <tr class="vc_row_odd" id="l324"> <td class="vc_file_line_number"><a href="#l324">324</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l325"> <td class="vc_file_line_number"><a href="#l325">325</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l326"> <td class="vc_file_line_number"><a href="#l326">326</a></td> <td class="vc_file_line_text"> &quot;the&quot;, L_ENG</td> </tr> <tr class="vc_row_odd" id="l327"> <td class="vc_file_line_number"><a href="#l327">327</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l328"> <td class="vc_file_line_number"><a href="#l328">328</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l329"> <td class="vc_file_line_number"><a href="#l329">329</a></td> <td class="vc_file_line_text"> &quot;double&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l330"> <td class="vc_file_line_number"><a href="#l330">330</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l331"> <td class="vc_file_line_number"><a href="#l331">331</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l332"> <td class="vc_file_line_number"><a href="#l332">332</a></td> <td class="vc_file_line_text"> &quot;extern&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l333"> <td class="vc_file_line_number"><a href="#l333">333</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l334"> <td class="vc_file_line_number"><a href="#l334">334</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l335"> <td class="vc_file_line_number"><a href="#l335">335</a></td> <td class="vc_file_line_text"> &quot;float&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l336"> <td class="vc_file_line_number"><a href="#l336">336</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l337"> <td class="vc_file_line_number"><a href="#l337">337</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l338"> <td class="vc_file_line_number"><a href="#l338">338</a></td> <td class="vc_file_line_text"> &quot;real&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l339"> <td class="vc_file_line_number"><a href="#l339">339</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l340"> <td class="vc_file_line_number"><a href="#l340">340</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l341"> <td class="vc_file_line_number"><a href="#l341">341</a></td> <td class="vc_file_line_text"> &quot;struct&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l342"> <td class="vc_file_line_number"><a href="#l342">342</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l343"> <td class="vc_file_line_number"><a href="#l343">343</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l344"> <td class="vc_file_line_number"><a href="#l344">344</a></td> <td class="vc_file_line_text"> &quot;union&quot;, L_C</td> </tr> <tr class="vc_row_odd" id="l345"> <td class="vc_file_line_number"><a href="#l345">345</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l346"> <td class="vc_file_line_number"><a href="#l346">346</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l347"> <td class="vc_file_line_number"><a href="#l347">347</a></td> <td class="vc_file_line_text"> &quot;CFLAGS&quot;, L_MAKE</td> </tr> <tr class="vc_row_odd" id="l348"> <td class="vc_file_line_number"><a href="#l348">348</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l349"> <td class="vc_file_line_number"><a href="#l349">349</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l350"> <td class="vc_file_line_number"><a href="#l350">350</a></td> <td class="vc_file_line_text"> &quot;LDFLAGS&quot;, L_MAKE</td> </tr> <tr class="vc_row_odd" id="l351"> <td class="vc_file_line_number"><a href="#l351">351</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l352"> <td class="vc_file_line_number"><a href="#l352">352</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l353"> <td class="vc_file_line_number"><a href="#l353">353</a></td> <td class="vc_file_line_text"> &quot;all:&quot;, L_MAKE</td> </tr> <tr class="vc_row_odd" id="l354"> <td class="vc_file_line_number"><a href="#l354">354</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l355"> <td class="vc_file_line_number"><a href="#l355">355</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l356"> <td class="vc_file_line_number"><a href="#l356">356</a></td> <td class="vc_file_line_text"> &quot;.PRECIOUS&quot;, L_MAKE</td> </tr> <tr class="vc_row_odd" id="l357"> <td class="vc_file_line_number"><a href="#l357">357</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l358"> <td class="vc_file_line_number"><a href="#l358">358</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l359"> <td class="vc_file_line_number"><a href="#l359">359</a></td> <td class="vc_file_line_text"> * Too many files of text have these words in them. Find another way to</td> </tr> <tr class="vc_row_odd" id="l360"> <td class="vc_file_line_number"><a href="#l360">360</a></td> <td class="vc_file_line_text"> * recognize Fortrash.</td> </tr> <tr class="vc_row_odd" id="l361"> <td class="vc_file_line_number"><a href="#l361">361</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l362"> <td class="vc_file_line_number"><a href="#l362">362</a></td> <td class="vc_file_line_text">#ifdef NOTDEF</td> </tr> <tr class="vc_row_odd" id="l363"> <td class="vc_file_line_number"><a href="#l363">363</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l364"> <td class="vc_file_line_number"><a href="#l364">364</a></td> <td class="vc_file_line_text"> &quot;subroutine&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l365"> <td class="vc_file_line_number"><a href="#l365">365</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l366"> <td class="vc_file_line_number"><a href="#l366">366</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l367"> <td class="vc_file_line_number"><a href="#l367">367</a></td> <td class="vc_file_line_text"> &quot;function&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l368"> <td class="vc_file_line_number"><a href="#l368">368</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l369"> <td class="vc_file_line_number"><a href="#l369">369</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l370"> <td class="vc_file_line_number"><a href="#l370">370</a></td> <td class="vc_file_line_text"> &quot;block&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l371"> <td class="vc_file_line_number"><a href="#l371">371</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l372"> <td class="vc_file_line_number"><a href="#l372">372</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l373"> <td class="vc_file_line_number"><a href="#l373">373</a></td> <td class="vc_file_line_text"> &quot;common&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l374"> <td class="vc_file_line_number"><a href="#l374">374</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l375"> <td class="vc_file_line_number"><a href="#l375">375</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l376"> <td class="vc_file_line_number"><a href="#l376">376</a></td> <td class="vc_file_line_text"> &quot;dimension&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l377"> <td class="vc_file_line_number"><a href="#l377">377</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l378"> <td class="vc_file_line_number"><a href="#l378">378</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l379"> <td class="vc_file_line_number"><a href="#l379">379</a></td> <td class="vc_file_line_text"> &quot;integer&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l380"> <td class="vc_file_line_number"><a href="#l380">380</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l381"> <td class="vc_file_line_number"><a href="#l381">381</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l382"> <td class="vc_file_line_number"><a href="#l382">382</a></td> <td class="vc_file_line_text"> &quot;data&quot;, L_FORT</td> </tr> <tr class="vc_row_odd" id="l383"> <td class="vc_file_line_number"><a href="#l383">383</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l384"> <td class="vc_file_line_number"><a href="#l384">384</a></td> <td class="vc_file_line_text">#endif /* NOTDEF */</td> </tr> <tr class="vc_row_odd" id="l385"> <td class="vc_file_line_number"><a href="#l385">385</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l386"> <td class="vc_file_line_number"><a href="#l386">386</a></td> <td class="vc_file_line_text"> &quot;.ascii&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l387"> <td class="vc_file_line_number"><a href="#l387">387</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l388"> <td class="vc_file_line_number"><a href="#l388">388</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l389"> <td class="vc_file_line_number"><a href="#l389">389</a></td> <td class="vc_file_line_text"> &quot;.asciiz&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l390"> <td class="vc_file_line_number"><a href="#l390">390</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l391"> <td class="vc_file_line_number"><a href="#l391">391</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l392"> <td class="vc_file_line_number"><a href="#l392">392</a></td> <td class="vc_file_line_text"> &quot;.byte&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l393"> <td class="vc_file_line_number"><a href="#l393">393</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l394"> <td class="vc_file_line_number"><a href="#l394">394</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l395"> <td class="vc_file_line_number"><a href="#l395">395</a></td> <td class="vc_file_line_text"> &quot;.even&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l396"> <td class="vc_file_line_number"><a href="#l396">396</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l397"> <td class="vc_file_line_number"><a href="#l397">397</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l398"> <td class="vc_file_line_number"><a href="#l398">398</a></td> <td class="vc_file_line_text"> &quot;.globl&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l399"> <td class="vc_file_line_number"><a href="#l399">399</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l400"> <td class="vc_file_line_number"><a href="#l400">400</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l401"> <td class="vc_file_line_number"><a href="#l401">401</a></td> <td class="vc_file_line_text"> &quot;clr&quot;, L_MACH</td> </tr> <tr class="vc_row_odd" id="l402"> <td class="vc_file_line_number"><a href="#l402">402</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l403"> <td class="vc_file_line_number"><a href="#l403">403</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l404"> <td class="vc_file_line_number"><a href="#l404">404</a></td> <td class="vc_file_line_text"> &quot;(input,&quot;, L_PAS</td> </tr> <tr class="vc_row_odd" id="l405"> <td class="vc_file_line_number"><a href="#l405">405</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l406"> <td class="vc_file_line_number"><a href="#l406">406</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l407"> <td class="vc_file_line_number"><a href="#l407">407</a></td> <td class="vc_file_line_text"> &quot;dcl&quot;, L_PLI</td> </tr> <tr class="vc_row_odd" id="l408"> <td class="vc_file_line_number"><a href="#l408">408</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l409"> <td class="vc_file_line_number"><a href="#l409">409</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l410"> <td class="vc_file_line_number"><a href="#l410">410</a></td> <td class="vc_file_line_text"> &quot;Received:&quot;, L_MAIL</td> </tr> <tr class="vc_row_odd" id="l411"> <td class="vc_file_line_number"><a href="#l411">411</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l412"> <td class="vc_file_line_number"><a href="#l412">412</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l413"> <td class="vc_file_line_number"><a href="#l413">413</a></td> <td class="vc_file_line_text"> &quot;&gt;From&quot;, L_MAIL</td> </tr> <tr class="vc_row_odd" id="l414"> <td class="vc_file_line_number"><a href="#l414">414</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l415"> <td class="vc_file_line_number"><a href="#l415">415</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l416"> <td class="vc_file_line_number"><a href="#l416">416</a></td> <td class="vc_file_line_text"> &quot;Return-Path:&quot;, L_MAIL</td> </tr> <tr class="vc_row_odd" id="l417"> <td class="vc_file_line_number"><a href="#l417">417</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l418"> <td class="vc_file_line_number"><a href="#l418">418</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l419"> <td class="vc_file_line_number"><a href="#l419">419</a></td> <td class="vc_file_line_text"> &quot;Cc:&quot;, L_MAIL</td> </tr> <tr class="vc_row_odd" id="l420"> <td class="vc_file_line_number"><a href="#l420">420</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l421"> <td class="vc_file_line_number"><a href="#l421">421</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l422"> <td class="vc_file_line_number"><a href="#l422">422</a></td> <td class="vc_file_line_text"> &quot;Newsgroups:&quot;, L_NEWS</td> </tr> <tr class="vc_row_odd" id="l423"> <td class="vc_file_line_number"><a href="#l423">423</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l424"> <td class="vc_file_line_number"><a href="#l424">424</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l425"> <td class="vc_file_line_number"><a href="#l425">425</a></td> <td class="vc_file_line_text"> &quot;Path:&quot;, L_NEWS</td> </tr> <tr class="vc_row_odd" id="l426"> <td class="vc_file_line_number"><a href="#l426">426</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l427"> <td class="vc_file_line_number"><a href="#l427">427</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l428"> <td class="vc_file_line_number"><a href="#l428">428</a></td> <td class="vc_file_line_text"> &quot;Organization:&quot;, L_NEWS</td> </tr> <tr class="vc_row_odd" id="l429"> <td class="vc_file_line_number"><a href="#l429">429</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l430"> <td class="vc_file_line_number"><a href="#l430">430</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l431"> <td class="vc_file_line_number"><a href="#l431">431</a></td> <td class="vc_file_line_text"> NULL, 0</td> </tr> <tr class="vc_row_odd" id="l432"> <td class="vc_file_line_number"><a href="#l432">432</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l433"> <td class="vc_file_line_number"><a href="#l433">433</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l434"> <td class="vc_file_line_number"><a href="#l434">434</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l435"> <td class="vc_file_line_number"><a href="#l435">435</a></td> <td class="vc_file_line_text">#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1)</td> </tr> <tr class="vc_row_odd" id="l436"> <td class="vc_file_line_number"><a href="#l436">436</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l437"> <td class="vc_file_line_number"><a href="#l437">437</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l438"> <td class="vc_file_line_number"><a href="#l438">438</a></td> <td class="vc_file_line_text"> * Result String List (RSL)</td> </tr> <tr class="vc_row_odd" id="l439"> <td class="vc_file_line_number"><a href="#l439">439</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l440"> <td class="vc_file_line_number"><a href="#l440">440</a></td> <td class="vc_file_line_text"> * The file(1) command prints its output. Instead, we store the various</td> </tr> <tr class="vc_row_odd" id="l441"> <td class="vc_file_line_number"><a href="#l441">441</a></td> <td class="vc_file_line_text"> * &quot;printed&quot; strings in a list (allocating memory as we go) and concatenate</td> </tr> <tr class="vc_row_odd" id="l442"> <td class="vc_file_line_number"><a href="#l442">442</a></td> <td class="vc_file_line_text"> * them at the end when we finally know how much space they&#39;ll need.</td> </tr> <tr class="vc_row_odd" id="l443"> <td class="vc_file_line_number"><a href="#l443">443</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l444"> <td class="vc_file_line_number"><a href="#l444">444</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l445"> <td class="vc_file_line_number"><a href="#l445">445</a></td> <td class="vc_file_line_text">typedef struct magic_rsl_s {</td> </tr> <tr class="vc_row_odd" id="l446"> <td class="vc_file_line_number"><a href="#l446">446</a></td> <td class="vc_file_line_text"> const char *str; /* string, possibly a fragment */</td> </tr> <tr class="vc_row_odd" id="l447"> <td class="vc_file_line_number"><a href="#l447">447</a></td> <td class="vc_file_line_text"> struct magic_rsl_s *next; /* pointer to next fragment */</td> </tr> <tr class="vc_row_odd" id="l448"> <td class="vc_file_line_number"><a href="#l448">448</a></td> <td class="vc_file_line_text">} magic_rsl;</td> </tr> <tr class="vc_row_odd" id="l449"> <td class="vc_file_line_number"><a href="#l449">449</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l450"> <td class="vc_file_line_number"><a href="#l450">450</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l451"> <td class="vc_file_line_number"><a href="#l451">451</a></td> <td class="vc_file_line_text"> * Apache module configuration structures</td> </tr> <tr class="vc_row_odd" id="l452"> <td class="vc_file_line_number"><a href="#l452">452</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l453"> <td class="vc_file_line_number"><a href="#l453">453</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l454"> <td class="vc_file_line_number"><a href="#l454">454</a></td> <td class="vc_file_line_text">/* per-server info */</td> </tr> <tr class="vc_row_odd" id="l455"> <td class="vc_file_line_number"><a href="#l455">455</a></td> <td class="vc_file_line_text">typedef struct {</td> </tr> <tr class="vc_row_odd" id="l456"> <td class="vc_file_line_number"><a href="#l456">456</a></td> <td class="vc_file_line_text"> const char *magicfile; /* where magic be found */</td> </tr> <tr class="vc_row_odd" id="l457"> <td class="vc_file_line_number"><a href="#l457">457</a></td> <td class="vc_file_line_text"> struct magic *magic; /* head of magic config list */</td> </tr> <tr class="vc_row_odd" id="l458"> <td class="vc_file_line_number"><a href="#l458">458</a></td> <td class="vc_file_line_text"> struct magic *last;</td> </tr> <tr class="vc_row_odd" id="l459"> <td class="vc_file_line_number"><a href="#l459">459</a></td> <td class="vc_file_line_text">} magic_server_config_rec;</td> </tr> <tr class="vc_row_odd" id="l460"> <td class="vc_file_line_number"><a href="#l460">460</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l461"> <td class="vc_file_line_number"><a href="#l461">461</a></td> <td class="vc_file_line_text">/* per-request info */</td> </tr> <tr class="vc_row_odd" id="l462"> <td class="vc_file_line_number"><a href="#l462">462</a></td> <td class="vc_file_line_text">typedef struct {</td> </tr> <tr class="vc_row_odd" id="l463"> <td class="vc_file_line_number"><a href="#l463">463</a></td> <td class="vc_file_line_text"> magic_rsl *head; /* result string list */</td> </tr> <tr class="vc_row_odd" id="l464"> <td class="vc_file_line_number"><a href="#l464">464</a></td> <td class="vc_file_line_text"> magic_rsl *tail;</td> </tr> <tr class="vc_row_odd" id="l465"> <td class="vc_file_line_number"><a href="#l465">465</a></td> <td class="vc_file_line_text">} magic_req_rec;</td> </tr> <tr class="vc_row_odd" id="l466"> <td class="vc_file_line_number"><a href="#l466">466</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l467"> <td class="vc_file_line_number"><a href="#l467">467</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l468"> <td class="vc_file_line_number"><a href="#l468">468</a></td> <td class="vc_file_line_text"> * configuration functions - called by Apache API routines</td> </tr> <tr class="vc_row_odd" id="l469"> <td class="vc_file_line_number"><a href="#l469">469</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l470"> <td class="vc_file_line_number"><a href="#l470">470</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l471"> <td class="vc_file_line_number"><a href="#l471">471</a></td> <td class="vc_file_line_text">module AP_MODULE_DECLARE_DATA mime_magic_module;</td> </tr> <tr class="vc_row_odd" id="l472"> <td class="vc_file_line_number"><a href="#l472">472</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l473"> <td class="vc_file_line_number"><a href="#l473">473</a></td> <td class="vc_file_line_text">static void *create_magic_server_config(apr_pool_t *p, server_rec *d)</td> </tr> <tr class="vc_row_odd" id="l474"> <td class="vc_file_line_number"><a href="#l474">474</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l475"> <td class="vc_file_line_number"><a href="#l475">475</a></td> <td class="vc_file_line_text"> /* allocate the config - use pcalloc because it needs to be zeroed */</td> </tr> <tr class="vc_row_odd" id="l476"> <td class="vc_file_line_number"><a href="#l476">476</a></td> <td class="vc_file_line_text"> return apr_pcalloc(p, sizeof(magic_server_config_rec));</td> </tr> <tr class="vc_row_odd" id="l477"> <td class="vc_file_line_number"><a href="#l477">477</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l478"> <td class="vc_file_line_number"><a href="#l478">478</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l479"> <td class="vc_file_line_number"><a href="#l479">479</a></td> <td class="vc_file_line_text">static void *merge_magic_server_config(apr_pool_t *p, void *basev, void *addv)</td> </tr> <tr class="vc_row_odd" id="l480"> <td class="vc_file_line_number"><a href="#l480">480</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l481"> <td class="vc_file_line_number"><a href="#l481">481</a></td> <td class="vc_file_line_text"> magic_server_config_rec *base = (magic_server_config_rec *) basev;</td> </tr> <tr class="vc_row_odd" id="l482"> <td class="vc_file_line_number"><a href="#l482">482</a></td> <td class="vc_file_line_text"> magic_server_config_rec *add = (magic_server_config_rec *) addv;</td> </tr> <tr class="vc_row_odd" id="l483"> <td class="vc_file_line_number"><a href="#l483">483</a></td> <td class="vc_file_line_text"> magic_server_config_rec *new = (magic_server_config_rec *)</td> </tr> <tr class="vc_row_odd" id="l484"> <td class="vc_file_line_number"><a href="#l484">484</a></td> <td class="vc_file_line_text"> apr_palloc(p, sizeof(magic_server_config_rec));</td> </tr> <tr class="vc_row_odd" id="l485"> <td class="vc_file_line_number"><a href="#l485">485</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l486"> <td class="vc_file_line_number"><a href="#l486">486</a></td> <td class="vc_file_line_text"> new-&gt;magicfile = add-&gt;magicfile ? add-&gt;magicfile : base-&gt;magicfile;</td> </tr> <tr class="vc_row_odd" id="l487"> <td class="vc_file_line_number"><a href="#l487">487</a></td> <td class="vc_file_line_text"> new-&gt;magic = NULL;</td> </tr> <tr class="vc_row_odd" id="l488"> <td class="vc_file_line_number"><a href="#l488">488</a></td> <td class="vc_file_line_text"> new-&gt;last = NULL;</td> </tr> <tr class="vc_row_odd" id="l489"> <td class="vc_file_line_number"><a href="#l489">489</a></td> <td class="vc_file_line_text"> return new;</td> </tr> <tr class="vc_row_odd" id="l490"> <td class="vc_file_line_number"><a href="#l490">490</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l491"> <td class="vc_file_line_number"><a href="#l491">491</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l492"> <td class="vc_file_line_number"><a href="#l492">492</a></td> <td class="vc_file_line_text">static const char *set_magicfile(cmd_parms *cmd, void *dummy, const char *arg)</td> </tr> <tr class="vc_row_odd" id="l493"> <td class="vc_file_line_number"><a href="#l493">493</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l494"> <td class="vc_file_line_number"><a href="#l494">494</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf = (magic_server_config_rec *)</td> </tr> <tr class="vc_row_odd" id="l495"> <td class="vc_file_line_number"><a href="#l495">495</a></td> <td class="vc_file_line_text"> ap_get_module_config(cmd-&gt;server-&gt;module_config,</td> </tr> <tr class="vc_row_odd" id="l496"> <td class="vc_file_line_number"><a href="#l496">496</a></td> <td class="vc_file_line_text"> &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l497"> <td class="vc_file_line_number"><a href="#l497">497</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l498"> <td class="vc_file_line_number"><a href="#l498">498</a></td> <td class="vc_file_line_text"> if (!conf) {</td> </tr> <tr class="vc_row_odd" id="l499"> <td class="vc_file_line_number"><a href="#l499">499</a></td> <td class="vc_file_line_text"> return MODNAME &quot;: server structure not allocated&quot;;</td> </tr> <tr class="vc_row_odd" id="l500"> <td class="vc_file_line_number"><a href="#l500">500</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l501"> <td class="vc_file_line_number"><a href="#l501">501</a></td> <td class="vc_file_line_text"> conf-&gt;magicfile = arg;</td> </tr> <tr class="vc_row_odd" id="l502"> <td class="vc_file_line_number"><a href="#l502">502</a></td> <td class="vc_file_line_text"> return NULL;</td> </tr> <tr class="vc_row_odd" id="l503"> <td class="vc_file_line_number"><a href="#l503">503</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l504"> <td class="vc_file_line_number"><a href="#l504">504</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l505"> <td class="vc_file_line_number"><a href="#l505">505</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l506"> <td class="vc_file_line_number"><a href="#l506">506</a></td> <td class="vc_file_line_text"> * configuration file commands - exported to Apache API</td> </tr> <tr class="vc_row_odd" id="l507"> <td class="vc_file_line_number"><a href="#l507">507</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l508"> <td class="vc_file_line_number"><a href="#l508">508</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l509"> <td class="vc_file_line_number"><a href="#l509">509</a></td> <td class="vc_file_line_text">static const command_rec mime_magic_cmds[] =</td> </tr> <tr class="vc_row_odd" id="l510"> <td class="vc_file_line_number"><a href="#l510">510</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l511"> <td class="vc_file_line_number"><a href="#l511">511</a></td> <td class="vc_file_line_text"> AP_INIT_TAKE1(&quot;MimeMagicFile&quot;, set_magicfile, NULL, RSRC_CONF,</td> </tr> <tr class="vc_row_odd" id="l512"> <td class="vc_file_line_number"><a href="#l512">512</a></td> <td class="vc_file_line_text"> &quot;Path to MIME Magic file (in file(1) format)&quot;),</td> </tr> <tr class="vc_row_odd" id="l513"> <td class="vc_file_line_number"><a href="#l513">513</a></td> <td class="vc_file_line_text"> {NULL}</td> </tr> <tr class="vc_row_odd" id="l514"> <td class="vc_file_line_number"><a href="#l514">514</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l515"> <td class="vc_file_line_number"><a href="#l515">515</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l516"> <td class="vc_file_line_number"><a href="#l516">516</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l517"> <td class="vc_file_line_number"><a href="#l517">517</a></td> <td class="vc_file_line_text"> * RSL (result string list) processing routines</td> </tr> <tr class="vc_row_odd" id="l518"> <td class="vc_file_line_number"><a href="#l518">518</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l519"> <td class="vc_file_line_number"><a href="#l519">519</a></td> <td class="vc_file_line_text"> * These collect strings that would have been printed in fragments by file(1)</td> </tr> <tr class="vc_row_odd" id="l520"> <td class="vc_file_line_number"><a href="#l520">520</a></td> <td class="vc_file_line_text"> * into a list of magic_rsl structures with the strings. When complete,</td> </tr> <tr class="vc_row_odd" id="l521"> <td class="vc_file_line_number"><a href="#l521">521</a></td> <td class="vc_file_line_text"> * they&#39;re concatenated together to become the MIME content and encoding</td> </tr> <tr class="vc_row_odd" id="l522"> <td class="vc_file_line_number"><a href="#l522">522</a></td> <td class="vc_file_line_text"> * types.</td> </tr> <tr class="vc_row_odd" id="l523"> <td class="vc_file_line_number"><a href="#l523">523</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l524"> <td class="vc_file_line_number"><a href="#l524">524</a></td> <td class="vc_file_line_text"> * return value conventions for these functions: functions which return int:</td> </tr> <tr class="vc_row_odd" id="l525"> <td class="vc_file_line_number"><a href="#l525">525</a></td> <td class="vc_file_line_text"> * failure = -1, other = result functions which return pointers: failure = 0,</td> </tr> <tr class="vc_row_odd" id="l526"> <td class="vc_file_line_number"><a href="#l526">526</a></td> <td class="vc_file_line_text"> * other = result</td> </tr> <tr class="vc_row_odd" id="l527"> <td class="vc_file_line_number"><a href="#l527">527</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l528"> <td class="vc_file_line_number"><a href="#l528">528</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l529"> <td class="vc_file_line_number"><a href="#l529">529</a></td> <td class="vc_file_line_text">/* allocate a per-request structure and put it in the request record */</td> </tr> <tr class="vc_row_odd" id="l530"> <td class="vc_file_line_number"><a href="#l530">530</a></td> <td class="vc_file_line_text">static magic_req_rec *magic_set_config(request_rec *r)</td> </tr> <tr class="vc_row_odd" id="l531"> <td class="vc_file_line_number"><a href="#l531">531</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l532"> <td class="vc_file_line_number"><a href="#l532">532</a></td> <td class="vc_file_line_text"> magic_req_rec *req_dat = (magic_req_rec *) apr_palloc(r-&gt;pool,</td> </tr> <tr class="vc_row_odd" id="l533"> <td class="vc_file_line_number"><a href="#l533">533</a></td> <td class="vc_file_line_text"> sizeof(magic_req_rec));</td> </tr> <tr class="vc_row_odd" id="l534"> <td class="vc_file_line_number"><a href="#l534">534</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l535"> <td class="vc_file_line_number"><a href="#l535">535</a></td> <td class="vc_file_line_text"> req_dat-&gt;head = req_dat-&gt;tail = (magic_rsl *) NULL;</td> </tr> <tr class="vc_row_odd" id="l536"> <td class="vc_file_line_number"><a href="#l536">536</a></td> <td class="vc_file_line_text"> ap_set_module_config(r-&gt;request_config, &amp;mime_magic_module, req_dat);</td> </tr> <tr class="vc_row_odd" id="l537"> <td class="vc_file_line_number"><a href="#l537">537</a></td> <td class="vc_file_line_text"> return req_dat;</td> </tr> <tr class="vc_row_odd" id="l538"> <td class="vc_file_line_number"><a href="#l538">538</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l539"> <td class="vc_file_line_number"><a href="#l539">539</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l540"> <td class="vc_file_line_number"><a href="#l540">540</a></td> <td class="vc_file_line_text">/* add a string to the result string list for this request */</td> </tr> <tr class="vc_row_odd" id="l541"> <td class="vc_file_line_number"><a href="#l541">541</a></td> <td class="vc_file_line_text">/* it is the responsibility of the caller to allocate &quot;str&quot; */</td> </tr> <tr class="vc_row_odd" id="l542"> <td class="vc_file_line_number"><a href="#l542">542</a></td> <td class="vc_file_line_text">static int magic_rsl_add(request_rec *r, const char *str)</td> </tr> <tr class="vc_row_odd" id="l543"> <td class="vc_file_line_number"><a href="#l543">543</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l544"> <td class="vc_file_line_number"><a href="#l544">544</a></td> <td class="vc_file_line_text"> magic_req_rec *req_dat = (magic_req_rec *)</td> </tr> <tr class="vc_row_odd" id="l545"> <td class="vc_file_line_number"><a href="#l545">545</a></td> <td class="vc_file_line_text"> ap_get_module_config(r-&gt;request_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l546"> <td class="vc_file_line_number"><a href="#l546">546</a></td> <td class="vc_file_line_text"> magic_rsl *rsl;</td> </tr> <tr class="vc_row_odd" id="l547"> <td class="vc_file_line_number"><a href="#l547">547</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l548"> <td class="vc_file_line_number"><a href="#l548">548</a></td> <td class="vc_file_line_text"> /* make sure we have a list to put it in */</td> </tr> <tr class="vc_row_odd" id="l549"> <td class="vc_file_line_number"><a href="#l549">549</a></td> <td class="vc_file_line_text"> if (!req_dat) {</td> </tr> <tr class="vc_row_odd" id="l550"> <td class="vc_file_line_number"><a href="#l550">550</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_EINVAL, r, APLOGNO(01507)</td> </tr> <tr class="vc_row_odd" id="l551"> <td class="vc_file_line_number"><a href="#l551">551</a></td> <td class="vc_file_line_text"> MODNAME &quot;: request config should not be NULL&quot;);</td> </tr> <tr class="vc_row_odd" id="l552"> <td class="vc_file_line_number"><a href="#l552">552</a></td> <td class="vc_file_line_text"> if (!(req_dat = magic_set_config(r))) {</td> </tr> <tr class="vc_row_odd" id="l553"> <td class="vc_file_line_number"><a href="#l553">553</a></td> <td class="vc_file_line_text"> /* failure */</td> </tr> <tr class="vc_row_odd" id="l554"> <td class="vc_file_line_number"><a href="#l554">554</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l555"> <td class="vc_file_line_number"><a href="#l555">555</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l556"> <td class="vc_file_line_number"><a href="#l556">556</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l557"> <td class="vc_file_line_number"><a href="#l557">557</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l558"> <td class="vc_file_line_number"><a href="#l558">558</a></td> <td class="vc_file_line_text"> /* allocate the list entry */</td> </tr> <tr class="vc_row_odd" id="l559"> <td class="vc_file_line_number"><a href="#l559">559</a></td> <td class="vc_file_line_text"> rsl = (magic_rsl *) apr_palloc(r-&gt;pool, sizeof(magic_rsl));</td> </tr> <tr class="vc_row_odd" id="l560"> <td class="vc_file_line_number"><a href="#l560">560</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l561"> <td class="vc_file_line_number"><a href="#l561">561</a></td> <td class="vc_file_line_text"> /* fill it */</td> </tr> <tr class="vc_row_odd" id="l562"> <td class="vc_file_line_number"><a href="#l562">562</a></td> <td class="vc_file_line_text"> rsl-&gt;str = str;</td> </tr> <tr class="vc_row_odd" id="l563"> <td class="vc_file_line_number"><a href="#l563">563</a></td> <td class="vc_file_line_text"> rsl-&gt;next = (magic_rsl *) NULL;</td> </tr> <tr class="vc_row_odd" id="l564"> <td class="vc_file_line_number"><a href="#l564">564</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l565"> <td class="vc_file_line_number"><a href="#l565">565</a></td> <td class="vc_file_line_text"> /* append to the list */</td> </tr> <tr class="vc_row_odd" id="l566"> <td class="vc_file_line_number"><a href="#l566">566</a></td> <td class="vc_file_line_text"> if (req_dat-&gt;head &amp;&amp; req_dat-&gt;tail) {</td> </tr> <tr class="vc_row_odd" id="l567"> <td class="vc_file_line_number"><a href="#l567">567</a></td> <td class="vc_file_line_text"> req_dat-&gt;tail-&gt;next = rsl;</td> </tr> <tr class="vc_row_odd" id="l568"> <td class="vc_file_line_number"><a href="#l568">568</a></td> <td class="vc_file_line_text"> req_dat-&gt;tail = rsl;</td> </tr> <tr class="vc_row_odd" id="l569"> <td class="vc_file_line_number"><a href="#l569">569</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l570"> <td class="vc_file_line_number"><a href="#l570">570</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l571"> <td class="vc_file_line_number"><a href="#l571">571</a></td> <td class="vc_file_line_text"> req_dat-&gt;head = req_dat-&gt;tail = rsl;</td> </tr> <tr class="vc_row_odd" id="l572"> <td class="vc_file_line_number"><a href="#l572">572</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l573"> <td class="vc_file_line_number"><a href="#l573">573</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l574"> <td class="vc_file_line_number"><a href="#l574">574</a></td> <td class="vc_file_line_text"> /* success */</td> </tr> <tr class="vc_row_odd" id="l575"> <td class="vc_file_line_number"><a href="#l575">575</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l576"> <td class="vc_file_line_number"><a href="#l576">576</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l577"> <td class="vc_file_line_number"><a href="#l577">577</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l578"> <td class="vc_file_line_number"><a href="#l578">578</a></td> <td class="vc_file_line_text">/* RSL hook for puts-type functions */</td> </tr> <tr class="vc_row_odd" id="l579"> <td class="vc_file_line_number"><a href="#l579">579</a></td> <td class="vc_file_line_text">static int magic_rsl_puts(request_rec *r, const char *str)</td> </tr> <tr class="vc_row_odd" id="l580"> <td class="vc_file_line_number"><a href="#l580">580</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l581"> <td class="vc_file_line_number"><a href="#l581">581</a></td> <td class="vc_file_line_text"> return magic_rsl_add(r, str);</td> </tr> <tr class="vc_row_odd" id="l582"> <td class="vc_file_line_number"><a href="#l582">582</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l583"> <td class="vc_file_line_number"><a href="#l583">583</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l584"> <td class="vc_file_line_number"><a href="#l584">584</a></td> <td class="vc_file_line_text">/* RSL hook for printf-type functions */</td> </tr> <tr class="vc_row_odd" id="l585"> <td class="vc_file_line_number"><a href="#l585">585</a></td> <td class="vc_file_line_text">static int magic_rsl_printf(request_rec *r, char *str,...)</td> </tr> <tr class="vc_row_odd" id="l586"> <td class="vc_file_line_number"><a href="#l586">586</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l587"> <td class="vc_file_line_number"><a href="#l587">587</a></td> <td class="vc_file_line_text"> va_list ap;</td> </tr> <tr class="vc_row_odd" id="l588"> <td class="vc_file_line_number"><a href="#l588">588</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l589"> <td class="vc_file_line_number"><a href="#l589">589</a></td> <td class="vc_file_line_text"> char buf[MAXMIMESTRING];</td> </tr> <tr class="vc_row_odd" id="l590"> <td class="vc_file_line_number"><a href="#l590">590</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l591"> <td class="vc_file_line_number"><a href="#l591">591</a></td> <td class="vc_file_line_text"> /* assemble the string into the buffer */</td> </tr> <tr class="vc_row_odd" id="l592"> <td class="vc_file_line_number"><a href="#l592">592</a></td> <td class="vc_file_line_text"> va_start(ap, str);</td> </tr> <tr class="vc_row_odd" id="l593"> <td class="vc_file_line_number"><a href="#l593">593</a></td> <td class="vc_file_line_text"> apr_vsnprintf(buf, sizeof(buf), str, ap);</td> </tr> <tr class="vc_row_odd" id="l594"> <td class="vc_file_line_number"><a href="#l594">594</a></td> <td class="vc_file_line_text"> va_end(ap);</td> </tr> <tr class="vc_row_odd" id="l595"> <td class="vc_file_line_number"><a href="#l595">595</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l596"> <td class="vc_file_line_number"><a href="#l596">596</a></td> <td class="vc_file_line_text"> /* add the buffer to the list */</td> </tr> <tr class="vc_row_odd" id="l597"> <td class="vc_file_line_number"><a href="#l597">597</a></td> <td class="vc_file_line_text"> return magic_rsl_add(r, apr_pstrdup(r-&gt;pool, buf));</td> </tr> <tr class="vc_row_odd" id="l598"> <td class="vc_file_line_number"><a href="#l598">598</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l599"> <td class="vc_file_line_number"><a href="#l599">599</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l600"> <td class="vc_file_line_number"><a href="#l600">600</a></td> <td class="vc_file_line_text">/* RSL hook for putchar-type functions */</td> </tr> <tr class="vc_row_odd" id="l601"> <td class="vc_file_line_number"><a href="#l601">601</a></td> <td class="vc_file_line_text">static int magic_rsl_putchar(request_rec *r, char c)</td> </tr> <tr class="vc_row_odd" id="l602"> <td class="vc_file_line_number"><a href="#l602">602</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l603"> <td class="vc_file_line_number"><a href="#l603">603</a></td> <td class="vc_file_line_text"> char str[2];</td> </tr> <tr class="vc_row_odd" id="l604"> <td class="vc_file_line_number"><a href="#l604">604</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l605"> <td class="vc_file_line_number"><a href="#l605">605</a></td> <td class="vc_file_line_text"> /* high overhead for 1 char - just hope they don&#39;t do this much */</td> </tr> <tr class="vc_row_odd" id="l606"> <td class="vc_file_line_number"><a href="#l606">606</a></td> <td class="vc_file_line_text"> str[0] = c;</td> </tr> <tr class="vc_row_odd" id="l607"> <td class="vc_file_line_number"><a href="#l607">607</a></td> <td class="vc_file_line_text"> str[1] = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l608"> <td class="vc_file_line_number"><a href="#l608">608</a></td> <td class="vc_file_line_text"> return magic_rsl_add(r, apr_pstrdup(r-&gt;pool, str));</td> </tr> <tr class="vc_row_odd" id="l609"> <td class="vc_file_line_number"><a href="#l609">609</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l610"> <td class="vc_file_line_number"><a href="#l610">610</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l611"> <td class="vc_file_line_number"><a href="#l611">611</a></td> <td class="vc_file_line_text">/* allocate and copy a contiguous string from a result string list */</td> </tr> <tr class="vc_row_odd" id="l612"> <td class="vc_file_line_number"><a href="#l612">612</a></td> <td class="vc_file_line_text">static char *rsl_strdup(request_rec *r, int start_frag, int start_pos, int len)</td> </tr> <tr class="vc_row_odd" id="l613"> <td class="vc_file_line_number"><a href="#l613">613</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l614"> <td class="vc_file_line_number"><a href="#l614">614</a></td> <td class="vc_file_line_text"> char *result; /* return value */</td> </tr> <tr class="vc_row_odd" id="l615"> <td class="vc_file_line_number"><a href="#l615">615</a></td> <td class="vc_file_line_text"> int cur_frag, /* current fragment number/counter */</td> </tr> <tr class="vc_row_odd" id="l616"> <td class="vc_file_line_number"><a href="#l616">616</a></td> <td class="vc_file_line_text"> cur_pos, /* current position within fragment */</td> </tr> <tr class="vc_row_odd" id="l617"> <td class="vc_file_line_number"><a href="#l617">617</a></td> <td class="vc_file_line_text"> res_pos; /* position in result string */</td> </tr> <tr class="vc_row_odd" id="l618"> <td class="vc_file_line_number"><a href="#l618">618</a></td> <td class="vc_file_line_text"> magic_rsl *frag; /* list-traversal pointer */</td> </tr> <tr class="vc_row_odd" id="l619"> <td class="vc_file_line_number"><a href="#l619">619</a></td> <td class="vc_file_line_text"> magic_req_rec *req_dat = (magic_req_rec *)</td> </tr> <tr class="vc_row_odd" id="l620"> <td class="vc_file_line_number"><a href="#l620">620</a></td> <td class="vc_file_line_text"> ap_get_module_config(r-&gt;request_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l621"> <td class="vc_file_line_number"><a href="#l621">621</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l622"> <td class="vc_file_line_number"><a href="#l622">622</a></td> <td class="vc_file_line_text"> /* allocate the result string */</td> </tr> <tr class="vc_row_odd" id="l623"> <td class="vc_file_line_number"><a href="#l623">623</a></td> <td class="vc_file_line_text"> result = (char *) apr_palloc(r-&gt;pool, len + 1);</td> </tr> <tr class="vc_row_odd" id="l624"> <td class="vc_file_line_number"><a href="#l624">624</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l625"> <td class="vc_file_line_number"><a href="#l625">625</a></td> <td class="vc_file_line_text"> /* loop through and collect the string */</td> </tr> <tr class="vc_row_odd" id="l626"> <td class="vc_file_line_number"><a href="#l626">626</a></td> <td class="vc_file_line_text"> res_pos = 0;</td> </tr> <tr class="vc_row_odd" id="l627"> <td class="vc_file_line_number"><a href="#l627">627</a></td> <td class="vc_file_line_text"> for (frag = req_dat-&gt;head, cur_frag = 0;</td> </tr> <tr class="vc_row_odd" id="l628"> <td class="vc_file_line_number"><a href="#l628">628</a></td> <td class="vc_file_line_text"> frag-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l629"> <td class="vc_file_line_number"><a href="#l629">629</a></td> <td class="vc_file_line_text"> frag = frag-&gt;next, cur_frag++) {</td> </tr> <tr class="vc_row_odd" id="l630"> <td class="vc_file_line_number"><a href="#l630">630</a></td> <td class="vc_file_line_text"> /* loop to the first fragment */</td> </tr> <tr class="vc_row_odd" id="l631"> <td class="vc_file_line_number"><a href="#l631">631</a></td> <td class="vc_file_line_text"> if (cur_frag &lt; start_frag)</td> </tr> <tr class="vc_row_odd" id="l632"> <td class="vc_file_line_number"><a href="#l632">632</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l633"> <td class="vc_file_line_number"><a href="#l633">633</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l634"> <td class="vc_file_line_number"><a href="#l634">634</a></td> <td class="vc_file_line_text"> /* loop through and collect chars */</td> </tr> <tr class="vc_row_odd" id="l635"> <td class="vc_file_line_number"><a href="#l635">635</a></td> <td class="vc_file_line_text"> for (cur_pos = (cur_frag == start_frag) ? start_pos : 0;</td> </tr> <tr class="vc_row_odd" id="l636"> <td class="vc_file_line_number"><a href="#l636">636</a></td> <td class="vc_file_line_text"> frag-&gt;str[cur_pos];</td> </tr> <tr class="vc_row_odd" id="l637"> <td class="vc_file_line_number"><a href="#l637">637</a></td> <td class="vc_file_line_text"> cur_pos++) {</td> </tr> <tr class="vc_row_odd" id="l638"> <td class="vc_file_line_number"><a href="#l638">638</a></td> <td class="vc_file_line_text"> if (cur_frag &gt;= start_frag</td> </tr> <tr class="vc_row_odd" id="l639"> <td class="vc_file_line_number"><a href="#l639">639</a></td> <td class="vc_file_line_text"> &amp;&amp; cur_pos &gt;= start_pos</td> </tr> <tr class="vc_row_odd" id="l640"> <td class="vc_file_line_number"><a href="#l640">640</a></td> <td class="vc_file_line_text"> &amp;&amp; res_pos &lt;= len) {</td> </tr> <tr class="vc_row_odd" id="l641"> <td class="vc_file_line_number"><a href="#l641">641</a></td> <td class="vc_file_line_text"> result[res_pos++] = frag-&gt;str[cur_pos];</td> </tr> <tr class="vc_row_odd" id="l642"> <td class="vc_file_line_number"><a href="#l642">642</a></td> <td class="vc_file_line_text"> if (res_pos &gt; len) {</td> </tr> <tr class="vc_row_odd" id="l643"> <td class="vc_file_line_number"><a href="#l643">643</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l644"> <td class="vc_file_line_number"><a href="#l644">644</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l645"> <td class="vc_file_line_number"><a href="#l645">645</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l646"> <td class="vc_file_line_number"><a href="#l646">646</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l647"> <td class="vc_file_line_number"><a href="#l647">647</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l648"> <td class="vc_file_line_number"><a href="#l648">648</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l649"> <td class="vc_file_line_number"><a href="#l649">649</a></td> <td class="vc_file_line_text"> /* clean up and return */</td> </tr> <tr class="vc_row_odd" id="l650"> <td class="vc_file_line_number"><a href="#l650">650</a></td> <td class="vc_file_line_text"> result[res_pos] = 0;</td> </tr> <tr class="vc_row_odd" id="l651"> <td class="vc_file_line_number"><a href="#l651">651</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l652"> <td class="vc_file_line_number"><a href="#l652">652</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01508)</td> </tr> <tr class="vc_row_odd" id="l653"> <td class="vc_file_line_number"><a href="#l653">653</a></td> <td class="vc_file_line_text"> MODNAME &quot;: rsl_strdup() %d chars: %s&quot;, res_pos - 1, result);</td> </tr> <tr class="vc_row_odd" id="l654"> <td class="vc_file_line_number"><a href="#l654">654</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l655"> <td class="vc_file_line_number"><a href="#l655">655</a></td> <td class="vc_file_line_text"> return result;</td> </tr> <tr class="vc_row_odd" id="l656"> <td class="vc_file_line_number"><a href="#l656">656</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l657"> <td class="vc_file_line_number"><a href="#l657">657</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l658"> <td class="vc_file_line_number"><a href="#l658">658</a></td> <td class="vc_file_line_text">/* states for the state-machine algorithm in magic_rsl_to_request() */</td> </tr> <tr class="vc_row_odd" id="l659"> <td class="vc_file_line_number"><a href="#l659">659</a></td> <td class="vc_file_line_text">typedef enum {</td> </tr> <tr class="vc_row_odd" id="l660"> <td class="vc_file_line_number"><a href="#l660">660</a></td> <td class="vc_file_line_text"> rsl_leading_space, rsl_type, rsl_subtype, rsl_separator, rsl_encoding</td> </tr> <tr class="vc_row_odd" id="l661"> <td class="vc_file_line_number"><a href="#l661">661</a></td> <td class="vc_file_line_text">} rsl_states;</td> </tr> <tr class="vc_row_odd" id="l662"> <td class="vc_file_line_number"><a href="#l662">662</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l663"> <td class="vc_file_line_number"><a href="#l663">663</a></td> <td class="vc_file_line_text">/* process the RSL and set the MIME info in the request record */</td> </tr> <tr class="vc_row_odd" id="l664"> <td class="vc_file_line_number"><a href="#l664">664</a></td> <td class="vc_file_line_text">static int magic_rsl_to_request(request_rec *r)</td> </tr> <tr class="vc_row_odd" id="l665"> <td class="vc_file_line_number"><a href="#l665">665</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l666"> <td class="vc_file_line_number"><a href="#l666">666</a></td> <td class="vc_file_line_text"> int cur_frag, /* current fragment number/counter */</td> </tr> <tr class="vc_row_odd" id="l667"> <td class="vc_file_line_number"><a href="#l667">667</a></td> <td class="vc_file_line_text"> cur_pos, /* current position within fragment */</td> </tr> <tr class="vc_row_odd" id="l668"> <td class="vc_file_line_number"><a href="#l668">668</a></td> <td class="vc_file_line_text"> type_frag, /* content type starting point: fragment */</td> </tr> <tr class="vc_row_odd" id="l669"> <td class="vc_file_line_number"><a href="#l669">669</a></td> <td class="vc_file_line_text"> type_pos, /* content type starting point: position */</td> </tr> <tr class="vc_row_odd" id="l670"> <td class="vc_file_line_number"><a href="#l670">670</a></td> <td class="vc_file_line_text"> type_len, /* content type length */</td> </tr> <tr class="vc_row_odd" id="l671"> <td class="vc_file_line_number"><a href="#l671">671</a></td> <td class="vc_file_line_text"> encoding_frag, /* content encoding starting point: fragment */</td> </tr> <tr class="vc_row_odd" id="l672"> <td class="vc_file_line_number"><a href="#l672">672</a></td> <td class="vc_file_line_text"> encoding_pos, /* content encoding starting point: position */</td> </tr> <tr class="vc_row_odd" id="l673"> <td class="vc_file_line_number"><a href="#l673">673</a></td> <td class="vc_file_line_text"> encoding_len; /* content encoding length */</td> </tr> <tr class="vc_row_odd" id="l674"> <td class="vc_file_line_number"><a href="#l674">674</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l675"> <td class="vc_file_line_number"><a href="#l675">675</a></td> <td class="vc_file_line_text"> char *tmp;</td> </tr> <tr class="vc_row_odd" id="l676"> <td class="vc_file_line_number"><a href="#l676">676</a></td> <td class="vc_file_line_text"> magic_rsl *frag; /* list-traversal pointer */</td> </tr> <tr class="vc_row_odd" id="l677"> <td class="vc_file_line_number"><a href="#l677">677</a></td> <td class="vc_file_line_text"> rsl_states state;</td> </tr> <tr class="vc_row_odd" id="l678"> <td class="vc_file_line_number"><a href="#l678">678</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l679"> <td class="vc_file_line_number"><a href="#l679">679</a></td> <td class="vc_file_line_text"> magic_req_rec *req_dat = (magic_req_rec *)</td> </tr> <tr class="vc_row_odd" id="l680"> <td class="vc_file_line_number"><a href="#l680">680</a></td> <td class="vc_file_line_text"> ap_get_module_config(r-&gt;request_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l681"> <td class="vc_file_line_number"><a href="#l681">681</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l682"> <td class="vc_file_line_number"><a href="#l682">682</a></td> <td class="vc_file_line_text"> /* check if we have a result */</td> </tr> <tr class="vc_row_odd" id="l683"> <td class="vc_file_line_number"><a href="#l683">683</a></td> <td class="vc_file_line_text"> if (!req_dat || !req_dat-&gt;head) {</td> </tr> <tr class="vc_row_odd" id="l684"> <td class="vc_file_line_number"><a href="#l684">684</a></td> <td class="vc_file_line_text"> /* empty - no match, we defer to other Apache modules */</td> </tr> <tr class="vc_row_odd" id="l685"> <td class="vc_file_line_number"><a href="#l685">685</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l686"> <td class="vc_file_line_number"><a href="#l686">686</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l687"> <td class="vc_file_line_number"><a href="#l687">687</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l688"> <td class="vc_file_line_number"><a href="#l688">688</a></td> <td class="vc_file_line_text"> /* start searching for the type and encoding */</td> </tr> <tr class="vc_row_odd" id="l689"> <td class="vc_file_line_number"><a href="#l689">689</a></td> <td class="vc_file_line_text"> state = rsl_leading_space;</td> </tr> <tr class="vc_row_odd" id="l690"> <td class="vc_file_line_number"><a href="#l690">690</a></td> <td class="vc_file_line_text"> type_frag = type_pos = type_len = 0;</td> </tr> <tr class="vc_row_odd" id="l691"> <td class="vc_file_line_number"><a href="#l691">691</a></td> <td class="vc_file_line_text"> encoding_frag = encoding_pos = encoding_len = 0;</td> </tr> <tr class="vc_row_odd" id="l692"> <td class="vc_file_line_number"><a href="#l692">692</a></td> <td class="vc_file_line_text"> for (frag = req_dat-&gt;head, cur_frag = 0;</td> </tr> <tr class="vc_row_odd" id="l693"> <td class="vc_file_line_number"><a href="#l693">693</a></td> <td class="vc_file_line_text"> frag &amp;&amp; frag-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l694"> <td class="vc_file_line_number"><a href="#l694">694</a></td> <td class="vc_file_line_text"> frag = frag-&gt;next, cur_frag++) {</td> </tr> <tr class="vc_row_odd" id="l695"> <td class="vc_file_line_number"><a href="#l695">695</a></td> <td class="vc_file_line_text"> /* loop through the characters in the fragment */</td> </tr> <tr class="vc_row_odd" id="l696"> <td class="vc_file_line_number"><a href="#l696">696</a></td> <td class="vc_file_line_text"> for (cur_pos = 0; frag-&gt;str[cur_pos]; cur_pos++) {</td> </tr> <tr class="vc_row_odd" id="l697"> <td class="vc_file_line_number"><a href="#l697">697</a></td> <td class="vc_file_line_text"> if (apr_isspace(frag-&gt;str[cur_pos])) {</td> </tr> <tr class="vc_row_odd" id="l698"> <td class="vc_file_line_number"><a href="#l698">698</a></td> <td class="vc_file_line_text"> /* process whitespace actions for each state */</td> </tr> <tr class="vc_row_odd" id="l699"> <td class="vc_file_line_number"><a href="#l699">699</a></td> <td class="vc_file_line_text"> if (state == rsl_leading_space) {</td> </tr> <tr class="vc_row_odd" id="l700"> <td class="vc_file_line_number"><a href="#l700">700</a></td> <td class="vc_file_line_text"> /* eat whitespace in this state */</td> </tr> <tr class="vc_row_odd" id="l701"> <td class="vc_file_line_number"><a href="#l701">701</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l702"> <td class="vc_file_line_number"><a href="#l702">702</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l703"> <td class="vc_file_line_number"><a href="#l703">703</a></td> <td class="vc_file_line_text"> else if (state == rsl_type) {</td> </tr> <tr class="vc_row_odd" id="l704"> <td class="vc_file_line_number"><a href="#l704">704</a></td> <td class="vc_file_line_text"> /* whitespace: type has no slash! */</td> </tr> <tr class="vc_row_odd" id="l705"> <td class="vc_file_line_number"><a href="#l705">705</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l706"> <td class="vc_file_line_number"><a href="#l706">706</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l707"> <td class="vc_file_line_number"><a href="#l707">707</a></td> <td class="vc_file_line_text"> else if (state == rsl_subtype) {</td> </tr> <tr class="vc_row_odd" id="l708"> <td class="vc_file_line_number"><a href="#l708">708</a></td> <td class="vc_file_line_text"> /* whitespace: end of MIME type */</td> </tr> <tr class="vc_row_odd" id="l709"> <td class="vc_file_line_number"><a href="#l709">709</a></td> <td class="vc_file_line_text"> state++;</td> </tr> <tr class="vc_row_odd" id="l710"> <td class="vc_file_line_number"><a href="#l710">710</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l711"> <td class="vc_file_line_number"><a href="#l711">711</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l712"> <td class="vc_file_line_number"><a href="#l712">712</a></td> <td class="vc_file_line_text"> else if (state == rsl_separator) {</td> </tr> <tr class="vc_row_odd" id="l713"> <td class="vc_file_line_number"><a href="#l713">713</a></td> <td class="vc_file_line_text"> /* eat whitespace in this state */</td> </tr> <tr class="vc_row_odd" id="l714"> <td class="vc_file_line_number"><a href="#l714">714</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l715"> <td class="vc_file_line_number"><a href="#l715">715</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l716"> <td class="vc_file_line_number"><a href="#l716">716</a></td> <td class="vc_file_line_text"> else if (state == rsl_encoding) {</td> </tr> <tr class="vc_row_odd" id="l717"> <td class="vc_file_line_number"><a href="#l717">717</a></td> <td class="vc_file_line_text"> /* whitespace: end of MIME encoding */</td> </tr> <tr class="vc_row_odd" id="l718"> <td class="vc_file_line_number"><a href="#l718">718</a></td> <td class="vc_file_line_text"> /* we&#39;re done */</td> </tr> <tr class="vc_row_odd" id="l719"> <td class="vc_file_line_number"><a href="#l719">719</a></td> <td class="vc_file_line_text"> frag = req_dat-&gt;tail;</td> </tr> <tr class="vc_row_odd" id="l720"> <td class="vc_file_line_number"><a href="#l720">720</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l721"> <td class="vc_file_line_number"><a href="#l721">721</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l722"> <td class="vc_file_line_number"><a href="#l722">722</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l723"> <td class="vc_file_line_number"><a href="#l723">723</a></td> <td class="vc_file_line_text"> /* should not be possible */</td> </tr> <tr class="vc_row_odd" id="l724"> <td class="vc_file_line_number"><a href="#l724">724</a></td> <td class="vc_file_line_text"> /* abandon malfunctioning module */</td> </tr> <tr class="vc_row_odd" id="l725"> <td class="vc_file_line_number"><a href="#l725">725</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01509)</td> </tr> <tr class="vc_row_odd" id="l726"> <td class="vc_file_line_number"><a href="#l726">726</a></td> <td class="vc_file_line_text"> MODNAME &quot;: bad state %d (ws)&quot;, state);</td> </tr> <tr class="vc_row_odd" id="l727"> <td class="vc_file_line_number"><a href="#l727">727</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l728"> <td class="vc_file_line_number"><a href="#l728">728</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l729"> <td class="vc_file_line_number"><a href="#l729">729</a></td> <td class="vc_file_line_text"> /* NOTREACHED */</td> </tr> <tr class="vc_row_odd" id="l730"> <td class="vc_file_line_number"><a href="#l730">730</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l731"> <td class="vc_file_line_number"><a href="#l731">731</a></td> <td class="vc_file_line_text"> else if (state == rsl_type &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l732"> <td class="vc_file_line_number"><a href="#l732">732</a></td> <td class="vc_file_line_text"> frag-&gt;str[cur_pos] == &#39;/&#39;) {</td> </tr> <tr class="vc_row_odd" id="l733"> <td class="vc_file_line_number"><a href="#l733">733</a></td> <td class="vc_file_line_text"> /* copy the char and go to rsl_subtype state */</td> </tr> <tr class="vc_row_odd" id="l734"> <td class="vc_file_line_number"><a href="#l734">734</a></td> <td class="vc_file_line_text"> type_len++;</td> </tr> <tr class="vc_row_odd" id="l735"> <td class="vc_file_line_number"><a href="#l735">735</a></td> <td class="vc_file_line_text"> state++;</td> </tr> <tr class="vc_row_odd" id="l736"> <td class="vc_file_line_number"><a href="#l736">736</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l737"> <td class="vc_file_line_number"><a href="#l737">737</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l738"> <td class="vc_file_line_number"><a href="#l738">738</a></td> <td class="vc_file_line_text"> /* process non-space actions for each state */</td> </tr> <tr class="vc_row_odd" id="l739"> <td class="vc_file_line_number"><a href="#l739">739</a></td> <td class="vc_file_line_text"> if (state == rsl_leading_space) {</td> </tr> <tr class="vc_row_odd" id="l740"> <td class="vc_file_line_number"><a href="#l740">740</a></td> <td class="vc_file_line_text"> /* non-space: begin MIME type */</td> </tr> <tr class="vc_row_odd" id="l741"> <td class="vc_file_line_number"><a href="#l741">741</a></td> <td class="vc_file_line_text"> state++;</td> </tr> <tr class="vc_row_odd" id="l742"> <td class="vc_file_line_number"><a href="#l742">742</a></td> <td class="vc_file_line_text"> type_frag = cur_frag;</td> </tr> <tr class="vc_row_odd" id="l743"> <td class="vc_file_line_number"><a href="#l743">743</a></td> <td class="vc_file_line_text"> type_pos = cur_pos;</td> </tr> <tr class="vc_row_odd" id="l744"> <td class="vc_file_line_number"><a href="#l744">744</a></td> <td class="vc_file_line_text"> type_len = 1;</td> </tr> <tr class="vc_row_odd" id="l745"> <td class="vc_file_line_number"><a href="#l745">745</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l746"> <td class="vc_file_line_number"><a href="#l746">746</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l747"> <td class="vc_file_line_number"><a href="#l747">747</a></td> <td class="vc_file_line_text"> else if (state == rsl_type ||</td> </tr> <tr class="vc_row_odd" id="l748"> <td class="vc_file_line_number"><a href="#l748">748</a></td> <td class="vc_file_line_text"> state == rsl_subtype) {</td> </tr> <tr class="vc_row_odd" id="l749"> <td class="vc_file_line_number"><a href="#l749">749</a></td> <td class="vc_file_line_text"> /* non-space: adds to type */</td> </tr> <tr class="vc_row_odd" id="l750"> <td class="vc_file_line_number"><a href="#l750">750</a></td> <td class="vc_file_line_text"> type_len++;</td> </tr> <tr class="vc_row_odd" id="l751"> <td class="vc_file_line_number"><a href="#l751">751</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l752"> <td class="vc_file_line_number"><a href="#l752">752</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l753"> <td class="vc_file_line_number"><a href="#l753">753</a></td> <td class="vc_file_line_text"> else if (state == rsl_separator) {</td> </tr> <tr class="vc_row_odd" id="l754"> <td class="vc_file_line_number"><a href="#l754">754</a></td> <td class="vc_file_line_text"> /* non-space: begin MIME encoding */</td> </tr> <tr class="vc_row_odd" id="l755"> <td class="vc_file_line_number"><a href="#l755">755</a></td> <td class="vc_file_line_text"> state++;</td> </tr> <tr class="vc_row_odd" id="l756"> <td class="vc_file_line_number"><a href="#l756">756</a></td> <td class="vc_file_line_text"> encoding_frag = cur_frag;</td> </tr> <tr class="vc_row_odd" id="l757"> <td class="vc_file_line_number"><a href="#l757">757</a></td> <td class="vc_file_line_text"> encoding_pos = cur_pos;</td> </tr> <tr class="vc_row_odd" id="l758"> <td class="vc_file_line_number"><a href="#l758">758</a></td> <td class="vc_file_line_text"> encoding_len = 1;</td> </tr> <tr class="vc_row_odd" id="l759"> <td class="vc_file_line_number"><a href="#l759">759</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l760"> <td class="vc_file_line_number"><a href="#l760">760</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l761"> <td class="vc_file_line_number"><a href="#l761">761</a></td> <td class="vc_file_line_text"> else if (state == rsl_encoding) {</td> </tr> <tr class="vc_row_odd" id="l762"> <td class="vc_file_line_number"><a href="#l762">762</a></td> <td class="vc_file_line_text"> /* non-space: adds to encoding */</td> </tr> <tr class="vc_row_odd" id="l763"> <td class="vc_file_line_number"><a href="#l763">763</a></td> <td class="vc_file_line_text"> encoding_len++;</td> </tr> <tr class="vc_row_odd" id="l764"> <td class="vc_file_line_number"><a href="#l764">764</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l765"> <td class="vc_file_line_number"><a href="#l765">765</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l766"> <td class="vc_file_line_number"><a href="#l766">766</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l767"> <td class="vc_file_line_number"><a href="#l767">767</a></td> <td class="vc_file_line_text"> /* should not be possible */</td> </tr> <tr class="vc_row_odd" id="l768"> <td class="vc_file_line_number"><a href="#l768">768</a></td> <td class="vc_file_line_text"> /* abandon malfunctioning module */</td> </tr> <tr class="vc_row_odd" id="l769"> <td class="vc_file_line_number"><a href="#l769">769</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01510)</td> </tr> <tr class="vc_row_odd" id="l770"> <td class="vc_file_line_number"><a href="#l770">770</a></td> <td class="vc_file_line_text"> MODNAME &quot;: bad state %d (ns)&quot;, state);</td> </tr> <tr class="vc_row_odd" id="l771"> <td class="vc_file_line_number"><a href="#l771">771</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l772"> <td class="vc_file_line_number"><a href="#l772">772</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l773"> <td class="vc_file_line_number"><a href="#l773">773</a></td> <td class="vc_file_line_text"> /* NOTREACHED */</td> </tr> <tr class="vc_row_odd" id="l774"> <td class="vc_file_line_number"><a href="#l774">774</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l775"> <td class="vc_file_line_number"><a href="#l775">775</a></td> <td class="vc_file_line_text"> /* NOTREACHED */</td> </tr> <tr class="vc_row_odd" id="l776"> <td class="vc_file_line_number"><a href="#l776">776</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l777"> <td class="vc_file_line_number"><a href="#l777">777</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l778"> <td class="vc_file_line_number"><a href="#l778">778</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l779"> <td class="vc_file_line_number"><a href="#l779">779</a></td> <td class="vc_file_line_text"> /* if we ended prior to state rsl_subtype, we had incomplete info */</td> </tr> <tr class="vc_row_odd" id="l780"> <td class="vc_file_line_number"><a href="#l780">780</a></td> <td class="vc_file_line_text"> if (state != rsl_subtype &amp;&amp; state != rsl_separator &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l781"> <td class="vc_file_line_number"><a href="#l781">781</a></td> <td class="vc_file_line_text"> state != rsl_encoding) {</td> </tr> <tr class="vc_row_odd" id="l782"> <td class="vc_file_line_number"><a href="#l782">782</a></td> <td class="vc_file_line_text"> /* defer to other modules */</td> </tr> <tr class="vc_row_odd" id="l783"> <td class="vc_file_line_number"><a href="#l783">783</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l784"> <td class="vc_file_line_number"><a href="#l784">784</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l785"> <td class="vc_file_line_number"><a href="#l785">785</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l786"> <td class="vc_file_line_number"><a href="#l786">786</a></td> <td class="vc_file_line_text"> /* save the info in the request record */</td> </tr> <tr class="vc_row_odd" id="l787"> <td class="vc_file_line_number"><a href="#l787">787</a></td> <td class="vc_file_line_text"> tmp = rsl_strdup(r, type_frag, type_pos, type_len);</td> </tr> <tr class="vc_row_odd" id="l788"> <td class="vc_file_line_number"><a href="#l788">788</a></td> <td class="vc_file_line_text"> /* XXX: this could be done at config time I&#39;m sure... but I&#39;m</td> </tr> <tr class="vc_row_odd" id="l789"> <td class="vc_file_line_number"><a href="#l789">789</a></td> <td class="vc_file_line_text"> * confused by all this magic_rsl stuff. -djg */</td> </tr> <tr class="vc_row_odd" id="l790"> <td class="vc_file_line_number"><a href="#l790">790</a></td> <td class="vc_file_line_text"> ap_content_type_tolower(tmp);</td> </tr> <tr class="vc_row_odd" id="l791"> <td class="vc_file_line_number"><a href="#l791">791</a></td> <td class="vc_file_line_text"> ap_set_content_type(r, tmp);</td> </tr> <tr class="vc_row_odd" id="l792"> <td class="vc_file_line_number"><a href="#l792">792</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l793"> <td class="vc_file_line_number"><a href="#l793">793</a></td> <td class="vc_file_line_text"> if (state == rsl_encoding) {</td> </tr> <tr class="vc_row_odd" id="l794"> <td class="vc_file_line_number"><a href="#l794">794</a></td> <td class="vc_file_line_text"> tmp = rsl_strdup(r, encoding_frag,</td> </tr> <tr class="vc_row_odd" id="l795"> <td class="vc_file_line_number"><a href="#l795">795</a></td> <td class="vc_file_line_text"> encoding_pos, encoding_len);</td> </tr> <tr class="vc_row_odd" id="l796"> <td class="vc_file_line_number"><a href="#l796">796</a></td> <td class="vc_file_line_text"> /* XXX: this could be done at config time I&#39;m sure... but I&#39;m</td> </tr> <tr class="vc_row_odd" id="l797"> <td class="vc_file_line_number"><a href="#l797">797</a></td> <td class="vc_file_line_text"> * confused by all this magic_rsl stuff. -djg */</td> </tr> <tr class="vc_row_odd" id="l798"> <td class="vc_file_line_number"><a href="#l798">798</a></td> <td class="vc_file_line_text"> ap_str_tolower(tmp);</td> </tr> <tr class="vc_row_odd" id="l799"> <td class="vc_file_line_number"><a href="#l799">799</a></td> <td class="vc_file_line_text"> r-&gt;content_encoding = tmp;</td> </tr> <tr class="vc_row_odd" id="l800"> <td class="vc_file_line_number"><a href="#l800">800</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l801"> <td class="vc_file_line_number"><a href="#l801">801</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l802"> <td class="vc_file_line_number"><a href="#l802">802</a></td> <td class="vc_file_line_text"> /* detect memory allocation or other errors */</td> </tr> <tr class="vc_row_odd" id="l803"> <td class="vc_file_line_number"><a href="#l803">803</a></td> <td class="vc_file_line_text"> if (!r-&gt;content_type ||</td> </tr> <tr class="vc_row_odd" id="l804"> <td class="vc_file_line_number"><a href="#l804">804</a></td> <td class="vc_file_line_text"> (state == rsl_encoding &amp;&amp; !r-&gt;content_encoding)) {</td> </tr> <tr class="vc_row_odd" id="l805"> <td class="vc_file_line_number"><a href="#l805">805</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01511)</td> </tr> <tr class="vc_row_odd" id="l806"> <td class="vc_file_line_number"><a href="#l806">806</a></td> <td class="vc_file_line_text"> MODNAME &quot;: unexpected state %d; could be caused by bad &quot;</td> </tr> <tr class="vc_row_odd" id="l807"> <td class="vc_file_line_number"><a href="#l807">807</a></td> <td class="vc_file_line_text"> &quot;data in magic file&quot;,</td> </tr> <tr class="vc_row_odd" id="l808"> <td class="vc_file_line_number"><a href="#l808">808</a></td> <td class="vc_file_line_text"> state);</td> </tr> <tr class="vc_row_odd" id="l809"> <td class="vc_file_line_number"><a href="#l809">809</a></td> <td class="vc_file_line_text"> return HTTP_INTERNAL_SERVER_ERROR;</td> </tr> <tr class="vc_row_odd" id="l810"> <td class="vc_file_line_number"><a href="#l810">810</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l811"> <td class="vc_file_line_number"><a href="#l811">811</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l812"> <td class="vc_file_line_number"><a href="#l812">812</a></td> <td class="vc_file_line_text"> /* success! */</td> </tr> <tr class="vc_row_odd" id="l813"> <td class="vc_file_line_number"><a href="#l813">813</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l814"> <td class="vc_file_line_number"><a href="#l814">814</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l815"> <td class="vc_file_line_number"><a href="#l815">815</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l816"> <td class="vc_file_line_number"><a href="#l816">816</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l817"> <td class="vc_file_line_number"><a href="#l817">817</a></td> <td class="vc_file_line_text"> * magic_process - process input file r Apache API request record</td> </tr> <tr class="vc_row_odd" id="l818"> <td class="vc_file_line_number"><a href="#l818">818</a></td> <td class="vc_file_line_text"> * (formerly called &quot;process&quot; in file command, prefix added for clarity) Opens</td> </tr> <tr class="vc_row_odd" id="l819"> <td class="vc_file_line_number"><a href="#l819">819</a></td> <td class="vc_file_line_text"> * the file and reads a fixed-size buffer to begin processing the contents.</td> </tr> <tr class="vc_row_odd" id="l820"> <td class="vc_file_line_number"><a href="#l820">820</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l821"> <td class="vc_file_line_number"><a href="#l821">821</a></td> <td class="vc_file_line_text">static int magic_process(request_rec *r)</td> </tr> <tr class="vc_row_odd" id="l822"> <td class="vc_file_line_number"><a href="#l822">822</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l823"> <td class="vc_file_line_number"><a href="#l823">823</a></td> <td class="vc_file_line_text"> apr_file_t *fd = NULL;</td> </tr> <tr class="vc_row_odd" id="l824"> <td class="vc_file_line_number"><a href="#l824">824</a></td> <td class="vc_file_line_text"> unsigned char buf[HOWMANY + 1]; /* one extra for terminating &#39;\0&#39; */</td> </tr> <tr class="vc_row_odd" id="l825"> <td class="vc_file_line_number"><a href="#l825">825</a></td> <td class="vc_file_line_text"> apr_size_t nbytes = 0; /* number of bytes read from a datafile */</td> </tr> <tr class="vc_row_odd" id="l826"> <td class="vc_file_line_number"><a href="#l826">826</a></td> <td class="vc_file_line_text"> int result;</td> </tr> <tr class="vc_row_odd" id="l827"> <td class="vc_file_line_number"><a href="#l827">827</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l828"> <td class="vc_file_line_number"><a href="#l828">828</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l829"> <td class="vc_file_line_number"><a href="#l829">829</a></td> <td class="vc_file_line_text"> * first try judging the file based on its filesystem status</td> </tr> <tr class="vc_row_odd" id="l830"> <td class="vc_file_line_number"><a href="#l830">830</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l831"> <td class="vc_file_line_number"><a href="#l831">831</a></td> <td class="vc_file_line_text"> switch ((result = fsmagic(r, r-&gt;filename))) {</td> </tr> <tr class="vc_row_odd" id="l832"> <td class="vc_file_line_number"><a href="#l832">832</a></td> <td class="vc_file_line_text"> case DONE:</td> </tr> <tr class="vc_row_odd" id="l833"> <td class="vc_file_line_number"><a href="#l833">833</a></td> <td class="vc_file_line_text"> magic_rsl_putchar(r, &#39;\n&#39;);</td> </tr> <tr class="vc_row_odd" id="l834"> <td class="vc_file_line_number"><a href="#l834">834</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l835"> <td class="vc_file_line_number"><a href="#l835">835</a></td> <td class="vc_file_line_text"> case OK:</td> </tr> <tr class="vc_row_odd" id="l836"> <td class="vc_file_line_number"><a href="#l836">836</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l837"> <td class="vc_file_line_number"><a href="#l837">837</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l838"> <td class="vc_file_line_number"><a href="#l838">838</a></td> <td class="vc_file_line_text"> /* fatal error, bail out */</td> </tr> <tr class="vc_row_odd" id="l839"> <td class="vc_file_line_number"><a href="#l839">839</a></td> <td class="vc_file_line_text"> return result;</td> </tr> <tr class="vc_row_odd" id="l840"> <td class="vc_file_line_number"><a href="#l840">840</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l841"> <td class="vc_file_line_number"><a href="#l841">841</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l842"> <td class="vc_file_line_number"><a href="#l842">842</a></td> <td class="vc_file_line_text"> if (apr_file_open(&amp;fd, r-&gt;filename, APR_READ, APR_OS_DEFAULT, r-&gt;pool) != APR_SUCCESS) {</td> </tr> <tr class="vc_row_odd" id="l843"> <td class="vc_file_line_number"><a href="#l843">843</a></td> <td class="vc_file_line_text"> /* We can&#39;t open it, but we were able to stat it. */</td> </tr> <tr class="vc_row_odd" id="l844"> <td class="vc_file_line_number"><a href="#l844">844</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01512)</td> </tr> <tr class="vc_row_odd" id="l845"> <td class="vc_file_line_number"><a href="#l845">845</a></td> <td class="vc_file_line_text"> MODNAME &quot;: can&#39;t read `%s&#39;&quot;, r-&gt;filename);</td> </tr> <tr class="vc_row_odd" id="l846"> <td class="vc_file_line_number"><a href="#l846">846</a></td> <td class="vc_file_line_text"> /* let some other handler decide what the problem is */</td> </tr> <tr class="vc_row_odd" id="l847"> <td class="vc_file_line_number"><a href="#l847">847</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l848"> <td class="vc_file_line_number"><a href="#l848">848</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l849"> <td class="vc_file_line_number"><a href="#l849">849</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l850"> <td class="vc_file_line_number"><a href="#l850">850</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l851"> <td class="vc_file_line_number"><a href="#l851">851</a></td> <td class="vc_file_line_text"> * try looking at the first HOWMANY bytes</td> </tr> <tr class="vc_row_odd" id="l852"> <td class="vc_file_line_number"><a href="#l852">852</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l853"> <td class="vc_file_line_number"><a href="#l853">853</a></td> <td class="vc_file_line_text"> nbytes = sizeof(buf) - 1;</td> </tr> <tr class="vc_row_odd" id="l854"> <td class="vc_file_line_number"><a href="#l854">854</a></td> <td class="vc_file_line_text"> if ((result = apr_file_read(fd, (char *) buf, &amp;nbytes)) != APR_SUCCESS) {</td> </tr> <tr class="vc_row_odd" id="l855"> <td class="vc_file_line_number"><a href="#l855">855</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, result, r, APLOGNO(01513)</td> </tr> <tr class="vc_row_odd" id="l856"> <td class="vc_file_line_number"><a href="#l856">856</a></td> <td class="vc_file_line_text"> MODNAME &quot;: read failed: %s&quot;, r-&gt;filename);</td> </tr> <tr class="vc_row_odd" id="l857"> <td class="vc_file_line_number"><a href="#l857">857</a></td> <td class="vc_file_line_text"> return HTTP_INTERNAL_SERVER_ERROR;</td> </tr> <tr class="vc_row_odd" id="l858"> <td class="vc_file_line_number"><a href="#l858">858</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l859"> <td class="vc_file_line_number"><a href="#l859">859</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l860"> <td class="vc_file_line_number"><a href="#l860">860</a></td> <td class="vc_file_line_text"> if (nbytes == 0) {</td> </tr> <tr class="vc_row_odd" id="l861"> <td class="vc_file_line_number"><a href="#l861">861</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l862"> <td class="vc_file_line_number"><a href="#l862">862</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l863"> <td class="vc_file_line_number"><a href="#l863">863</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l864"> <td class="vc_file_line_number"><a href="#l864">864</a></td> <td class="vc_file_line_text"> buf[nbytes++] = &#39;\0&#39;; /* null-terminate it */</td> </tr> <tr class="vc_row_odd" id="l865"> <td class="vc_file_line_number"><a href="#l865">865</a></td> <td class="vc_file_line_text"> result = tryit(r, buf, nbytes, 1);</td> </tr> <tr class="vc_row_odd" id="l866"> <td class="vc_file_line_number"><a href="#l866">866</a></td> <td class="vc_file_line_text"> if (result != OK) {</td> </tr> <tr class="vc_row_odd" id="l867"> <td class="vc_file_line_number"><a href="#l867">867</a></td> <td class="vc_file_line_text"> return result;</td> </tr> <tr class="vc_row_odd" id="l868"> <td class="vc_file_line_number"><a href="#l868">868</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l869"> <td class="vc_file_line_number"><a href="#l869">869</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l870"> <td class="vc_file_line_number"><a href="#l870">870</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l871"> <td class="vc_file_line_number"><a href="#l871">871</a></td> <td class="vc_file_line_text"> (void) apr_file_close(fd);</td> </tr> <tr class="vc_row_odd" id="l872"> <td class="vc_file_line_number"><a href="#l872">872</a></td> <td class="vc_file_line_text"> (void) magic_rsl_putchar(r, &#39;\n&#39;);</td> </tr> <tr class="vc_row_odd" id="l873"> <td class="vc_file_line_number"><a href="#l873">873</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l874"> <td class="vc_file_line_number"><a href="#l874">874</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l875"> <td class="vc_file_line_number"><a href="#l875">875</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l876"> <td class="vc_file_line_number"><a href="#l876">876</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l877"> <td class="vc_file_line_number"><a href="#l877">877</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l878"> <td class="vc_file_line_number"><a href="#l878">878</a></td> <td class="vc_file_line_text">static int tryit(request_rec *r, unsigned char *buf, apr_size_t nb,</td> </tr> <tr class="vc_row_odd" id="l879"> <td class="vc_file_line_number"><a href="#l879">879</a></td> <td class="vc_file_line_text"> int checkzmagic)</td> </tr> <tr class="vc_row_odd" id="l880"> <td class="vc_file_line_number"><a href="#l880">880</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l881"> <td class="vc_file_line_number"><a href="#l881">881</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l882"> <td class="vc_file_line_number"><a href="#l882">882</a></td> <td class="vc_file_line_text"> * Try compression stuff</td> </tr> <tr class="vc_row_odd" id="l883"> <td class="vc_file_line_number"><a href="#l883">883</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l884"> <td class="vc_file_line_number"><a href="#l884">884</a></td> <td class="vc_file_line_text"> if (checkzmagic == 1) {</td> </tr> <tr class="vc_row_odd" id="l885"> <td class="vc_file_line_number"><a href="#l885">885</a></td> <td class="vc_file_line_text"> if (zmagic(r, buf, nb) == 1)</td> </tr> <tr class="vc_row_odd" id="l886"> <td class="vc_file_line_number"><a href="#l886">886</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l887"> <td class="vc_file_line_number"><a href="#l887">887</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l888"> <td class="vc_file_line_number"><a href="#l888">888</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l889"> <td class="vc_file_line_number"><a href="#l889">889</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l890"> <td class="vc_file_line_number"><a href="#l890">890</a></td> <td class="vc_file_line_text"> * try tests in /etc/magic (or surrogate magic file)</td> </tr> <tr class="vc_row_odd" id="l891"> <td class="vc_file_line_number"><a href="#l891">891</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l892"> <td class="vc_file_line_number"><a href="#l892">892</a></td> <td class="vc_file_line_text"> if (softmagic(r, buf, nb) == 1)</td> </tr> <tr class="vc_row_odd" id="l893"> <td class="vc_file_line_number"><a href="#l893">893</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l894"> <td class="vc_file_line_number"><a href="#l894">894</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l895"> <td class="vc_file_line_number"><a href="#l895">895</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l896"> <td class="vc_file_line_number"><a href="#l896">896</a></td> <td class="vc_file_line_text"> * try known keywords, check for ascii-ness too.</td> </tr> <tr class="vc_row_odd" id="l897"> <td class="vc_file_line_number"><a href="#l897">897</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l898"> <td class="vc_file_line_number"><a href="#l898">898</a></td> <td class="vc_file_line_text"> if (ascmagic(r, buf, nb) == 1)</td> </tr> <tr class="vc_row_odd" id="l899"> <td class="vc_file_line_number"><a href="#l899">899</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l900"> <td class="vc_file_line_number"><a href="#l900">900</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l901"> <td class="vc_file_line_number"><a href="#l901">901</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l902"> <td class="vc_file_line_number"><a href="#l902">902</a></td> <td class="vc_file_line_text"> * abandon hope, all ye who remain here</td> </tr> <tr class="vc_row_odd" id="l903"> <td class="vc_file_line_number"><a href="#l903">903</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l904"> <td class="vc_file_line_number"><a href="#l904">904</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l905"> <td class="vc_file_line_number"><a href="#l905">905</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l906"> <td class="vc_file_line_number"><a href="#l906">906</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l907"> <td class="vc_file_line_number"><a href="#l907">907</a></td> <td class="vc_file_line_text">#define EATAB {while (apr_isspace(*l)) ++l;}</td> </tr> <tr class="vc_row_odd" id="l908"> <td class="vc_file_line_number"><a href="#l908">908</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l909"> <td class="vc_file_line_number"><a href="#l909">909</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l910"> <td class="vc_file_line_number"><a href="#l910">910</a></td> <td class="vc_file_line_text"> * apprentice - load configuration from the magic file r</td> </tr> <tr class="vc_row_odd" id="l911"> <td class="vc_file_line_number"><a href="#l911">911</a></td> <td class="vc_file_line_text"> * API request record</td> </tr> <tr class="vc_row_odd" id="l912"> <td class="vc_file_line_number"><a href="#l912">912</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l913"> <td class="vc_file_line_number"><a href="#l913">913</a></td> <td class="vc_file_line_text">static int apprentice(server_rec *s, apr_pool_t *p)</td> </tr> <tr class="vc_row_odd" id="l914"> <td class="vc_file_line_number"><a href="#l914">914</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l915"> <td class="vc_file_line_number"><a href="#l915">915</a></td> <td class="vc_file_line_text"> apr_file_t *f = NULL;</td> </tr> <tr class="vc_row_odd" id="l916"> <td class="vc_file_line_number"><a href="#l916">916</a></td> <td class="vc_file_line_text"> apr_status_t result;</td> </tr> <tr class="vc_row_odd" id="l917"> <td class="vc_file_line_number"><a href="#l917">917</a></td> <td class="vc_file_line_text"> char line[BUFSIZ + 1];</td> </tr> <tr class="vc_row_odd" id="l918"> <td class="vc_file_line_number"><a href="#l918">918</a></td> <td class="vc_file_line_text"> int errs = 0;</td> </tr> <tr class="vc_row_odd" id="l919"> <td class="vc_file_line_number"><a href="#l919">919</a></td> <td class="vc_file_line_text"> int lineno;</td> </tr> <tr class="vc_row_odd" id="l920"> <td class="vc_file_line_number"><a href="#l920">920</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l921"> <td class="vc_file_line_number"><a href="#l921">921</a></td> <td class="vc_file_line_text"> int rule = 0;</td> </tr> <tr class="vc_row_odd" id="l922"> <td class="vc_file_line_number"><a href="#l922">922</a></td> <td class="vc_file_line_text"> struct magic *m, *prevm;</td> </tr> <tr class="vc_row_odd" id="l923"> <td class="vc_file_line_number"><a href="#l923">923</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l924"> <td class="vc_file_line_number"><a href="#l924">924</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf = (magic_server_config_rec *)</td> </tr> <tr class="vc_row_odd" id="l925"> <td class="vc_file_line_number"><a href="#l925">925</a></td> <td class="vc_file_line_text"> ap_get_module_config(s-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l926"> <td class="vc_file_line_number"><a href="#l926">926</a></td> <td class="vc_file_line_text"> const char *fname = ap_server_root_relative(p, conf-&gt;magicfile);</td> </tr> <tr class="vc_row_odd" id="l927"> <td class="vc_file_line_number"><a href="#l927">927</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l928"> <td class="vc_file_line_number"><a href="#l928">928</a></td> <td class="vc_file_line_text"> if (!fname) {</td> </tr> <tr class="vc_row_odd" id="l929"> <td class="vc_file_line_number"><a href="#l929">929</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s, APLOGNO(01514)</td> </tr> <tr class="vc_row_odd" id="l930"> <td class="vc_file_line_number"><a href="#l930">930</a></td> <td class="vc_file_line_text"> MODNAME &quot;: Invalid magic file path %s&quot;, conf-&gt;magicfile);</td> </tr> <tr class="vc_row_odd" id="l931"> <td class="vc_file_line_number"><a href="#l931">931</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l932"> <td class="vc_file_line_number"><a href="#l932">932</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l933"> <td class="vc_file_line_number"><a href="#l933">933</a></td> <td class="vc_file_line_text"> if ((result = apr_file_open(&amp;f, fname, APR_READ | APR_BUFFERED,</td> </tr> <tr class="vc_row_odd" id="l934"> <td class="vc_file_line_number"><a href="#l934">934</a></td> <td class="vc_file_line_text"> APR_OS_DEFAULT, p)) != APR_SUCCESS) {</td> </tr> <tr class="vc_row_odd" id="l935"> <td class="vc_file_line_number"><a href="#l935">935</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, result, s, APLOGNO(01515)</td> </tr> <tr class="vc_row_odd" id="l936"> <td class="vc_file_line_number"><a href="#l936">936</a></td> <td class="vc_file_line_text"> MODNAME &quot;: can&#39;t read magic file %s&quot;, fname);</td> </tr> <tr class="vc_row_odd" id="l937"> <td class="vc_file_line_number"><a href="#l937">937</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l938"> <td class="vc_file_line_number"><a href="#l938">938</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l939"> <td class="vc_file_line_number"><a href="#l939">939</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l940"> <td class="vc_file_line_number"><a href="#l940">940</a></td> <td class="vc_file_line_text"> /* set up the magic list (empty) */</td> </tr> <tr class="vc_row_odd" id="l941"> <td class="vc_file_line_number"><a href="#l941">941</a></td> <td class="vc_file_line_text"> conf-&gt;magic = conf-&gt;last = NULL;</td> </tr> <tr class="vc_row_odd" id="l942"> <td class="vc_file_line_number"><a href="#l942">942</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l943"> <td class="vc_file_line_number"><a href="#l943">943</a></td> <td class="vc_file_line_text"> /* parse it */</td> </tr> <tr class="vc_row_odd" id="l944"> <td class="vc_file_line_number"><a href="#l944">944</a></td> <td class="vc_file_line_text"> for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) {</td> </tr> <tr class="vc_row_odd" id="l945"> <td class="vc_file_line_number"><a href="#l945">945</a></td> <td class="vc_file_line_text"> int ws_offset;</td> </tr> <tr class="vc_row_odd" id="l946"> <td class="vc_file_line_number"><a href="#l946">946</a></td> <td class="vc_file_line_text"> char *last = line + strlen(line) - 1; /* guaranteed that len &gt;= 1 since an</td> </tr> <tr class="vc_row_odd" id="l947"> <td class="vc_file_line_number"><a href="#l947">947</a></td> <td class="vc_file_line_text"> * &quot;empty&quot; line contains a &#39;\n&#39;</td> </tr> <tr class="vc_row_odd" id="l948"> <td class="vc_file_line_number"><a href="#l948">948</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l949"> <td class="vc_file_line_number"><a href="#l949">949</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l950"> <td class="vc_file_line_number"><a href="#l950">950</a></td> <td class="vc_file_line_text"> /* delete newline and any other trailing whitespace */</td> </tr> <tr class="vc_row_odd" id="l951"> <td class="vc_file_line_number"><a href="#l951">951</a></td> <td class="vc_file_line_text"> while (last &gt;= line</td> </tr> <tr class="vc_row_odd" id="l952"> <td class="vc_file_line_number"><a href="#l952">952</a></td> <td class="vc_file_line_text"> &amp;&amp; apr_isspace(*last)) {</td> </tr> <tr class="vc_row_odd" id="l953"> <td class="vc_file_line_number"><a href="#l953">953</a></td> <td class="vc_file_line_text"> *last = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l954"> <td class="vc_file_line_number"><a href="#l954">954</a></td> <td class="vc_file_line_text"> --last;</td> </tr> <tr class="vc_row_odd" id="l955"> <td class="vc_file_line_number"><a href="#l955">955</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l956"> <td class="vc_file_line_number"><a href="#l956">956</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l957"> <td class="vc_file_line_number"><a href="#l957">957</a></td> <td class="vc_file_line_text"> /* skip leading whitespace */</td> </tr> <tr class="vc_row_odd" id="l958"> <td class="vc_file_line_number"><a href="#l958">958</a></td> <td class="vc_file_line_text"> ws_offset = 0;</td> </tr> <tr class="vc_row_odd" id="l959"> <td class="vc_file_line_number"><a href="#l959">959</a></td> <td class="vc_file_line_text"> while (line[ws_offset] &amp;&amp; apr_isspace(line[ws_offset])) {</td> </tr> <tr class="vc_row_odd" id="l960"> <td class="vc_file_line_number"><a href="#l960">960</a></td> <td class="vc_file_line_text"> ws_offset++;</td> </tr> <tr class="vc_row_odd" id="l961"> <td class="vc_file_line_number"><a href="#l961">961</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l962"> <td class="vc_file_line_number"><a href="#l962">962</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l963"> <td class="vc_file_line_number"><a href="#l963">963</a></td> <td class="vc_file_line_text"> /* skip blank lines */</td> </tr> <tr class="vc_row_odd" id="l964"> <td class="vc_file_line_number"><a href="#l964">964</a></td> <td class="vc_file_line_text"> if (line[ws_offset] == 0) {</td> </tr> <tr class="vc_row_odd" id="l965"> <td class="vc_file_line_number"><a href="#l965">965</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l966"> <td class="vc_file_line_number"><a href="#l966">966</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l967"> <td class="vc_file_line_number"><a href="#l967">967</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l968"> <td class="vc_file_line_number"><a href="#l968">968</a></td> <td class="vc_file_line_text"> /* comment, do not parse */</td> </tr> <tr class="vc_row_odd" id="l969"> <td class="vc_file_line_number"><a href="#l969">969</a></td> <td class="vc_file_line_text"> if (line[ws_offset] == &#39;#&#39;)</td> </tr> <tr class="vc_row_odd" id="l970"> <td class="vc_file_line_number"><a href="#l970">970</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l971"> <td class="vc_file_line_number"><a href="#l971">971</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l972"> <td class="vc_file_line_number"><a href="#l972">972</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l973"> <td class="vc_file_line_number"><a href="#l973">973</a></td> <td class="vc_file_line_text"> /* if we get here, we&#39;re going to use it so count it */</td> </tr> <tr class="vc_row_odd" id="l974"> <td class="vc_file_line_number"><a href="#l974">974</a></td> <td class="vc_file_line_text"> rule++;</td> </tr> <tr class="vc_row_odd" id="l975"> <td class="vc_file_line_number"><a href="#l975">975</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l976"> <td class="vc_file_line_number"><a href="#l976">976</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l977"> <td class="vc_file_line_number"><a href="#l977">977</a></td> <td class="vc_file_line_text"> /* parse it */</td> </tr> <tr class="vc_row_odd" id="l978"> <td class="vc_file_line_number"><a href="#l978">978</a></td> <td class="vc_file_line_text"> if (parse(s, p, line + ws_offset, lineno) != 0)</td> </tr> <tr class="vc_row_odd" id="l979"> <td class="vc_file_line_number"><a href="#l979">979</a></td> <td class="vc_file_line_text"> ++errs;</td> </tr> <tr class="vc_row_odd" id="l980"> <td class="vc_file_line_number"><a href="#l980">980</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l981"> <td class="vc_file_line_number"><a href="#l981">981</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l982"> <td class="vc_file_line_number"><a href="#l982">982</a></td> <td class="vc_file_line_text"> (void) apr_file_close(f);</td> </tr> <tr class="vc_row_odd" id="l983"> <td class="vc_file_line_number"><a href="#l983">983</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l984"> <td class="vc_file_line_number"><a href="#l984">984</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l985"> <td class="vc_file_line_number"><a href="#l985">985</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01516)</td> </tr> <tr class="vc_row_odd" id="l986"> <td class="vc_file_line_number"><a href="#l986">986</a></td> <td class="vc_file_line_text"> MODNAME &quot;: apprentice conf=%pp file=%s m=%s m-&gt;next=%s last=%s&quot;,</td> </tr> <tr class="vc_row_odd" id="l987"> <td class="vc_file_line_number"><a href="#l987">987</a></td> <td class="vc_file_line_text"> conf,</td> </tr> <tr class="vc_row_odd" id="l988"> <td class="vc_file_line_number"><a href="#l988">988</a></td> <td class="vc_file_line_text"> conf-&gt;magicfile ? conf-&gt;magicfile : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l989"> <td class="vc_file_line_number"><a href="#l989">989</a></td> <td class="vc_file_line_text"> conf-&gt;magic ? &quot;set&quot; : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l990"> <td class="vc_file_line_number"><a href="#l990">990</a></td> <td class="vc_file_line_text"> (conf-&gt;magic &amp;&amp; conf-&gt;magic-&gt;next) ? &quot;set&quot; : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l991"> <td class="vc_file_line_number"><a href="#l991">991</a></td> <td class="vc_file_line_text"> conf-&gt;last ? &quot;set&quot; : &quot;NULL&quot;);</td> </tr> <tr class="vc_row_odd" id="l992"> <td class="vc_file_line_number"><a href="#l992">992</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01517)</td> </tr> <tr class="vc_row_odd" id="l993"> <td class="vc_file_line_number"><a href="#l993">993</a></td> <td class="vc_file_line_text"> MODNAME &quot;: apprentice read %d lines, %d rules, %d errors&quot;,</td> </tr> <tr class="vc_row_odd" id="l994"> <td class="vc_file_line_number"><a href="#l994">994</a></td> <td class="vc_file_line_text"> lineno, rule, errs);</td> </tr> <tr class="vc_row_odd" id="l995"> <td class="vc_file_line_number"><a href="#l995">995</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l996"> <td class="vc_file_line_number"><a href="#l996">996</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l997"> <td class="vc_file_line_number"><a href="#l997">997</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l998"> <td class="vc_file_line_number"><a href="#l998">998</a></td> <td class="vc_file_line_text"> prevm = 0;</td> </tr> <tr class="vc_row_odd" id="l999"> <td class="vc_file_line_number"><a href="#l999">999</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01518)</td> </tr> <tr class="vc_row_odd" id="l1000"> <td class="vc_file_line_number"><a href="#l1000">1000</a></td> <td class="vc_file_line_text"> MODNAME &quot;: apprentice test&quot;);</td> </tr> <tr class="vc_row_odd" id="l1001"> <td class="vc_file_line_number"><a href="#l1001">1001</a></td> <td class="vc_file_line_text"> for (m = conf-&gt;magic; m; m = m-&gt;next) {</td> </tr> <tr class="vc_row_odd" id="l1002"> <td class="vc_file_line_number"><a href="#l1002">1002</a></td> <td class="vc_file_line_text"> if (apr_isprint((((unsigned long) m) &gt;&gt; 24) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1003"> <td class="vc_file_line_number"><a href="#l1003">1003</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 16) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1004"> <td class="vc_file_line_number"><a href="#l1004">1004</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 8) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1005"> <td class="vc_file_line_number"><a href="#l1005">1005</a></td> <td class="vc_file_line_text"> apr_isprint(((unsigned long) m) &amp; 255)) {</td> </tr> <tr class="vc_row_odd" id="l1006"> <td class="vc_file_line_number"><a href="#l1006">1006</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01519)</td> </tr> <tr class="vc_row_odd" id="l1007"> <td class="vc_file_line_number"><a href="#l1007">1007</a></td> <td class="vc_file_line_text"> MODNAME &quot;: apprentice: POINTER CLOBBERED! &quot;</td> </tr> <tr class="vc_row_odd" id="l1008"> <td class="vc_file_line_number"><a href="#l1008">1008</a></td> <td class="vc_file_line_text"> &quot;m=\&quot;%c%c%c%c\&quot; line=%d&quot;,</td> </tr> <tr class="vc_row_odd" id="l1009"> <td class="vc_file_line_number"><a href="#l1009">1009</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 24) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1010"> <td class="vc_file_line_number"><a href="#l1010">1010</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 16) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1011"> <td class="vc_file_line_number"><a href="#l1011">1011</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 8 ) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1012"> <td class="vc_file_line_number"><a href="#l1012">1012</a></td> <td class="vc_file_line_text"> (char)(( (unsigned long) m ) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1013"> <td class="vc_file_line_number"><a href="#l1013">1013</a></td> <td class="vc_file_line_text"> prevm ? prevm-&gt;lineno : -1);</td> </tr> <tr class="vc_row_odd" id="l1014"> <td class="vc_file_line_number"><a href="#l1014">1014</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1015"> <td class="vc_file_line_number"><a href="#l1015">1015</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1016"> <td class="vc_file_line_number"><a href="#l1016">1016</a></td> <td class="vc_file_line_text"> prevm = m;</td> </tr> <tr class="vc_row_odd" id="l1017"> <td class="vc_file_line_number"><a href="#l1017">1017</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1018"> <td class="vc_file_line_number"><a href="#l1018">1018</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1019"> <td class="vc_file_line_number"><a href="#l1019">1019</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1020"> <td class="vc_file_line_number"><a href="#l1020">1020</a></td> <td class="vc_file_line_text"> return (errs ? -1 : 0);</td> </tr> <tr class="vc_row_odd" id="l1021"> <td class="vc_file_line_number"><a href="#l1021">1021</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1022"> <td class="vc_file_line_number"><a href="#l1022">1022</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1023"> <td class="vc_file_line_number"><a href="#l1023">1023</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1024"> <td class="vc_file_line_number"><a href="#l1024">1024</a></td> <td class="vc_file_line_text"> * extend the sign bit if the comparison is to be signed</td> </tr> <tr class="vc_row_odd" id="l1025"> <td class="vc_file_line_number"><a href="#l1025">1025</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1026"> <td class="vc_file_line_number"><a href="#l1026">1026</a></td> <td class="vc_file_line_text">static unsigned long signextend(server_rec *s, struct magic *m, unsigned long v)</td> </tr> <tr class="vc_row_odd" id="l1027"> <td class="vc_file_line_number"><a href="#l1027">1027</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1028"> <td class="vc_file_line_number"><a href="#l1028">1028</a></td> <td class="vc_file_line_text"> if (!(m-&gt;flag &amp; UNSIGNED))</td> </tr> <tr class="vc_row_odd" id="l1029"> <td class="vc_file_line_number"><a href="#l1029">1029</a></td> <td class="vc_file_line_text"> switch (m-&gt;type) {</td> </tr> <tr class="vc_row_odd" id="l1030"> <td class="vc_file_line_number"><a href="#l1030">1030</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1031"> <td class="vc_file_line_number"><a href="#l1031">1031</a></td> <td class="vc_file_line_text"> * Do not remove the casts below. They are vital. When later</td> </tr> <tr class="vc_row_odd" id="l1032"> <td class="vc_file_line_number"><a href="#l1032">1032</a></td> <td class="vc_file_line_text"> * compared with the data, the sign extension must have happened.</td> </tr> <tr class="vc_row_odd" id="l1033"> <td class="vc_file_line_number"><a href="#l1033">1033</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1034"> <td class="vc_file_line_number"><a href="#l1034">1034</a></td> <td class="vc_file_line_text"> case BYTE:</td> </tr> <tr class="vc_row_odd" id="l1035"> <td class="vc_file_line_number"><a href="#l1035">1035</a></td> <td class="vc_file_line_text"> v = (char) v;</td> </tr> <tr class="vc_row_odd" id="l1036"> <td class="vc_file_line_number"><a href="#l1036">1036</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1037"> <td class="vc_file_line_number"><a href="#l1037">1037</a></td> <td class="vc_file_line_text"> case SHORT:</td> </tr> <tr class="vc_row_odd" id="l1038"> <td class="vc_file_line_number"><a href="#l1038">1038</a></td> <td class="vc_file_line_text"> case BESHORT:</td> </tr> <tr class="vc_row_odd" id="l1039"> <td class="vc_file_line_number"><a href="#l1039">1039</a></td> <td class="vc_file_line_text"> case LESHORT:</td> </tr> <tr class="vc_row_odd" id="l1040"> <td class="vc_file_line_number"><a href="#l1040">1040</a></td> <td class="vc_file_line_text"> v = (short) v;</td> </tr> <tr class="vc_row_odd" id="l1041"> <td class="vc_file_line_number"><a href="#l1041">1041</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1042"> <td class="vc_file_line_number"><a href="#l1042">1042</a></td> <td class="vc_file_line_text"> case DATE:</td> </tr> <tr class="vc_row_odd" id="l1043"> <td class="vc_file_line_number"><a href="#l1043">1043</a></td> <td class="vc_file_line_text"> case BEDATE:</td> </tr> <tr class="vc_row_odd" id="l1044"> <td class="vc_file_line_number"><a href="#l1044">1044</a></td> <td class="vc_file_line_text"> case LEDATE:</td> </tr> <tr class="vc_row_odd" id="l1045"> <td class="vc_file_line_number"><a href="#l1045">1045</a></td> <td class="vc_file_line_text"> case LONG:</td> </tr> <tr class="vc_row_odd" id="l1046"> <td class="vc_file_line_number"><a href="#l1046">1046</a></td> <td class="vc_file_line_text"> case BELONG:</td> </tr> <tr class="vc_row_odd" id="l1047"> <td class="vc_file_line_number"><a href="#l1047">1047</a></td> <td class="vc_file_line_text"> case LELONG:</td> </tr> <tr class="vc_row_odd" id="l1048"> <td class="vc_file_line_number"><a href="#l1048">1048</a></td> <td class="vc_file_line_text"> v = (long) v;</td> </tr> <tr class="vc_row_odd" id="l1049"> <td class="vc_file_line_number"><a href="#l1049">1049</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1050"> <td class="vc_file_line_number"><a href="#l1050">1050</a></td> <td class="vc_file_line_text"> case STRING:</td> </tr> <tr class="vc_row_odd" id="l1051"> <td class="vc_file_line_number"><a href="#l1051">1051</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1052"> <td class="vc_file_line_number"><a href="#l1052">1052</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1053"> <td class="vc_file_line_number"><a href="#l1053">1053</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(01520)</td> </tr> <tr class="vc_row_odd" id="l1054"> <td class="vc_file_line_number"><a href="#l1054">1054</a></td> <td class="vc_file_line_text"> MODNAME &quot;: can&#39;t happen: m-&gt;type=%d&quot;, m-&gt;type);</td> </tr> <tr class="vc_row_odd" id="l1055"> <td class="vc_file_line_number"><a href="#l1055">1055</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l1056"> <td class="vc_file_line_number"><a href="#l1056">1056</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1057"> <td class="vc_file_line_number"><a href="#l1057">1057</a></td> <td class="vc_file_line_text"> return v;</td> </tr> <tr class="vc_row_odd" id="l1058"> <td class="vc_file_line_number"><a href="#l1058">1058</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1059"> <td class="vc_file_line_number"><a href="#l1059">1059</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1060"> <td class="vc_file_line_number"><a href="#l1060">1060</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1061"> <td class="vc_file_line_number"><a href="#l1061">1061</a></td> <td class="vc_file_line_text"> * parse one line from magic file, put into magic[index++] if valid</td> </tr> <tr class="vc_row_odd" id="l1062"> <td class="vc_file_line_number"><a href="#l1062">1062</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1063"> <td class="vc_file_line_number"><a href="#l1063">1063</a></td> <td class="vc_file_line_text">static int parse(server_rec *serv, apr_pool_t *p, char *l, int lineno)</td> </tr> <tr class="vc_row_odd" id="l1064"> <td class="vc_file_line_number"><a href="#l1064">1064</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1065"> <td class="vc_file_line_number"><a href="#l1065">1065</a></td> <td class="vc_file_line_text"> struct magic *m;</td> </tr> <tr class="vc_row_odd" id="l1066"> <td class="vc_file_line_number"><a href="#l1066">1066</a></td> <td class="vc_file_line_text"> char *t, *s;</td> </tr> <tr class="vc_row_odd" id="l1067"> <td class="vc_file_line_number"><a href="#l1067">1067</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf = (magic_server_config_rec *)</td> </tr> <tr class="vc_row_odd" id="l1068"> <td class="vc_file_line_number"><a href="#l1068">1068</a></td> <td class="vc_file_line_text"> ap_get_module_config(serv-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l1069"> <td class="vc_file_line_number"><a href="#l1069">1069</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1070"> <td class="vc_file_line_number"><a href="#l1070">1070</a></td> <td class="vc_file_line_text"> /* allocate magic structure entry */</td> </tr> <tr class="vc_row_odd" id="l1071"> <td class="vc_file_line_number"><a href="#l1071">1071</a></td> <td class="vc_file_line_text"> m = (struct magic *) apr_pcalloc(p, sizeof(struct magic));</td> </tr> <tr class="vc_row_odd" id="l1072"> <td class="vc_file_line_number"><a href="#l1072">1072</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1073"> <td class="vc_file_line_number"><a href="#l1073">1073</a></td> <td class="vc_file_line_text"> /* append to linked list */</td> </tr> <tr class="vc_row_odd" id="l1074"> <td class="vc_file_line_number"><a href="#l1074">1074</a></td> <td class="vc_file_line_text"> m-&gt;next = NULL;</td> </tr> <tr class="vc_row_odd" id="l1075"> <td class="vc_file_line_number"><a href="#l1075">1075</a></td> <td class="vc_file_line_text"> if (!conf-&gt;magic || !conf-&gt;last) {</td> </tr> <tr class="vc_row_odd" id="l1076"> <td class="vc_file_line_number"><a href="#l1076">1076</a></td> <td class="vc_file_line_text"> conf-&gt;magic = conf-&gt;last = m;</td> </tr> <tr class="vc_row_odd" id="l1077"> <td class="vc_file_line_number"><a href="#l1077">1077</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1078"> <td class="vc_file_line_number"><a href="#l1078">1078</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l1079"> <td class="vc_file_line_number"><a href="#l1079">1079</a></td> <td class="vc_file_line_text"> conf-&gt;last-&gt;next = m;</td> </tr> <tr class="vc_row_odd" id="l1080"> <td class="vc_file_line_number"><a href="#l1080">1080</a></td> <td class="vc_file_line_text"> conf-&gt;last = m;</td> </tr> <tr class="vc_row_odd" id="l1081"> <td class="vc_file_line_number"><a href="#l1081">1081</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1082"> <td class="vc_file_line_number"><a href="#l1082">1082</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1083"> <td class="vc_file_line_number"><a href="#l1083">1083</a></td> <td class="vc_file_line_text"> /* set values in magic structure */</td> </tr> <tr class="vc_row_odd" id="l1084"> <td class="vc_file_line_number"><a href="#l1084">1084</a></td> <td class="vc_file_line_text"> m-&gt;flag = 0;</td> </tr> <tr class="vc_row_odd" id="l1085"> <td class="vc_file_line_number"><a href="#l1085">1085</a></td> <td class="vc_file_line_text"> m-&gt;cont_level = 0;</td> </tr> <tr class="vc_row_odd" id="l1086"> <td class="vc_file_line_number"><a href="#l1086">1086</a></td> <td class="vc_file_line_text"> m-&gt;lineno = lineno;</td> </tr> <tr class="vc_row_odd" id="l1087"> <td class="vc_file_line_number"><a href="#l1087">1087</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1088"> <td class="vc_file_line_number"><a href="#l1088">1088</a></td> <td class="vc_file_line_text"> while (*l == &#39;&gt;&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1089"> <td class="vc_file_line_number"><a href="#l1089">1089</a></td> <td class="vc_file_line_text"> ++l; /* step over */</td> </tr> <tr class="vc_row_odd" id="l1090"> <td class="vc_file_line_number"><a href="#l1090">1090</a></td> <td class="vc_file_line_text"> m-&gt;cont_level++;</td> </tr> <tr class="vc_row_odd" id="l1091"> <td class="vc_file_line_number"><a href="#l1091">1091</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1092"> <td class="vc_file_line_number"><a href="#l1092">1092</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1093"> <td class="vc_file_line_number"><a href="#l1093">1093</a></td> <td class="vc_file_line_text"> if (m-&gt;cont_level != 0 &amp;&amp; *l == &#39;(&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1094"> <td class="vc_file_line_number"><a href="#l1094">1094</a></td> <td class="vc_file_line_text"> ++l; /* step over */</td> </tr> <tr class="vc_row_odd" id="l1095"> <td class="vc_file_line_number"><a href="#l1095">1095</a></td> <td class="vc_file_line_text"> m-&gt;flag |= INDIR;</td> </tr> <tr class="vc_row_odd" id="l1096"> <td class="vc_file_line_number"><a href="#l1096">1096</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1097"> <td class="vc_file_line_number"><a href="#l1097">1097</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1098"> <td class="vc_file_line_number"><a href="#l1098">1098</a></td> <td class="vc_file_line_text"> /* get offset, then skip over it */</td> </tr> <tr class="vc_row_odd" id="l1099"> <td class="vc_file_line_number"><a href="#l1099">1099</a></td> <td class="vc_file_line_text"> m-&gt;offset = (int) strtol(l, &amp;t, 0);</td> </tr> <tr class="vc_row_odd" id="l1100"> <td class="vc_file_line_number"><a href="#l1100">1100</a></td> <td class="vc_file_line_text"> if (l == t) {</td> </tr> <tr class="vc_row_odd" id="l1101"> <td class="vc_file_line_number"><a href="#l1101">1101</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv, APLOGNO(01521)</td> </tr> <tr class="vc_row_odd" id="l1102"> <td class="vc_file_line_number"><a href="#l1102">1102</a></td> <td class="vc_file_line_text"> MODNAME &quot;: offset %s invalid&quot;, l);</td> </tr> <tr class="vc_row_odd" id="l1103"> <td class="vc_file_line_number"><a href="#l1103">1103</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1104"> <td class="vc_file_line_number"><a href="#l1104">1104</a></td> <td class="vc_file_line_text"> l = t;</td> </tr> <tr class="vc_row_odd" id="l1105"> <td class="vc_file_line_number"><a href="#l1105">1105</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1106"> <td class="vc_file_line_number"><a href="#l1106">1106</a></td> <td class="vc_file_line_text"> if (m-&gt;flag &amp; INDIR) {</td> </tr> <tr class="vc_row_odd" id="l1107"> <td class="vc_file_line_number"><a href="#l1107">1107</a></td> <td class="vc_file_line_text"> m-&gt;in.type = LONG;</td> </tr> <tr class="vc_row_odd" id="l1108"> <td class="vc_file_line_number"><a href="#l1108">1108</a></td> <td class="vc_file_line_text"> m-&gt;in.offset = 0;</td> </tr> <tr class="vc_row_odd" id="l1109"> <td class="vc_file_line_number"><a href="#l1109">1109</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1110"> <td class="vc_file_line_number"><a href="#l1110">1110</a></td> <td class="vc_file_line_text"> * read [.lbs][+-]nnnnn)</td> </tr> <tr class="vc_row_odd" id="l1111"> <td class="vc_file_line_number"><a href="#l1111">1111</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1112"> <td class="vc_file_line_number"><a href="#l1112">1112</a></td> <td class="vc_file_line_text"> if (*l == &#39;.&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1113"> <td class="vc_file_line_number"><a href="#l1113">1113</a></td> <td class="vc_file_line_text"> switch (*++l) {</td> </tr> <tr class="vc_row_odd" id="l1114"> <td class="vc_file_line_number"><a href="#l1114">1114</a></td> <td class="vc_file_line_text"> case &#39;l&#39;:</td> </tr> <tr class="vc_row_odd" id="l1115"> <td class="vc_file_line_number"><a href="#l1115">1115</a></td> <td class="vc_file_line_text"> m-&gt;in.type = LONG;</td> </tr> <tr class="vc_row_odd" id="l1116"> <td class="vc_file_line_number"><a href="#l1116">1116</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1117"> <td class="vc_file_line_number"><a href="#l1117">1117</a></td> <td class="vc_file_line_text"> case &#39;s&#39;:</td> </tr> <tr class="vc_row_odd" id="l1118"> <td class="vc_file_line_number"><a href="#l1118">1118</a></td> <td class="vc_file_line_text"> m-&gt;in.type = SHORT;</td> </tr> <tr class="vc_row_odd" id="l1119"> <td class="vc_file_line_number"><a href="#l1119">1119</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1120"> <td class="vc_file_line_number"><a href="#l1120">1120</a></td> <td class="vc_file_line_text"> case &#39;b&#39;:</td> </tr> <tr class="vc_row_odd" id="l1121"> <td class="vc_file_line_number"><a href="#l1121">1121</a></td> <td class="vc_file_line_text"> m-&gt;in.type = BYTE;</td> </tr> <tr class="vc_row_odd" id="l1122"> <td class="vc_file_line_number"><a href="#l1122">1122</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1123"> <td class="vc_file_line_number"><a href="#l1123">1123</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1124"> <td class="vc_file_line_number"><a href="#l1124">1124</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv, APLOGNO(01522)</td> </tr> <tr class="vc_row_odd" id="l1125"> <td class="vc_file_line_number"><a href="#l1125">1125</a></td> <td class="vc_file_line_text"> MODNAME &quot;: indirect offset type %c invalid&quot;, *l);</td> </tr> <tr class="vc_row_odd" id="l1126"> <td class="vc_file_line_number"><a href="#l1126">1126</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1127"> <td class="vc_file_line_number"><a href="#l1127">1127</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1128"> <td class="vc_file_line_number"><a href="#l1128">1128</a></td> <td class="vc_file_line_text"> l++;</td> </tr> <tr class="vc_row_odd" id="l1129"> <td class="vc_file_line_number"><a href="#l1129">1129</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1130"> <td class="vc_file_line_number"><a href="#l1130">1130</a></td> <td class="vc_file_line_text"> s = l;</td> </tr> <tr class="vc_row_odd" id="l1131"> <td class="vc_file_line_number"><a href="#l1131">1131</a></td> <td class="vc_file_line_text"> if (*l == &#39;+&#39; || *l == &#39;-&#39;)</td> </tr> <tr class="vc_row_odd" id="l1132"> <td class="vc_file_line_number"><a href="#l1132">1132</a></td> <td class="vc_file_line_text"> l++;</td> </tr> <tr class="vc_row_odd" id="l1133"> <td class="vc_file_line_number"><a href="#l1133">1133</a></td> <td class="vc_file_line_text"> if (apr_isdigit((unsigned char) *l)) {</td> </tr> <tr class="vc_row_odd" id="l1134"> <td class="vc_file_line_number"><a href="#l1134">1134</a></td> <td class="vc_file_line_text"> m-&gt;in.offset = strtol(l, &amp;t, 0);</td> </tr> <tr class="vc_row_odd" id="l1135"> <td class="vc_file_line_number"><a href="#l1135">1135</a></td> <td class="vc_file_line_text"> if (*s == &#39;-&#39;)</td> </tr> <tr class="vc_row_odd" id="l1136"> <td class="vc_file_line_number"><a href="#l1136">1136</a></td> <td class="vc_file_line_text"> m-&gt;in.offset = -m-&gt;in.offset;</td> </tr> <tr class="vc_row_odd" id="l1137"> <td class="vc_file_line_number"><a href="#l1137">1137</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1138"> <td class="vc_file_line_number"><a href="#l1138">1138</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1139"> <td class="vc_file_line_number"><a href="#l1139">1139</a></td> <td class="vc_file_line_text"> t = l;</td> </tr> <tr class="vc_row_odd" id="l1140"> <td class="vc_file_line_number"><a href="#l1140">1140</a></td> <td class="vc_file_line_text"> if (*t++ != &#39;)&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1141"> <td class="vc_file_line_number"><a href="#l1141">1141</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv, APLOGNO(01523)</td> </tr> <tr class="vc_row_odd" id="l1142"> <td class="vc_file_line_number"><a href="#l1142">1142</a></td> <td class="vc_file_line_text"> MODNAME &quot;: missing &#39;)&#39; in indirect offset&quot;);</td> </tr> <tr class="vc_row_odd" id="l1143"> <td class="vc_file_line_number"><a href="#l1143">1143</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1144"> <td class="vc_file_line_number"><a href="#l1144">1144</a></td> <td class="vc_file_line_text"> l = t;</td> </tr> <tr class="vc_row_odd" id="l1145"> <td class="vc_file_line_number"><a href="#l1145">1145</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1146"> <td class="vc_file_line_number"><a href="#l1146">1146</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1147"> <td class="vc_file_line_number"><a href="#l1147">1147</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1148"> <td class="vc_file_line_number"><a href="#l1148">1148</a></td> <td class="vc_file_line_text"> while (apr_isdigit((unsigned char) *l))</td> </tr> <tr class="vc_row_odd" id="l1149"> <td class="vc_file_line_number"><a href="#l1149">1149</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1150"> <td class="vc_file_line_number"><a href="#l1150">1150</a></td> <td class="vc_file_line_text"> EATAB;</td> </tr> <tr class="vc_row_odd" id="l1151"> <td class="vc_file_line_number"><a href="#l1151">1151</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1152"> <td class="vc_file_line_number"><a href="#l1152">1152</a></td> <td class="vc_file_line_text">#define NBYTE 4</td> </tr> <tr class="vc_row_odd" id="l1153"> <td class="vc_file_line_number"><a href="#l1153">1153</a></td> <td class="vc_file_line_text">#define NSHORT 5</td> </tr> <tr class="vc_row_odd" id="l1154"> <td class="vc_file_line_number"><a href="#l1154">1154</a></td> <td class="vc_file_line_text">#define NLONG 4</td> </tr> <tr class="vc_row_odd" id="l1155"> <td class="vc_file_line_number"><a href="#l1155">1155</a></td> <td class="vc_file_line_text">#define NSTRING 6</td> </tr> <tr class="vc_row_odd" id="l1156"> <td class="vc_file_line_number"><a href="#l1156">1156</a></td> <td class="vc_file_line_text">#define NDATE 4</td> </tr> <tr class="vc_row_odd" id="l1157"> <td class="vc_file_line_number"><a href="#l1157">1157</a></td> <td class="vc_file_line_text">#define NBESHORT 7</td> </tr> <tr class="vc_row_odd" id="l1158"> <td class="vc_file_line_number"><a href="#l1158">1158</a></td> <td class="vc_file_line_text">#define NBELONG 6</td> </tr> <tr class="vc_row_odd" id="l1159"> <td class="vc_file_line_number"><a href="#l1159">1159</a></td> <td class="vc_file_line_text">#define NBEDATE 6</td> </tr> <tr class="vc_row_odd" id="l1160"> <td class="vc_file_line_number"><a href="#l1160">1160</a></td> <td class="vc_file_line_text">#define NLESHORT 7</td> </tr> <tr class="vc_row_odd" id="l1161"> <td class="vc_file_line_number"><a href="#l1161">1161</a></td> <td class="vc_file_line_text">#define NLELONG 6</td> </tr> <tr class="vc_row_odd" id="l1162"> <td class="vc_file_line_number"><a href="#l1162">1162</a></td> <td class="vc_file_line_text">#define NLEDATE 6</td> </tr> <tr class="vc_row_odd" id="l1163"> <td class="vc_file_line_number"><a href="#l1163">1163</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1164"> <td class="vc_file_line_number"><a href="#l1164">1164</a></td> <td class="vc_file_line_text"> if (*l == &#39;u&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1165"> <td class="vc_file_line_number"><a href="#l1165">1165</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1166"> <td class="vc_file_line_number"><a href="#l1166">1166</a></td> <td class="vc_file_line_text"> m-&gt;flag |= UNSIGNED;</td> </tr> <tr class="vc_row_odd" id="l1167"> <td class="vc_file_line_number"><a href="#l1167">1167</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1168"> <td class="vc_file_line_number"><a href="#l1168">1168</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1169"> <td class="vc_file_line_number"><a href="#l1169">1169</a></td> <td class="vc_file_line_text"> /* get type, skip it */</td> </tr> <tr class="vc_row_odd" id="l1170"> <td class="vc_file_line_number"><a href="#l1170">1170</a></td> <td class="vc_file_line_text"> if (strncmp(l, &quot;byte&quot;, NBYTE) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1171"> <td class="vc_file_line_number"><a href="#l1171">1171</a></td> <td class="vc_file_line_text"> m-&gt;type = BYTE;</td> </tr> <tr class="vc_row_odd" id="l1172"> <td class="vc_file_line_number"><a href="#l1172">1172</a></td> <td class="vc_file_line_text"> l += NBYTE;</td> </tr> <tr class="vc_row_odd" id="l1173"> <td class="vc_file_line_number"><a href="#l1173">1173</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1174"> <td class="vc_file_line_number"><a href="#l1174">1174</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;short&quot;, NSHORT) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1175"> <td class="vc_file_line_number"><a href="#l1175">1175</a></td> <td class="vc_file_line_text"> m-&gt;type = SHORT;</td> </tr> <tr class="vc_row_odd" id="l1176"> <td class="vc_file_line_number"><a href="#l1176">1176</a></td> <td class="vc_file_line_text"> l += NSHORT;</td> </tr> <tr class="vc_row_odd" id="l1177"> <td class="vc_file_line_number"><a href="#l1177">1177</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1178"> <td class="vc_file_line_number"><a href="#l1178">1178</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;long&quot;, NLONG) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1179"> <td class="vc_file_line_number"><a href="#l1179">1179</a></td> <td class="vc_file_line_text"> m-&gt;type = LONG;</td> </tr> <tr class="vc_row_odd" id="l1180"> <td class="vc_file_line_number"><a href="#l1180">1180</a></td> <td class="vc_file_line_text"> l += NLONG;</td> </tr> <tr class="vc_row_odd" id="l1181"> <td class="vc_file_line_number"><a href="#l1181">1181</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1182"> <td class="vc_file_line_number"><a href="#l1182">1182</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;string&quot;, NSTRING) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1183"> <td class="vc_file_line_number"><a href="#l1183">1183</a></td> <td class="vc_file_line_text"> m-&gt;type = STRING;</td> </tr> <tr class="vc_row_odd" id="l1184"> <td class="vc_file_line_number"><a href="#l1184">1184</a></td> <td class="vc_file_line_text"> l += NSTRING;</td> </tr> <tr class="vc_row_odd" id="l1185"> <td class="vc_file_line_number"><a href="#l1185">1185</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1186"> <td class="vc_file_line_number"><a href="#l1186">1186</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;date&quot;, NDATE) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1187"> <td class="vc_file_line_number"><a href="#l1187">1187</a></td> <td class="vc_file_line_text"> m-&gt;type = DATE;</td> </tr> <tr class="vc_row_odd" id="l1188"> <td class="vc_file_line_number"><a href="#l1188">1188</a></td> <td class="vc_file_line_text"> l += NDATE;</td> </tr> <tr class="vc_row_odd" id="l1189"> <td class="vc_file_line_number"><a href="#l1189">1189</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1190"> <td class="vc_file_line_number"><a href="#l1190">1190</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;beshort&quot;, NBESHORT) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1191"> <td class="vc_file_line_number"><a href="#l1191">1191</a></td> <td class="vc_file_line_text"> m-&gt;type = BESHORT;</td> </tr> <tr class="vc_row_odd" id="l1192"> <td class="vc_file_line_number"><a href="#l1192">1192</a></td> <td class="vc_file_line_text"> l += NBESHORT;</td> </tr> <tr class="vc_row_odd" id="l1193"> <td class="vc_file_line_number"><a href="#l1193">1193</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1194"> <td class="vc_file_line_number"><a href="#l1194">1194</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;belong&quot;, NBELONG) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1195"> <td class="vc_file_line_number"><a href="#l1195">1195</a></td> <td class="vc_file_line_text"> m-&gt;type = BELONG;</td> </tr> <tr class="vc_row_odd" id="l1196"> <td class="vc_file_line_number"><a href="#l1196">1196</a></td> <td class="vc_file_line_text"> l += NBELONG;</td> </tr> <tr class="vc_row_odd" id="l1197"> <td class="vc_file_line_number"><a href="#l1197">1197</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1198"> <td class="vc_file_line_number"><a href="#l1198">1198</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;bedate&quot;, NBEDATE) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1199"> <td class="vc_file_line_number"><a href="#l1199">1199</a></td> <td class="vc_file_line_text"> m-&gt;type = BEDATE;</td> </tr> <tr class="vc_row_odd" id="l1200"> <td class="vc_file_line_number"><a href="#l1200">1200</a></td> <td class="vc_file_line_text"> l += NBEDATE;</td> </tr> <tr class="vc_row_odd" id="l1201"> <td class="vc_file_line_number"><a href="#l1201">1201</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1202"> <td class="vc_file_line_number"><a href="#l1202">1202</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;leshort&quot;, NLESHORT) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1203"> <td class="vc_file_line_number"><a href="#l1203">1203</a></td> <td class="vc_file_line_text"> m-&gt;type = LESHORT;</td> </tr> <tr class="vc_row_odd" id="l1204"> <td class="vc_file_line_number"><a href="#l1204">1204</a></td> <td class="vc_file_line_text"> l += NLESHORT;</td> </tr> <tr class="vc_row_odd" id="l1205"> <td class="vc_file_line_number"><a href="#l1205">1205</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1206"> <td class="vc_file_line_number"><a href="#l1206">1206</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;lelong&quot;, NLELONG) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1207"> <td class="vc_file_line_number"><a href="#l1207">1207</a></td> <td class="vc_file_line_text"> m-&gt;type = LELONG;</td> </tr> <tr class="vc_row_odd" id="l1208"> <td class="vc_file_line_number"><a href="#l1208">1208</a></td> <td class="vc_file_line_text"> l += NLELONG;</td> </tr> <tr class="vc_row_odd" id="l1209"> <td class="vc_file_line_number"><a href="#l1209">1209</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1210"> <td class="vc_file_line_number"><a href="#l1210">1210</a></td> <td class="vc_file_line_text"> else if (strncmp(l, &quot;ledate&quot;, NLEDATE) == 0) {</td> </tr> <tr class="vc_row_odd" id="l1211"> <td class="vc_file_line_number"><a href="#l1211">1211</a></td> <td class="vc_file_line_text"> m-&gt;type = LEDATE;</td> </tr> <tr class="vc_row_odd" id="l1212"> <td class="vc_file_line_number"><a href="#l1212">1212</a></td> <td class="vc_file_line_text"> l += NLEDATE;</td> </tr> <tr class="vc_row_odd" id="l1213"> <td class="vc_file_line_number"><a href="#l1213">1213</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1214"> <td class="vc_file_line_number"><a href="#l1214">1214</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l1215"> <td class="vc_file_line_number"><a href="#l1215">1215</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv, APLOGNO(01524)</td> </tr> <tr class="vc_row_odd" id="l1216"> <td class="vc_file_line_number"><a href="#l1216">1216</a></td> <td class="vc_file_line_text"> MODNAME &quot;: type %s invalid&quot;, l);</td> </tr> <tr class="vc_row_odd" id="l1217"> <td class="vc_file_line_number"><a href="#l1217">1217</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l1218"> <td class="vc_file_line_number"><a href="#l1218">1218</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1219"> <td class="vc_file_line_number"><a href="#l1219">1219</a></td> <td class="vc_file_line_text"> /* New-style anding: &quot;0 byte&amp;0x80 =0x80 dynamically linked&quot; */</td> </tr> <tr class="vc_row_odd" id="l1220"> <td class="vc_file_line_number"><a href="#l1220">1220</a></td> <td class="vc_file_line_text"> if (*l == &#39;&amp;&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1221"> <td class="vc_file_line_number"><a href="#l1221">1221</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1222"> <td class="vc_file_line_number"><a href="#l1222">1222</a></td> <td class="vc_file_line_text"> m-&gt;mask = signextend(serv, m, strtol(l, &amp;l, 0));</td> </tr> <tr class="vc_row_odd" id="l1223"> <td class="vc_file_line_number"><a href="#l1223">1223</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1224"> <td class="vc_file_line_number"><a href="#l1224">1224</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1225"> <td class="vc_file_line_number"><a href="#l1225">1225</a></td> <td class="vc_file_line_text"> m-&gt;mask = ~0L;</td> </tr> <tr class="vc_row_odd" id="l1226"> <td class="vc_file_line_number"><a href="#l1226">1226</a></td> <td class="vc_file_line_text"> EATAB;</td> </tr> <tr class="vc_row_odd" id="l1227"> <td class="vc_file_line_number"><a href="#l1227">1227</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1228"> <td class="vc_file_line_number"><a href="#l1228">1228</a></td> <td class="vc_file_line_text"> switch (*l) {</td> </tr> <tr class="vc_row_odd" id="l1229"> <td class="vc_file_line_number"><a href="#l1229">1229</a></td> <td class="vc_file_line_text"> case &#39;&gt;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1230"> <td class="vc_file_line_number"><a href="#l1230">1230</a></td> <td class="vc_file_line_text"> case &#39;&lt;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1231"> <td class="vc_file_line_number"><a href="#l1231">1231</a></td> <td class="vc_file_line_text"> /* Old-style anding: &quot;0 byte &amp;0x80 dynamically linked&quot; */</td> </tr> <tr class="vc_row_odd" id="l1232"> <td class="vc_file_line_number"><a href="#l1232">1232</a></td> <td class="vc_file_line_text"> case &#39;&amp;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1233"> <td class="vc_file_line_number"><a href="#l1233">1233</a></td> <td class="vc_file_line_text"> case &#39;^&#39;:</td> </tr> <tr class="vc_row_odd" id="l1234"> <td class="vc_file_line_number"><a href="#l1234">1234</a></td> <td class="vc_file_line_text"> case &#39;=&#39;:</td> </tr> <tr class="vc_row_odd" id="l1235"> <td class="vc_file_line_number"><a href="#l1235">1235</a></td> <td class="vc_file_line_text"> m-&gt;reln = *l;</td> </tr> <tr class="vc_row_odd" id="l1236"> <td class="vc_file_line_number"><a href="#l1236">1236</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1237"> <td class="vc_file_line_number"><a href="#l1237">1237</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1238"> <td class="vc_file_line_number"><a href="#l1238">1238</a></td> <td class="vc_file_line_text"> case &#39;!&#39;:</td> </tr> <tr class="vc_row_odd" id="l1239"> <td class="vc_file_line_number"><a href="#l1239">1239</a></td> <td class="vc_file_line_text"> if (m-&gt;type != STRING) {</td> </tr> <tr class="vc_row_odd" id="l1240"> <td class="vc_file_line_number"><a href="#l1240">1240</a></td> <td class="vc_file_line_text"> m-&gt;reln = *l;</td> </tr> <tr class="vc_row_odd" id="l1241"> <td class="vc_file_line_number"><a href="#l1241">1241</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1242"> <td class="vc_file_line_number"><a href="#l1242">1242</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1243"> <td class="vc_file_line_number"><a href="#l1243">1243</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1244"> <td class="vc_file_line_number"><a href="#l1244">1244</a></td> <td class="vc_file_line_text"> /* FALL THROUGH */</td> </tr> <tr class="vc_row_odd" id="l1245"> <td class="vc_file_line_number"><a href="#l1245">1245</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1246"> <td class="vc_file_line_number"><a href="#l1246">1246</a></td> <td class="vc_file_line_text"> if (*l == &#39;x&#39; &amp;&amp; apr_isspace(l[1])) {</td> </tr> <tr class="vc_row_odd" id="l1247"> <td class="vc_file_line_number"><a href="#l1247">1247</a></td> <td class="vc_file_line_text"> m-&gt;reln = *l;</td> </tr> <tr class="vc_row_odd" id="l1248"> <td class="vc_file_line_number"><a href="#l1248">1248</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1249"> <td class="vc_file_line_number"><a href="#l1249">1249</a></td> <td class="vc_file_line_text"> goto GetDesc; /* Bill The Cat */</td> </tr> <tr class="vc_row_odd" id="l1250"> <td class="vc_file_line_number"><a href="#l1250">1250</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1251"> <td class="vc_file_line_number"><a href="#l1251">1251</a></td> <td class="vc_file_line_text"> m-&gt;reln = &#39;=&#39;;</td> </tr> <tr class="vc_row_odd" id="l1252"> <td class="vc_file_line_number"><a href="#l1252">1252</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1253"> <td class="vc_file_line_number"><a href="#l1253">1253</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1254"> <td class="vc_file_line_number"><a href="#l1254">1254</a></td> <td class="vc_file_line_text"> EATAB;</td> </tr> <tr class="vc_row_odd" id="l1255"> <td class="vc_file_line_number"><a href="#l1255">1255</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1256"> <td class="vc_file_line_number"><a href="#l1256">1256</a></td> <td class="vc_file_line_text"> if (getvalue(serv, m, &amp;l))</td> </tr> <tr class="vc_row_odd" id="l1257"> <td class="vc_file_line_number"><a href="#l1257">1257</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l1258"> <td class="vc_file_line_number"><a href="#l1258">1258</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1259"> <td class="vc_file_line_number"><a href="#l1259">1259</a></td> <td class="vc_file_line_text"> * now get last part - the description</td> </tr> <tr class="vc_row_odd" id="l1260"> <td class="vc_file_line_number"><a href="#l1260">1260</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1261"> <td class="vc_file_line_number"><a href="#l1261">1261</a></td> <td class="vc_file_line_text"> GetDesc:</td> </tr> <tr class="vc_row_odd" id="l1262"> <td class="vc_file_line_number"><a href="#l1262">1262</a></td> <td class="vc_file_line_text"> EATAB;</td> </tr> <tr class="vc_row_odd" id="l1263"> <td class="vc_file_line_number"><a href="#l1263">1263</a></td> <td class="vc_file_line_text"> if (l[0] == &#39;\b&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1264"> <td class="vc_file_line_number"><a href="#l1264">1264</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1265"> <td class="vc_file_line_number"><a href="#l1265">1265</a></td> <td class="vc_file_line_text"> m-&gt;nospflag = 1;</td> </tr> <tr class="vc_row_odd" id="l1266"> <td class="vc_file_line_number"><a href="#l1266">1266</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1267"> <td class="vc_file_line_number"><a href="#l1267">1267</a></td> <td class="vc_file_line_text"> else if ((l[0] == &#39;\\&#39;) &amp;&amp; (l[1] == &#39;b&#39;)) {</td> </tr> <tr class="vc_row_odd" id="l1268"> <td class="vc_file_line_number"><a href="#l1268">1268</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1269"> <td class="vc_file_line_number"><a href="#l1269">1269</a></td> <td class="vc_file_line_text"> ++l;</td> </tr> <tr class="vc_row_odd" id="l1270"> <td class="vc_file_line_number"><a href="#l1270">1270</a></td> <td class="vc_file_line_text"> m-&gt;nospflag = 1;</td> </tr> <tr class="vc_row_odd" id="l1271"> <td class="vc_file_line_number"><a href="#l1271">1271</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1272"> <td class="vc_file_line_number"><a href="#l1272">1272</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1273"> <td class="vc_file_line_number"><a href="#l1273">1273</a></td> <td class="vc_file_line_text"> m-&gt;nospflag = 0;</td> </tr> <tr class="vc_row_odd" id="l1274"> <td class="vc_file_line_number"><a href="#l1274">1274</a></td> <td class="vc_file_line_text"> apr_cpystrn(m-&gt;desc, l, sizeof(m-&gt;desc));</td> </tr> <tr class="vc_row_odd" id="l1275"> <td class="vc_file_line_number"><a href="#l1275">1275</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1276"> <td class="vc_file_line_number"><a href="#l1276">1276</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1277"> <td class="vc_file_line_number"><a href="#l1277">1277</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, serv, APLOGNO(01525)</td> </tr> <tr class="vc_row_odd" id="l1278"> <td class="vc_file_line_number"><a href="#l1278">1278</a></td> <td class="vc_file_line_text"> MODNAME &quot;: parse line=%d m=%pp next=%pp cont=%d desc=%s&quot;,</td> </tr> <tr class="vc_row_odd" id="l1279"> <td class="vc_file_line_number"><a href="#l1279">1279</a></td> <td class="vc_file_line_text"> lineno, m, m-&gt;next, m-&gt;cont_level, m-&gt;desc);</td> </tr> <tr class="vc_row_odd" id="l1280"> <td class="vc_file_line_number"><a href="#l1280">1280</a></td> <td class="vc_file_line_text">#endif /* MIME_MAGIC_DEBUG */</td> </tr> <tr class="vc_row_odd" id="l1281"> <td class="vc_file_line_number"><a href="#l1281">1281</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1282"> <td class="vc_file_line_number"><a href="#l1282">1282</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1283"> <td class="vc_file_line_number"><a href="#l1283">1283</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1284"> <td class="vc_file_line_number"><a href="#l1284">1284</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1285"> <td class="vc_file_line_number"><a href="#l1285">1285</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1286"> <td class="vc_file_line_number"><a href="#l1286">1286</a></td> <td class="vc_file_line_text"> * Read a numeric value from a pointer, into the value union of a magic</td> </tr> <tr class="vc_row_odd" id="l1287"> <td class="vc_file_line_number"><a href="#l1287">1287</a></td> <td class="vc_file_line_text"> * pointer, according to the magic type. Update the string pointer to point</td> </tr> <tr class="vc_row_odd" id="l1288"> <td class="vc_file_line_number"><a href="#l1288">1288</a></td> <td class="vc_file_line_text"> * just after the number read. Return 0 for success, non-zero for failure.</td> </tr> <tr class="vc_row_odd" id="l1289"> <td class="vc_file_line_number"><a href="#l1289">1289</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1290"> <td class="vc_file_line_number"><a href="#l1290">1290</a></td> <td class="vc_file_line_text">static int getvalue(server_rec *s, struct magic *m, char **p)</td> </tr> <tr class="vc_row_odd" id="l1291"> <td class="vc_file_line_number"><a href="#l1291">1291</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1292"> <td class="vc_file_line_number"><a href="#l1292">1292</a></td> <td class="vc_file_line_text"> int slen;</td> </tr> <tr class="vc_row_odd" id="l1293"> <td class="vc_file_line_number"><a href="#l1293">1293</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1294"> <td class="vc_file_line_number"><a href="#l1294">1294</a></td> <td class="vc_file_line_text"> if (m-&gt;type == STRING) {</td> </tr> <tr class="vc_row_odd" id="l1295"> <td class="vc_file_line_number"><a href="#l1295">1295</a></td> <td class="vc_file_line_text"> *p = getstr(s, *p, m-&gt;value.s, sizeof(m-&gt;value.s), &amp;slen);</td> </tr> <tr class="vc_row_odd" id="l1296"> <td class="vc_file_line_number"><a href="#l1296">1296</a></td> <td class="vc_file_line_text"> m-&gt;vallen = slen;</td> </tr> <tr class="vc_row_odd" id="l1297"> <td class="vc_file_line_number"><a href="#l1297">1297</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1298"> <td class="vc_file_line_number"><a href="#l1298">1298</a></td> <td class="vc_file_line_text"> else if (m-&gt;reln != &#39;x&#39;)</td> </tr> <tr class="vc_row_odd" id="l1299"> <td class="vc_file_line_number"><a href="#l1299">1299</a></td> <td class="vc_file_line_text"> m-&gt;value.l = signextend(s, m, strtol(*p, p, 0));</td> </tr> <tr class="vc_row_odd" id="l1300"> <td class="vc_file_line_number"><a href="#l1300">1300</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1301"> <td class="vc_file_line_number"><a href="#l1301">1301</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1302"> <td class="vc_file_line_number"><a href="#l1302">1302</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1303"> <td class="vc_file_line_number"><a href="#l1303">1303</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1304"> <td class="vc_file_line_number"><a href="#l1304">1304</a></td> <td class="vc_file_line_text"> * Convert a string containing C character escapes. Stop at an unescaped</td> </tr> <tr class="vc_row_odd" id="l1305"> <td class="vc_file_line_number"><a href="#l1305">1305</a></td> <td class="vc_file_line_text"> * space or tab. Copy the converted version to &quot;p&quot;, returning its length in</td> </tr> <tr class="vc_row_odd" id="l1306"> <td class="vc_file_line_number"><a href="#l1306">1306</a></td> <td class="vc_file_line_text"> * *slen. Return updated scan pointer as function result.</td> </tr> <tr class="vc_row_odd" id="l1307"> <td class="vc_file_line_number"><a href="#l1307">1307</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1308"> <td class="vc_file_line_number"><a href="#l1308">1308</a></td> <td class="vc_file_line_text">static char *getstr(server_rec *serv, register char *s, register char *p,</td> </tr> <tr class="vc_row_odd" id="l1309"> <td class="vc_file_line_number"><a href="#l1309">1309</a></td> <td class="vc_file_line_text"> int plen, int *slen)</td> </tr> <tr class="vc_row_odd" id="l1310"> <td class="vc_file_line_number"><a href="#l1310">1310</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1311"> <td class="vc_file_line_number"><a href="#l1311">1311</a></td> <td class="vc_file_line_text"> char *origs = s, *origp = p;</td> </tr> <tr class="vc_row_odd" id="l1312"> <td class="vc_file_line_number"><a href="#l1312">1312</a></td> <td class="vc_file_line_text"> char *pmax = p + plen - 1;</td> </tr> <tr class="vc_row_odd" id="l1313"> <td class="vc_file_line_number"><a href="#l1313">1313</a></td> <td class="vc_file_line_text"> register int c;</td> </tr> <tr class="vc_row_odd" id="l1314"> <td class="vc_file_line_number"><a href="#l1314">1314</a></td> <td class="vc_file_line_text"> register int val;</td> </tr> <tr class="vc_row_odd" id="l1315"> <td class="vc_file_line_number"><a href="#l1315">1315</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1316"> <td class="vc_file_line_number"><a href="#l1316">1316</a></td> <td class="vc_file_line_text"> while ((c = *s++) != &#39;\0&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1317"> <td class="vc_file_line_number"><a href="#l1317">1317</a></td> <td class="vc_file_line_text"> if (apr_isspace(c))</td> </tr> <tr class="vc_row_odd" id="l1318"> <td class="vc_file_line_number"><a href="#l1318">1318</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1319"> <td class="vc_file_line_number"><a href="#l1319">1319</a></td> <td class="vc_file_line_text"> if (p &gt;= pmax) {</td> </tr> <tr class="vc_row_odd" id="l1320"> <td class="vc_file_line_number"><a href="#l1320">1320</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_ERR, 0, serv, APLOGNO(01526)</td> </tr> <tr class="vc_row_odd" id="l1321"> <td class="vc_file_line_number"><a href="#l1321">1321</a></td> <td class="vc_file_line_text"> MODNAME &quot;: string too long: %s&quot;, origs);</td> </tr> <tr class="vc_row_odd" id="l1322"> <td class="vc_file_line_number"><a href="#l1322">1322</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1323"> <td class="vc_file_line_number"><a href="#l1323">1323</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1324"> <td class="vc_file_line_number"><a href="#l1324">1324</a></td> <td class="vc_file_line_text"> if (c == &#39;\\&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1325"> <td class="vc_file_line_number"><a href="#l1325">1325</a></td> <td class="vc_file_line_text"> switch (c = *s++) {</td> </tr> <tr class="vc_row_odd" id="l1326"> <td class="vc_file_line_number"><a href="#l1326">1326</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1327"> <td class="vc_file_line_number"><a href="#l1327">1327</a></td> <td class="vc_file_line_text"> case &#39;\0&#39;:</td> </tr> <tr class="vc_row_odd" id="l1328"> <td class="vc_file_line_number"><a href="#l1328">1328</a></td> <td class="vc_file_line_text"> goto out;</td> </tr> <tr class="vc_row_odd" id="l1329"> <td class="vc_file_line_number"><a href="#l1329">1329</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1330"> <td class="vc_file_line_number"><a href="#l1330">1330</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1331"> <td class="vc_file_line_number"><a href="#l1331">1331</a></td> <td class="vc_file_line_text"> *p++ = (char) c;</td> </tr> <tr class="vc_row_odd" id="l1332"> <td class="vc_file_line_number"><a href="#l1332">1332</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1333"> <td class="vc_file_line_number"><a href="#l1333">1333</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1334"> <td class="vc_file_line_number"><a href="#l1334">1334</a></td> <td class="vc_file_line_text"> case &#39;n&#39;:</td> </tr> <tr class="vc_row_odd" id="l1335"> <td class="vc_file_line_number"><a href="#l1335">1335</a></td> <td class="vc_file_line_text"> *p++ = &#39;\n&#39;;</td> </tr> <tr class="vc_row_odd" id="l1336"> <td class="vc_file_line_number"><a href="#l1336">1336</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1337"> <td class="vc_file_line_number"><a href="#l1337">1337</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1338"> <td class="vc_file_line_number"><a href="#l1338">1338</a></td> <td class="vc_file_line_text"> case &#39;r&#39;:</td> </tr> <tr class="vc_row_odd" id="l1339"> <td class="vc_file_line_number"><a href="#l1339">1339</a></td> <td class="vc_file_line_text"> *p++ = &#39;\r&#39;;</td> </tr> <tr class="vc_row_odd" id="l1340"> <td class="vc_file_line_number"><a href="#l1340">1340</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1341"> <td class="vc_file_line_number"><a href="#l1341">1341</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1342"> <td class="vc_file_line_number"><a href="#l1342">1342</a></td> <td class="vc_file_line_text"> case &#39;b&#39;:</td> </tr> <tr class="vc_row_odd" id="l1343"> <td class="vc_file_line_number"><a href="#l1343">1343</a></td> <td class="vc_file_line_text"> *p++ = &#39;\b&#39;;</td> </tr> <tr class="vc_row_odd" id="l1344"> <td class="vc_file_line_number"><a href="#l1344">1344</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1345"> <td class="vc_file_line_number"><a href="#l1345">1345</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1346"> <td class="vc_file_line_number"><a href="#l1346">1346</a></td> <td class="vc_file_line_text"> case &#39;t&#39;:</td> </tr> <tr class="vc_row_odd" id="l1347"> <td class="vc_file_line_number"><a href="#l1347">1347</a></td> <td class="vc_file_line_text"> *p++ = &#39;\t&#39;;</td> </tr> <tr class="vc_row_odd" id="l1348"> <td class="vc_file_line_number"><a href="#l1348">1348</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1349"> <td class="vc_file_line_number"><a href="#l1349">1349</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1350"> <td class="vc_file_line_number"><a href="#l1350">1350</a></td> <td class="vc_file_line_text"> case &#39;f&#39;:</td> </tr> <tr class="vc_row_odd" id="l1351"> <td class="vc_file_line_number"><a href="#l1351">1351</a></td> <td class="vc_file_line_text"> *p++ = &#39;\f&#39;;</td> </tr> <tr class="vc_row_odd" id="l1352"> <td class="vc_file_line_number"><a href="#l1352">1352</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1353"> <td class="vc_file_line_number"><a href="#l1353">1353</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1354"> <td class="vc_file_line_number"><a href="#l1354">1354</a></td> <td class="vc_file_line_text"> case &#39;v&#39;:</td> </tr> <tr class="vc_row_odd" id="l1355"> <td class="vc_file_line_number"><a href="#l1355">1355</a></td> <td class="vc_file_line_text"> *p++ = &#39;\v&#39;;</td> </tr> <tr class="vc_row_odd" id="l1356"> <td class="vc_file_line_number"><a href="#l1356">1356</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1357"> <td class="vc_file_line_number"><a href="#l1357">1357</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1358"> <td class="vc_file_line_number"><a href="#l1358">1358</a></td> <td class="vc_file_line_text"> /* \ and up to 3 octal digits */</td> </tr> <tr class="vc_row_odd" id="l1359"> <td class="vc_file_line_number"><a href="#l1359">1359</a></td> <td class="vc_file_line_text"> case &#39;0&#39;:</td> </tr> <tr class="vc_row_odd" id="l1360"> <td class="vc_file_line_number"><a href="#l1360">1360</a></td> <td class="vc_file_line_text"> case &#39;1&#39;:</td> </tr> <tr class="vc_row_odd" id="l1361"> <td class="vc_file_line_number"><a href="#l1361">1361</a></td> <td class="vc_file_line_text"> case &#39;2&#39;:</td> </tr> <tr class="vc_row_odd" id="l1362"> <td class="vc_file_line_number"><a href="#l1362">1362</a></td> <td class="vc_file_line_text"> case &#39;3&#39;:</td> </tr> <tr class="vc_row_odd" id="l1363"> <td class="vc_file_line_number"><a href="#l1363">1363</a></td> <td class="vc_file_line_text"> case &#39;4&#39;:</td> </tr> <tr class="vc_row_odd" id="l1364"> <td class="vc_file_line_number"><a href="#l1364">1364</a></td> <td class="vc_file_line_text"> case &#39;5&#39;:</td> </tr> <tr class="vc_row_odd" id="l1365"> <td class="vc_file_line_number"><a href="#l1365">1365</a></td> <td class="vc_file_line_text"> case &#39;6&#39;:</td> </tr> <tr class="vc_row_odd" id="l1366"> <td class="vc_file_line_number"><a href="#l1366">1366</a></td> <td class="vc_file_line_text"> case &#39;7&#39;:</td> </tr> <tr class="vc_row_odd" id="l1367"> <td class="vc_file_line_number"><a href="#l1367">1367</a></td> <td class="vc_file_line_text"> val = c - &#39;0&#39;;</td> </tr> <tr class="vc_row_odd" id="l1368"> <td class="vc_file_line_number"><a href="#l1368">1368</a></td> <td class="vc_file_line_text"> c = *s++; /* try for 2 */</td> </tr> <tr class="vc_row_odd" id="l1369"> <td class="vc_file_line_number"><a href="#l1369">1369</a></td> <td class="vc_file_line_text"> if (c &gt;= &#39;0&#39; &amp;&amp; c &lt;= &#39;7&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1370"> <td class="vc_file_line_number"><a href="#l1370">1370</a></td> <td class="vc_file_line_text"> val = (val &lt;&lt; 3) | (c - &#39;0&#39;);</td> </tr> <tr class="vc_row_odd" id="l1371"> <td class="vc_file_line_number"><a href="#l1371">1371</a></td> <td class="vc_file_line_text"> c = *s++; /* try for 3 */</td> </tr> <tr class="vc_row_odd" id="l1372"> <td class="vc_file_line_number"><a href="#l1372">1372</a></td> <td class="vc_file_line_text"> if (c &gt;= &#39;0&#39; &amp;&amp; c &lt;= &#39;7&#39;)</td> </tr> <tr class="vc_row_odd" id="l1373"> <td class="vc_file_line_number"><a href="#l1373">1373</a></td> <td class="vc_file_line_text"> val = (val &lt;&lt; 3) | (c - &#39;0&#39;);</td> </tr> <tr class="vc_row_odd" id="l1374"> <td class="vc_file_line_number"><a href="#l1374">1374</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1375"> <td class="vc_file_line_number"><a href="#l1375">1375</a></td> <td class="vc_file_line_text"> --s;</td> </tr> <tr class="vc_row_odd" id="l1376"> <td class="vc_file_line_number"><a href="#l1376">1376</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1377"> <td class="vc_file_line_number"><a href="#l1377">1377</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1378"> <td class="vc_file_line_number"><a href="#l1378">1378</a></td> <td class="vc_file_line_text"> --s;</td> </tr> <tr class="vc_row_odd" id="l1379"> <td class="vc_file_line_number"><a href="#l1379">1379</a></td> <td class="vc_file_line_text"> *p++ = (char) val;</td> </tr> <tr class="vc_row_odd" id="l1380"> <td class="vc_file_line_number"><a href="#l1380">1380</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1381"> <td class="vc_file_line_number"><a href="#l1381">1381</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1382"> <td class="vc_file_line_number"><a href="#l1382">1382</a></td> <td class="vc_file_line_text"> /* \x and up to 3 hex digits */</td> </tr> <tr class="vc_row_odd" id="l1383"> <td class="vc_file_line_number"><a href="#l1383">1383</a></td> <td class="vc_file_line_text"> case &#39;x&#39;:</td> </tr> <tr class="vc_row_odd" id="l1384"> <td class="vc_file_line_number"><a href="#l1384">1384</a></td> <td class="vc_file_line_text"> val = &#39;x&#39;; /* Default if no digits */</td> </tr> <tr class="vc_row_odd" id="l1385"> <td class="vc_file_line_number"><a href="#l1385">1385</a></td> <td class="vc_file_line_text"> c = hextoint(*s++); /* Get next char */</td> </tr> <tr class="vc_row_odd" id="l1386"> <td class="vc_file_line_number"><a href="#l1386">1386</a></td> <td class="vc_file_line_text"> if (c &gt;= 0) {</td> </tr> <tr class="vc_row_odd" id="l1387"> <td class="vc_file_line_number"><a href="#l1387">1387</a></td> <td class="vc_file_line_text"> val = c;</td> </tr> <tr class="vc_row_odd" id="l1388"> <td class="vc_file_line_number"><a href="#l1388">1388</a></td> <td class="vc_file_line_text"> c = hextoint(*s++);</td> </tr> <tr class="vc_row_odd" id="l1389"> <td class="vc_file_line_number"><a href="#l1389">1389</a></td> <td class="vc_file_line_text"> if (c &gt;= 0) {</td> </tr> <tr class="vc_row_odd" id="l1390"> <td class="vc_file_line_number"><a href="#l1390">1390</a></td> <td class="vc_file_line_text"> val = (val &lt;&lt; 4) + c;</td> </tr> <tr class="vc_row_odd" id="l1391"> <td class="vc_file_line_number"><a href="#l1391">1391</a></td> <td class="vc_file_line_text"> c = hextoint(*s++);</td> </tr> <tr class="vc_row_odd" id="l1392"> <td class="vc_file_line_number"><a href="#l1392">1392</a></td> <td class="vc_file_line_text"> if (c &gt;= 0) {</td> </tr> <tr class="vc_row_odd" id="l1393"> <td class="vc_file_line_number"><a href="#l1393">1393</a></td> <td class="vc_file_line_text"> val = (val &lt;&lt; 4) + c;</td> </tr> <tr class="vc_row_odd" id="l1394"> <td class="vc_file_line_number"><a href="#l1394">1394</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1395"> <td class="vc_file_line_number"><a href="#l1395">1395</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1396"> <td class="vc_file_line_number"><a href="#l1396">1396</a></td> <td class="vc_file_line_text"> --s;</td> </tr> <tr class="vc_row_odd" id="l1397"> <td class="vc_file_line_number"><a href="#l1397">1397</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1398"> <td class="vc_file_line_number"><a href="#l1398">1398</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1399"> <td class="vc_file_line_number"><a href="#l1399">1399</a></td> <td class="vc_file_line_text"> --s;</td> </tr> <tr class="vc_row_odd" id="l1400"> <td class="vc_file_line_number"><a href="#l1400">1400</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1401"> <td class="vc_file_line_number"><a href="#l1401">1401</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1402"> <td class="vc_file_line_number"><a href="#l1402">1402</a></td> <td class="vc_file_line_text"> --s;</td> </tr> <tr class="vc_row_odd" id="l1403"> <td class="vc_file_line_number"><a href="#l1403">1403</a></td> <td class="vc_file_line_text"> *p++ = (char) val;</td> </tr> <tr class="vc_row_odd" id="l1404"> <td class="vc_file_line_number"><a href="#l1404">1404</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1405"> <td class="vc_file_line_number"><a href="#l1405">1405</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1406"> <td class="vc_file_line_number"><a href="#l1406">1406</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1407"> <td class="vc_file_line_number"><a href="#l1407">1407</a></td> <td class="vc_file_line_text"> else</td> </tr> <tr class="vc_row_odd" id="l1408"> <td class="vc_file_line_number"><a href="#l1408">1408</a></td> <td class="vc_file_line_text"> *p++ = (char) c;</td> </tr> <tr class="vc_row_odd" id="l1409"> <td class="vc_file_line_number"><a href="#l1409">1409</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1410"> <td class="vc_file_line_number"><a href="#l1410">1410</a></td> <td class="vc_file_line_text"> out:</td> </tr> <tr class="vc_row_odd" id="l1411"> <td class="vc_file_line_number"><a href="#l1411">1411</a></td> <td class="vc_file_line_text"> *p = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l1412"> <td class="vc_file_line_number"><a href="#l1412">1412</a></td> <td class="vc_file_line_text"> *slen = p - origp;</td> </tr> <tr class="vc_row_odd" id="l1413"> <td class="vc_file_line_number"><a href="#l1413">1413</a></td> <td class="vc_file_line_text"> return s;</td> </tr> <tr class="vc_row_odd" id="l1414"> <td class="vc_file_line_number"><a href="#l1414">1414</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1415"> <td class="vc_file_line_number"><a href="#l1415">1415</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1416"> <td class="vc_file_line_number"><a href="#l1416">1416</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1417"> <td class="vc_file_line_number"><a href="#l1417">1417</a></td> <td class="vc_file_line_text">/* Single hex char to int; -1 if not a hex char. */</td> </tr> <tr class="vc_row_odd" id="l1418"> <td class="vc_file_line_number"><a href="#l1418">1418</a></td> <td class="vc_file_line_text">static int hextoint(int c)</td> </tr> <tr class="vc_row_odd" id="l1419"> <td class="vc_file_line_number"><a href="#l1419">1419</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1420"> <td class="vc_file_line_number"><a href="#l1420">1420</a></td> <td class="vc_file_line_text"> if (apr_isdigit(c))</td> </tr> <tr class="vc_row_odd" id="l1421"> <td class="vc_file_line_number"><a href="#l1421">1421</a></td> <td class="vc_file_line_text"> return c - &#39;0&#39;;</td> </tr> <tr class="vc_row_odd" id="l1422"> <td class="vc_file_line_number"><a href="#l1422">1422</a></td> <td class="vc_file_line_text"> if ((c &gt;= &#39;a&#39;) &amp;&amp; (c &lt;= &#39;f&#39;))</td> </tr> <tr class="vc_row_odd" id="l1423"> <td class="vc_file_line_number"><a href="#l1423">1423</a></td> <td class="vc_file_line_text"> return c + 10 - &#39;a&#39;;</td> </tr> <tr class="vc_row_odd" id="l1424"> <td class="vc_file_line_number"><a href="#l1424">1424</a></td> <td class="vc_file_line_text"> if ((c &gt;= &#39;A&#39;) &amp;&amp; (c &lt;= &#39;F&#39;))</td> </tr> <tr class="vc_row_odd" id="l1425"> <td class="vc_file_line_number"><a href="#l1425">1425</a></td> <td class="vc_file_line_text"> return c + 10 - &#39;A&#39;;</td> </tr> <tr class="vc_row_odd" id="l1426"> <td class="vc_file_line_number"><a href="#l1426">1426</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l1427"> <td class="vc_file_line_number"><a href="#l1427">1427</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1428"> <td class="vc_file_line_number"><a href="#l1428">1428</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1429"> <td class="vc_file_line_number"><a href="#l1429">1429</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1430"> <td class="vc_file_line_number"><a href="#l1430">1430</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1431"> <td class="vc_file_line_number"><a href="#l1431">1431</a></td> <td class="vc_file_line_text"> * return DONE to indicate it&#39;s been handled</td> </tr> <tr class="vc_row_odd" id="l1432"> <td class="vc_file_line_number"><a href="#l1432">1432</a></td> <td class="vc_file_line_text"> * return OK to indicate it&#39;s a regular file still needing handling</td> </tr> <tr class="vc_row_odd" id="l1433"> <td class="vc_file_line_number"><a href="#l1433">1433</a></td> <td class="vc_file_line_text"> * other returns indicate a failure of some sort</td> </tr> <tr class="vc_row_odd" id="l1434"> <td class="vc_file_line_number"><a href="#l1434">1434</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1435"> <td class="vc_file_line_number"><a href="#l1435">1435</a></td> <td class="vc_file_line_text">static int fsmagic(request_rec *r, const char *fn)</td> </tr> <tr class="vc_row_odd" id="l1436"> <td class="vc_file_line_number"><a href="#l1436">1436</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1437"> <td class="vc_file_line_number"><a href="#l1437">1437</a></td> <td class="vc_file_line_text"> switch (r-&gt;finfo.filetype) {</td> </tr> <tr class="vc_row_odd" id="l1438"> <td class="vc_file_line_number"><a href="#l1438">1438</a></td> <td class="vc_file_line_text"> case APR_DIR:</td> </tr> <tr class="vc_row_odd" id="l1439"> <td class="vc_file_line_number"><a href="#l1439">1439</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, DIR_MAGIC_TYPE);</td> </tr> <tr class="vc_row_odd" id="l1440"> <td class="vc_file_line_number"><a href="#l1440">1440</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1441"> <td class="vc_file_line_number"><a href="#l1441">1441</a></td> <td class="vc_file_line_text"> case APR_CHR:</td> </tr> <tr class="vc_row_odd" id="l1442"> <td class="vc_file_line_number"><a href="#l1442">1442</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1443"> <td class="vc_file_line_number"><a href="#l1443">1443</a></td> <td class="vc_file_line_text"> * (void) magic_rsl_printf(r,&quot;character special (%d/%d)&quot;,</td> </tr> <tr class="vc_row_odd" id="l1444"> <td class="vc_file_line_number"><a href="#l1444">1444</a></td> <td class="vc_file_line_text"> * major(sb-&gt;st_rdev), minor(sb-&gt;st_rdev));</td> </tr> <tr class="vc_row_odd" id="l1445"> <td class="vc_file_line_number"><a href="#l1445">1445</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1446"> <td class="vc_file_line_number"><a href="#l1446">1446</a></td> <td class="vc_file_line_text"> (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);</td> </tr> <tr class="vc_row_odd" id="l1447"> <td class="vc_file_line_number"><a href="#l1447">1447</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1448"> <td class="vc_file_line_number"><a href="#l1448">1448</a></td> <td class="vc_file_line_text"> case APR_BLK:</td> </tr> <tr class="vc_row_odd" id="l1449"> <td class="vc_file_line_number"><a href="#l1449">1449</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1450"> <td class="vc_file_line_number"><a href="#l1450">1450</a></td> <td class="vc_file_line_text"> * (void) magic_rsl_printf(r,&quot;block special (%d/%d)&quot;,</td> </tr> <tr class="vc_row_odd" id="l1451"> <td class="vc_file_line_number"><a href="#l1451">1451</a></td> <td class="vc_file_line_text"> * major(sb-&gt;st_rdev), minor(sb-&gt;st_rdev));</td> </tr> <tr class="vc_row_odd" id="l1452"> <td class="vc_file_line_number"><a href="#l1452">1452</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1453"> <td class="vc_file_line_number"><a href="#l1453">1453</a></td> <td class="vc_file_line_text"> (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);</td> </tr> <tr class="vc_row_odd" id="l1454"> <td class="vc_file_line_number"><a href="#l1454">1454</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1455"> <td class="vc_file_line_number"><a href="#l1455">1455</a></td> <td class="vc_file_line_text"> /* TODO add code to handle V7 MUX and Blit MUX files */</td> </tr> <tr class="vc_row_odd" id="l1456"> <td class="vc_file_line_number"><a href="#l1456">1456</a></td> <td class="vc_file_line_text"> case APR_PIPE:</td> </tr> <tr class="vc_row_odd" id="l1457"> <td class="vc_file_line_number"><a href="#l1457">1457</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1458"> <td class="vc_file_line_number"><a href="#l1458">1458</a></td> <td class="vc_file_line_text"> * magic_rsl_puts(r,&quot;fifo (named pipe)&quot;);</td> </tr> <tr class="vc_row_odd" id="l1459"> <td class="vc_file_line_number"><a href="#l1459">1459</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1460"> <td class="vc_file_line_number"><a href="#l1460">1460</a></td> <td class="vc_file_line_text"> (void) magic_rsl_puts(r, MIME_BINARY_UNKNOWN);</td> </tr> <tr class="vc_row_odd" id="l1461"> <td class="vc_file_line_number"><a href="#l1461">1461</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1462"> <td class="vc_file_line_number"><a href="#l1462">1462</a></td> <td class="vc_file_line_text"> case APR_LNK:</td> </tr> <tr class="vc_row_odd" id="l1463"> <td class="vc_file_line_number"><a href="#l1463">1463</a></td> <td class="vc_file_line_text"> /* We used stat(), the only possible reason for this is that the</td> </tr> <tr class="vc_row_odd" id="l1464"> <td class="vc_file_line_number"><a href="#l1464">1464</a></td> <td class="vc_file_line_text"> * symlink is broken.</td> </tr> <tr class="vc_row_odd" id="l1465"> <td class="vc_file_line_number"><a href="#l1465">1465</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1466"> <td class="vc_file_line_number"><a href="#l1466">1466</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01527)</td> </tr> <tr class="vc_row_odd" id="l1467"> <td class="vc_file_line_number"><a href="#l1467">1467</a></td> <td class="vc_file_line_text"> MODNAME &quot;: broken symlink (%s)&quot;, fn);</td> </tr> <tr class="vc_row_odd" id="l1468"> <td class="vc_file_line_number"><a href="#l1468">1468</a></td> <td class="vc_file_line_text"> return HTTP_INTERNAL_SERVER_ERROR;</td> </tr> <tr class="vc_row_odd" id="l1469"> <td class="vc_file_line_number"><a href="#l1469">1469</a></td> <td class="vc_file_line_text"> case APR_SOCK:</td> </tr> <tr class="vc_row_odd" id="l1470"> <td class="vc_file_line_number"><a href="#l1470">1470</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, MIME_BINARY_UNKNOWN);</td> </tr> <tr class="vc_row_odd" id="l1471"> <td class="vc_file_line_number"><a href="#l1471">1471</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1472"> <td class="vc_file_line_number"><a href="#l1472">1472</a></td> <td class="vc_file_line_text"> case APR_REG:</td> </tr> <tr class="vc_row_odd" id="l1473"> <td class="vc_file_line_number"><a href="#l1473">1473</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1474"> <td class="vc_file_line_number"><a href="#l1474">1474</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1475"> <td class="vc_file_line_number"><a href="#l1475">1475</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01528)</td> </tr> <tr class="vc_row_odd" id="l1476"> <td class="vc_file_line_number"><a href="#l1476">1476</a></td> <td class="vc_file_line_text"> MODNAME &quot;: invalid file type %d.&quot;, r-&gt;finfo.filetype);</td> </tr> <tr class="vc_row_odd" id="l1477"> <td class="vc_file_line_number"><a href="#l1477">1477</a></td> <td class="vc_file_line_text"> return HTTP_INTERNAL_SERVER_ERROR;</td> </tr> <tr class="vc_row_odd" id="l1478"> <td class="vc_file_line_number"><a href="#l1478">1478</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1479"> <td class="vc_file_line_number"><a href="#l1479">1479</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1480"> <td class="vc_file_line_number"><a href="#l1480">1480</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1481"> <td class="vc_file_line_number"><a href="#l1481">1481</a></td> <td class="vc_file_line_text"> * regular file, check next possibility</td> </tr> <tr class="vc_row_odd" id="l1482"> <td class="vc_file_line_number"><a href="#l1482">1482</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1483"> <td class="vc_file_line_number"><a href="#l1483">1483</a></td> <td class="vc_file_line_text"> if (r-&gt;finfo.size == 0) {</td> </tr> <tr class="vc_row_odd" id="l1484"> <td class="vc_file_line_number"><a href="#l1484">1484</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, MIME_TEXT_UNKNOWN);</td> </tr> <tr class="vc_row_odd" id="l1485"> <td class="vc_file_line_number"><a href="#l1485">1485</a></td> <td class="vc_file_line_text"> return DONE;</td> </tr> <tr class="vc_row_odd" id="l1486"> <td class="vc_file_line_number"><a href="#l1486">1486</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1487"> <td class="vc_file_line_number"><a href="#l1487">1487</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l1488"> <td class="vc_file_line_number"><a href="#l1488">1488</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1489"> <td class="vc_file_line_number"><a href="#l1489">1489</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1490"> <td class="vc_file_line_number"><a href="#l1490">1490</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1491"> <td class="vc_file_line_number"><a href="#l1491">1491</a></td> <td class="vc_file_line_text"> * softmagic - lookup one file in database (already read from /etc/magic by</td> </tr> <tr class="vc_row_odd" id="l1492"> <td class="vc_file_line_number"><a href="#l1492">1492</a></td> <td class="vc_file_line_text"> * apprentice.c). Passed the name and FILE * of one file to be typed.</td> </tr> <tr class="vc_row_odd" id="l1493"> <td class="vc_file_line_number"><a href="#l1493">1493</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1494"> <td class="vc_file_line_number"><a href="#l1494">1494</a></td> <td class="vc_file_line_text"> /* ARGSUSED1 *//* nbytes passed for regularity, maybe need later */</td> </tr> <tr class="vc_row_odd" id="l1495"> <td class="vc_file_line_number"><a href="#l1495">1495</a></td> <td class="vc_file_line_text">static int softmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l1496"> <td class="vc_file_line_number"><a href="#l1496">1496</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1497"> <td class="vc_file_line_number"><a href="#l1497">1497</a></td> <td class="vc_file_line_text"> if (match(r, buf, nbytes))</td> </tr> <tr class="vc_row_odd" id="l1498"> <td class="vc_file_line_number"><a href="#l1498">1498</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1499"> <td class="vc_file_line_number"><a href="#l1499">1499</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1500"> <td class="vc_file_line_number"><a href="#l1500">1500</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1501"> <td class="vc_file_line_number"><a href="#l1501">1501</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1502"> <td class="vc_file_line_number"><a href="#l1502">1502</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1503"> <td class="vc_file_line_number"><a href="#l1503">1503</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1504"> <td class="vc_file_line_number"><a href="#l1504">1504</a></td> <td class="vc_file_line_text"> * Go through the whole list, stopping if you find a match. Process all the</td> </tr> <tr class="vc_row_odd" id="l1505"> <td class="vc_file_line_number"><a href="#l1505">1505</a></td> <td class="vc_file_line_text"> * continuations of that match before returning.</td> </tr> <tr class="vc_row_odd" id="l1506"> <td class="vc_file_line_number"><a href="#l1506">1506</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1507"> <td class="vc_file_line_number"><a href="#l1507">1507</a></td> <td class="vc_file_line_text"> * We support multi-level continuations:</td> </tr> <tr class="vc_row_odd" id="l1508"> <td class="vc_file_line_number"><a href="#l1508">1508</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1509"> <td class="vc_file_line_number"><a href="#l1509">1509</a></td> <td class="vc_file_line_text"> * At any time when processing a successful top-level match, there is a current</td> </tr> <tr class="vc_row_odd" id="l1510"> <td class="vc_file_line_number"><a href="#l1510">1510</a></td> <td class="vc_file_line_text"> * continuation level; it represents the level of the last successfully</td> </tr> <tr class="vc_row_odd" id="l1511"> <td class="vc_file_line_number"><a href="#l1511">1511</a></td> <td class="vc_file_line_text"> * matched continuation.</td> </tr> <tr class="vc_row_odd" id="l1512"> <td class="vc_file_line_number"><a href="#l1512">1512</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1513"> <td class="vc_file_line_number"><a href="#l1513">1513</a></td> <td class="vc_file_line_text"> * Continuations above that level are skipped as, if we see one, it means that</td> </tr> <tr class="vc_row_odd" id="l1514"> <td class="vc_file_line_number"><a href="#l1514">1514</a></td> <td class="vc_file_line_text"> * the continuation that controls them - i.e, the lower-level continuation</td> </tr> <tr class="vc_row_odd" id="l1515"> <td class="vc_file_line_number"><a href="#l1515">1515</a></td> <td class="vc_file_line_text"> * preceding them - failed to match.</td> </tr> <tr class="vc_row_odd" id="l1516"> <td class="vc_file_line_number"><a href="#l1516">1516</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1517"> <td class="vc_file_line_number"><a href="#l1517">1517</a></td> <td class="vc_file_line_text"> * Continuations below that level are processed as, if we see one, it means</td> </tr> <tr class="vc_row_odd" id="l1518"> <td class="vc_file_line_number"><a href="#l1518">1518</a></td> <td class="vc_file_line_text"> * we&#39;ve finished processing or skipping higher-level continuations under the</td> </tr> <tr class="vc_row_odd" id="l1519"> <td class="vc_file_line_number"><a href="#l1519">1519</a></td> <td class="vc_file_line_text"> * control of a successful or unsuccessful lower-level continuation, and are</td> </tr> <tr class="vc_row_odd" id="l1520"> <td class="vc_file_line_number"><a href="#l1520">1520</a></td> <td class="vc_file_line_text"> * now seeing the next lower-level continuation and should process it. The</td> </tr> <tr class="vc_row_odd" id="l1521"> <td class="vc_file_line_number"><a href="#l1521">1521</a></td> <td class="vc_file_line_text"> * current continuation level reverts to the level of the one we&#39;re seeing.</td> </tr> <tr class="vc_row_odd" id="l1522"> <td class="vc_file_line_number"><a href="#l1522">1522</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1523"> <td class="vc_file_line_number"><a href="#l1523">1523</a></td> <td class="vc_file_line_text"> * Continuations at the current level are processed as, if we see one, there&#39;s</td> </tr> <tr class="vc_row_odd" id="l1524"> <td class="vc_file_line_number"><a href="#l1524">1524</a></td> <td class="vc_file_line_text"> * no lower-level continuation that may have failed.</td> </tr> <tr class="vc_row_odd" id="l1525"> <td class="vc_file_line_number"><a href="#l1525">1525</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l1526"> <td class="vc_file_line_number"><a href="#l1526">1526</a></td> <td class="vc_file_line_text"> * If a continuation matches, we bump the current continuation level so that</td> </tr> <tr class="vc_row_odd" id="l1527"> <td class="vc_file_line_number"><a href="#l1527">1527</a></td> <td class="vc_file_line_text"> * higher-level continuations are processed.</td> </tr> <tr class="vc_row_odd" id="l1528"> <td class="vc_file_line_number"><a href="#l1528">1528</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1529"> <td class="vc_file_line_number"><a href="#l1529">1529</a></td> <td class="vc_file_line_text">static int match(request_rec *r, unsigned char *s, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l1530"> <td class="vc_file_line_number"><a href="#l1530">1530</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1531"> <td class="vc_file_line_number"><a href="#l1531">1531</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1532"> <td class="vc_file_line_number"><a href="#l1532">1532</a></td> <td class="vc_file_line_text"> int rule_counter = 0;</td> </tr> <tr class="vc_row_odd" id="l1533"> <td class="vc_file_line_number"><a href="#l1533">1533</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1534"> <td class="vc_file_line_number"><a href="#l1534">1534</a></td> <td class="vc_file_line_text"> int cont_level = 0;</td> </tr> <tr class="vc_row_odd" id="l1535"> <td class="vc_file_line_number"><a href="#l1535">1535</a></td> <td class="vc_file_line_text"> int need_separator = 0;</td> </tr> <tr class="vc_row_odd" id="l1536"> <td class="vc_file_line_number"><a href="#l1536">1536</a></td> <td class="vc_file_line_text"> union VALUETYPE p;</td> </tr> <tr class="vc_row_odd" id="l1537"> <td class="vc_file_line_number"><a href="#l1537">1537</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf = (magic_server_config_rec *)</td> </tr> <tr class="vc_row_odd" id="l1538"> <td class="vc_file_line_number"><a href="#l1538">1538</a></td> <td class="vc_file_line_text"> ap_get_module_config(r-&gt;server-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l1539"> <td class="vc_file_line_number"><a href="#l1539">1539</a></td> <td class="vc_file_line_text"> struct magic *m;</td> </tr> <tr class="vc_row_odd" id="l1540"> <td class="vc_file_line_number"><a href="#l1540">1540</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1541"> <td class="vc_file_line_number"><a href="#l1541">1541</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1542"> <td class="vc_file_line_number"><a href="#l1542">1542</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01529)</td> </tr> <tr class="vc_row_odd" id="l1543"> <td class="vc_file_line_number"><a href="#l1543">1543</a></td> <td class="vc_file_line_text"> MODNAME &quot;: match conf=%pp file=%s m=%s m-&gt;next=%s last=%s&quot;,</td> </tr> <tr class="vc_row_odd" id="l1544"> <td class="vc_file_line_number"><a href="#l1544">1544</a></td> <td class="vc_file_line_text"> conf,</td> </tr> <tr class="vc_row_odd" id="l1545"> <td class="vc_file_line_number"><a href="#l1545">1545</a></td> <td class="vc_file_line_text"> conf-&gt;magicfile ? conf-&gt;magicfile : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l1546"> <td class="vc_file_line_number"><a href="#l1546">1546</a></td> <td class="vc_file_line_text"> conf-&gt;magic ? &quot;set&quot; : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l1547"> <td class="vc_file_line_number"><a href="#l1547">1547</a></td> <td class="vc_file_line_text"> (conf-&gt;magic &amp;&amp; conf-&gt;magic-&gt;next) ? &quot;set&quot; : &quot;NULL&quot;,</td> </tr> <tr class="vc_row_odd" id="l1548"> <td class="vc_file_line_number"><a href="#l1548">1548</a></td> <td class="vc_file_line_text"> conf-&gt;last ? &quot;set&quot; : &quot;NULL&quot;);</td> </tr> <tr class="vc_row_odd" id="l1549"> <td class="vc_file_line_number"><a href="#l1549">1549</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1550"> <td class="vc_file_line_number"><a href="#l1550">1550</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1551"> <td class="vc_file_line_number"><a href="#l1551">1551</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1552"> <td class="vc_file_line_number"><a href="#l1552">1552</a></td> <td class="vc_file_line_text"> for (m = conf-&gt;magic; m; m = m-&gt;next) {</td> </tr> <tr class="vc_row_odd" id="l1553"> <td class="vc_file_line_number"><a href="#l1553">1553</a></td> <td class="vc_file_line_text"> if (apr_isprint((((unsigned long) m) &gt;&gt; 24) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1554"> <td class="vc_file_line_number"><a href="#l1554">1554</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 16) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1555"> <td class="vc_file_line_number"><a href="#l1555">1555</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 8) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1556"> <td class="vc_file_line_number"><a href="#l1556">1556</a></td> <td class="vc_file_line_text"> apr_isprint(((unsigned long) m) &amp; 255)) {</td> </tr> <tr class="vc_row_odd" id="l1557"> <td class="vc_file_line_number"><a href="#l1557">1557</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01530)</td> </tr> <tr class="vc_row_odd" id="l1558"> <td class="vc_file_line_number"><a href="#l1558">1558</a></td> <td class="vc_file_line_text"> MODNAME &quot;: match: POINTER CLOBBERED! &quot;</td> </tr> <tr class="vc_row_odd" id="l1559"> <td class="vc_file_line_number"><a href="#l1559">1559</a></td> <td class="vc_file_line_text"> &quot;m=\&quot;%c%c%c%c\&quot;&quot;,</td> </tr> <tr class="vc_row_odd" id="l1560"> <td class="vc_file_line_number"><a href="#l1560">1560</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 24) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1561"> <td class="vc_file_line_number"><a href="#l1561">1561</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 16) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1562"> <td class="vc_file_line_number"><a href="#l1562">1562</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 8 ) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l1563"> <td class="vc_file_line_number"><a href="#l1563">1563</a></td> <td class="vc_file_line_text"> (char)(( (unsigned long) m ) &amp; 255));</td> </tr> <tr class="vc_row_odd" id="l1564"> <td class="vc_file_line_number"><a href="#l1564">1564</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1565"> <td class="vc_file_line_number"><a href="#l1565">1565</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1566"> <td class="vc_file_line_number"><a href="#l1566">1566</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1567"> <td class="vc_file_line_number"><a href="#l1567">1567</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1568"> <td class="vc_file_line_number"><a href="#l1568">1568</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1569"> <td class="vc_file_line_number"><a href="#l1569">1569</a></td> <td class="vc_file_line_text"> for (m = conf-&gt;magic; m; m = m-&gt;next) {</td> </tr> <tr class="vc_row_odd" id="l1570"> <td class="vc_file_line_number"><a href="#l1570">1570</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1571"> <td class="vc_file_line_number"><a href="#l1571">1571</a></td> <td class="vc_file_line_text"> rule_counter++;</td> </tr> <tr class="vc_row_odd" id="l1572"> <td class="vc_file_line_number"><a href="#l1572">1572</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01531)</td> </tr> <tr class="vc_row_odd" id="l1573"> <td class="vc_file_line_number"><a href="#l1573">1573</a></td> <td class="vc_file_line_text"> MODNAME &quot;: line=%d desc=%s&quot;, m-&gt;lineno, m-&gt;desc);</td> </tr> <tr class="vc_row_odd" id="l1574"> <td class="vc_file_line_number"><a href="#l1574">1574</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1575"> <td class="vc_file_line_number"><a href="#l1575">1575</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1576"> <td class="vc_file_line_number"><a href="#l1576">1576</a></td> <td class="vc_file_line_text"> /* check if main entry matches */</td> </tr> <tr class="vc_row_odd" id="l1577"> <td class="vc_file_line_number"><a href="#l1577">1577</a></td> <td class="vc_file_line_text"> if (!mget(r, &amp;p, s, m, nbytes) ||</td> </tr> <tr class="vc_row_odd" id="l1578"> <td class="vc_file_line_number"><a href="#l1578">1578</a></td> <td class="vc_file_line_text"> !mcheck(r, &amp;p, m)) {</td> </tr> <tr class="vc_row_odd" id="l1579"> <td class="vc_file_line_number"><a href="#l1579">1579</a></td> <td class="vc_file_line_text"> struct magic *m_cont;</td> </tr> <tr class="vc_row_odd" id="l1580"> <td class="vc_file_line_number"><a href="#l1580">1580</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1581"> <td class="vc_file_line_number"><a href="#l1581">1581</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1582"> <td class="vc_file_line_number"><a href="#l1582">1582</a></td> <td class="vc_file_line_text"> * main entry didn&#39;t match, flush its continuations</td> </tr> <tr class="vc_row_odd" id="l1583"> <td class="vc_file_line_number"><a href="#l1583">1583</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1584"> <td class="vc_file_line_number"><a href="#l1584">1584</a></td> <td class="vc_file_line_text"> if (!m-&gt;next || (m-&gt;next-&gt;cont_level == 0)) {</td> </tr> <tr class="vc_row_odd" id="l1585"> <td class="vc_file_line_number"><a href="#l1585">1585</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l1586"> <td class="vc_file_line_number"><a href="#l1586">1586</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1587"> <td class="vc_file_line_number"><a href="#l1587">1587</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1588"> <td class="vc_file_line_number"><a href="#l1588">1588</a></td> <td class="vc_file_line_text"> m_cont = m-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l1589"> <td class="vc_file_line_number"><a href="#l1589">1589</a></td> <td class="vc_file_line_text"> while (m_cont &amp;&amp; (m_cont-&gt;cont_level != 0)) {</td> </tr> <tr class="vc_row_odd" id="l1590"> <td class="vc_file_line_number"><a href="#l1590">1590</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1591"> <td class="vc_file_line_number"><a href="#l1591">1591</a></td> <td class="vc_file_line_text"> rule_counter++;</td> </tr> <tr class="vc_row_odd" id="l1592"> <td class="vc_file_line_number"><a href="#l1592">1592</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01532)</td> </tr> <tr class="vc_row_odd" id="l1593"> <td class="vc_file_line_number"><a href="#l1593">1593</a></td> <td class="vc_file_line_text"> MODNAME &quot;: line=%d mc=%pp mc-&gt;next=%pp cont=%d desc=%s&quot;,</td> </tr> <tr class="vc_row_odd" id="l1594"> <td class="vc_file_line_number"><a href="#l1594">1594</a></td> <td class="vc_file_line_text"> m_cont-&gt;lineno, m_cont,</td> </tr> <tr class="vc_row_odd" id="l1595"> <td class="vc_file_line_number"><a href="#l1595">1595</a></td> <td class="vc_file_line_text"> m_cont-&gt;next, m_cont-&gt;cont_level,</td> </tr> <tr class="vc_row_odd" id="l1596"> <td class="vc_file_line_number"><a href="#l1596">1596</a></td> <td class="vc_file_line_text"> m_cont-&gt;desc);</td> </tr> <tr class="vc_row_odd" id="l1597"> <td class="vc_file_line_number"><a href="#l1597">1597</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1598"> <td class="vc_file_line_number"><a href="#l1598">1598</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1599"> <td class="vc_file_line_number"><a href="#l1599">1599</a></td> <td class="vc_file_line_text"> * this trick allows us to keep *m in sync when the continue</td> </tr> <tr class="vc_row_odd" id="l1600"> <td class="vc_file_line_number"><a href="#l1600">1600</a></td> <td class="vc_file_line_text"> * advances the pointer</td> </tr> <tr class="vc_row_odd" id="l1601"> <td class="vc_file_line_number"><a href="#l1601">1601</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1602"> <td class="vc_file_line_number"><a href="#l1602">1602</a></td> <td class="vc_file_line_text"> m = m_cont;</td> </tr> <tr class="vc_row_odd" id="l1603"> <td class="vc_file_line_number"><a href="#l1603">1603</a></td> <td class="vc_file_line_text"> m_cont = m_cont-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l1604"> <td class="vc_file_line_number"><a href="#l1604">1604</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1605"> <td class="vc_file_line_number"><a href="#l1605">1605</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l1606"> <td class="vc_file_line_number"><a href="#l1606">1606</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1607"> <td class="vc_file_line_number"><a href="#l1607">1607</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1608"> <td class="vc_file_line_number"><a href="#l1608">1608</a></td> <td class="vc_file_line_text"> /* if we get here, the main entry rule was a match */</td> </tr> <tr class="vc_row_odd" id="l1609"> <td class="vc_file_line_number"><a href="#l1609">1609</a></td> <td class="vc_file_line_text"> /* this will be the last run through the loop */</td> </tr> <tr class="vc_row_odd" id="l1610"> <td class="vc_file_line_number"><a href="#l1610">1610</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1611"> <td class="vc_file_line_number"><a href="#l1611">1611</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01533)</td> </tr> <tr class="vc_row_odd" id="l1612"> <td class="vc_file_line_number"><a href="#l1612">1612</a></td> <td class="vc_file_line_text"> MODNAME &quot;: rule matched, line=%d type=%d %s&quot;,</td> </tr> <tr class="vc_row_odd" id="l1613"> <td class="vc_file_line_number"><a href="#l1613">1613</a></td> <td class="vc_file_line_text"> m-&gt;lineno, m-&gt;type,</td> </tr> <tr class="vc_row_odd" id="l1614"> <td class="vc_file_line_number"><a href="#l1614">1614</a></td> <td class="vc_file_line_text"> (m-&gt;type == STRING) ? m-&gt;value.s : &quot;&quot;);</td> </tr> <tr class="vc_row_odd" id="l1615"> <td class="vc_file_line_number"><a href="#l1615">1615</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1616"> <td class="vc_file_line_number"><a href="#l1616">1616</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1617"> <td class="vc_file_line_number"><a href="#l1617">1617</a></td> <td class="vc_file_line_text"> /* print the match */</td> </tr> <tr class="vc_row_odd" id="l1618"> <td class="vc_file_line_number"><a href="#l1618">1618</a></td> <td class="vc_file_line_text"> mprint(r, &amp;p, m);</td> </tr> <tr class="vc_row_odd" id="l1619"> <td class="vc_file_line_number"><a href="#l1619">1619</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1620"> <td class="vc_file_line_number"><a href="#l1620">1620</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1621"> <td class="vc_file_line_number"><a href="#l1621">1621</a></td> <td class="vc_file_line_text"> * If we printed something, we&#39;ll need to print a blank before we</td> </tr> <tr class="vc_row_odd" id="l1622"> <td class="vc_file_line_number"><a href="#l1622">1622</a></td> <td class="vc_file_line_text"> * print something else.</td> </tr> <tr class="vc_row_odd" id="l1623"> <td class="vc_file_line_number"><a href="#l1623">1623</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1624"> <td class="vc_file_line_number"><a href="#l1624">1624</a></td> <td class="vc_file_line_text"> if (m-&gt;desc[0])</td> </tr> <tr class="vc_row_odd" id="l1625"> <td class="vc_file_line_number"><a href="#l1625">1625</a></td> <td class="vc_file_line_text"> need_separator = 1;</td> </tr> <tr class="vc_row_odd" id="l1626"> <td class="vc_file_line_number"><a href="#l1626">1626</a></td> <td class="vc_file_line_text"> /* and any continuations that match */</td> </tr> <tr class="vc_row_odd" id="l1627"> <td class="vc_file_line_number"><a href="#l1627">1627</a></td> <td class="vc_file_line_text"> cont_level++;</td> </tr> <tr class="vc_row_odd" id="l1628"> <td class="vc_file_line_number"><a href="#l1628">1628</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1629"> <td class="vc_file_line_number"><a href="#l1629">1629</a></td> <td class="vc_file_line_text"> * while (m &amp;&amp; m-&gt;next &amp;&amp; m-&gt;next-&gt;cont_level != 0 &amp;&amp; ( m = m-&gt;next</td> </tr> <tr class="vc_row_odd" id="l1630"> <td class="vc_file_line_number"><a href="#l1630">1630</a></td> <td class="vc_file_line_text"> * ))</td> </tr> <tr class="vc_row_odd" id="l1631"> <td class="vc_file_line_number"><a href="#l1631">1631</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1632"> <td class="vc_file_line_number"><a href="#l1632">1632</a></td> <td class="vc_file_line_text"> m = m-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l1633"> <td class="vc_file_line_number"><a href="#l1633">1633</a></td> <td class="vc_file_line_text"> while (m &amp;&amp; (m-&gt;cont_level != 0)) {</td> </tr> <tr class="vc_row_odd" id="l1634"> <td class="vc_file_line_number"><a href="#l1634">1634</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1635"> <td class="vc_file_line_number"><a href="#l1635">1635</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01534)</td> </tr> <tr class="vc_row_odd" id="l1636"> <td class="vc_file_line_number"><a href="#l1636">1636</a></td> <td class="vc_file_line_text"> MODNAME &quot;: match line=%d cont=%d type=%d %s&quot;,</td> </tr> <tr class="vc_row_odd" id="l1637"> <td class="vc_file_line_number"><a href="#l1637">1637</a></td> <td class="vc_file_line_text"> m-&gt;lineno, m-&gt;cont_level, m-&gt;type,</td> </tr> <tr class="vc_row_odd" id="l1638"> <td class="vc_file_line_number"><a href="#l1638">1638</a></td> <td class="vc_file_line_text"> (m-&gt;type == STRING) ? m-&gt;value.s : &quot;&quot;);</td> </tr> <tr class="vc_row_odd" id="l1639"> <td class="vc_file_line_number"><a href="#l1639">1639</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1640"> <td class="vc_file_line_number"><a href="#l1640">1640</a></td> <td class="vc_file_line_text"> if (cont_level &gt;= m-&gt;cont_level) {</td> </tr> <tr class="vc_row_odd" id="l1641"> <td class="vc_file_line_number"><a href="#l1641">1641</a></td> <td class="vc_file_line_text"> if (cont_level &gt; m-&gt;cont_level) {</td> </tr> <tr class="vc_row_odd" id="l1642"> <td class="vc_file_line_number"><a href="#l1642">1642</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1643"> <td class="vc_file_line_number"><a href="#l1643">1643</a></td> <td class="vc_file_line_text"> * We&#39;re at the end of the level &quot;cont_level&quot;</td> </tr> <tr class="vc_row_odd" id="l1644"> <td class="vc_file_line_number"><a href="#l1644">1644</a></td> <td class="vc_file_line_text"> * continuations.</td> </tr> <tr class="vc_row_odd" id="l1645"> <td class="vc_file_line_number"><a href="#l1645">1645</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1646"> <td class="vc_file_line_number"><a href="#l1646">1646</a></td> <td class="vc_file_line_text"> cont_level = m-&gt;cont_level;</td> </tr> <tr class="vc_row_odd" id="l1647"> <td class="vc_file_line_number"><a href="#l1647">1647</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1648"> <td class="vc_file_line_number"><a href="#l1648">1648</a></td> <td class="vc_file_line_text"> if (mget(r, &amp;p, s, m, nbytes) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1649"> <td class="vc_file_line_number"><a href="#l1649">1649</a></td> <td class="vc_file_line_text"> mcheck(r, &amp;p, m)) {</td> </tr> <tr class="vc_row_odd" id="l1650"> <td class="vc_file_line_number"><a href="#l1650">1650</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1651"> <td class="vc_file_line_number"><a href="#l1651">1651</a></td> <td class="vc_file_line_text"> * This continuation matched. Print its message, with a</td> </tr> <tr class="vc_row_odd" id="l1652"> <td class="vc_file_line_number"><a href="#l1652">1652</a></td> <td class="vc_file_line_text"> * blank before it if the previous item printed and this</td> </tr> <tr class="vc_row_odd" id="l1653"> <td class="vc_file_line_number"><a href="#l1653">1653</a></td> <td class="vc_file_line_text"> * item isn&#39;t empty.</td> </tr> <tr class="vc_row_odd" id="l1654"> <td class="vc_file_line_number"><a href="#l1654">1654</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1655"> <td class="vc_file_line_number"><a href="#l1655">1655</a></td> <td class="vc_file_line_text"> /* space if previous printed */</td> </tr> <tr class="vc_row_odd" id="l1656"> <td class="vc_file_line_number"><a href="#l1656">1656</a></td> <td class="vc_file_line_text"> if (need_separator</td> </tr> <tr class="vc_row_odd" id="l1657"> <td class="vc_file_line_number"><a href="#l1657">1657</a></td> <td class="vc_file_line_text"> &amp;&amp; (m-&gt;nospflag == 0)</td> </tr> <tr class="vc_row_odd" id="l1658"> <td class="vc_file_line_number"><a href="#l1658">1658</a></td> <td class="vc_file_line_text"> &amp;&amp; (m-&gt;desc[0] != &#39;\0&#39;)</td> </tr> <tr class="vc_row_odd" id="l1659"> <td class="vc_file_line_number"><a href="#l1659">1659</a></td> <td class="vc_file_line_text"> ) {</td> </tr> <tr class="vc_row_odd" id="l1660"> <td class="vc_file_line_number"><a href="#l1660">1660</a></td> <td class="vc_file_line_text"> (void) magic_rsl_putchar(r, &#39; &#39;);</td> </tr> <tr class="vc_row_odd" id="l1661"> <td class="vc_file_line_number"><a href="#l1661">1661</a></td> <td class="vc_file_line_text"> need_separator = 0;</td> </tr> <tr class="vc_row_odd" id="l1662"> <td class="vc_file_line_number"><a href="#l1662">1662</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1663"> <td class="vc_file_line_number"><a href="#l1663">1663</a></td> <td class="vc_file_line_text"> mprint(r, &amp;p, m);</td> </tr> <tr class="vc_row_odd" id="l1664"> <td class="vc_file_line_number"><a href="#l1664">1664</a></td> <td class="vc_file_line_text"> if (m-&gt;desc[0])</td> </tr> <tr class="vc_row_odd" id="l1665"> <td class="vc_file_line_number"><a href="#l1665">1665</a></td> <td class="vc_file_line_text"> need_separator = 1;</td> </tr> <tr class="vc_row_odd" id="l1666"> <td class="vc_file_line_number"><a href="#l1666">1666</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1667"> <td class="vc_file_line_number"><a href="#l1667">1667</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1668"> <td class="vc_file_line_number"><a href="#l1668">1668</a></td> <td class="vc_file_line_text"> * If we see any continuations at a higher level, process</td> </tr> <tr class="vc_row_odd" id="l1669"> <td class="vc_file_line_number"><a href="#l1669">1669</a></td> <td class="vc_file_line_text"> * them.</td> </tr> <tr class="vc_row_odd" id="l1670"> <td class="vc_file_line_number"><a href="#l1670">1670</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1671"> <td class="vc_file_line_number"><a href="#l1671">1671</a></td> <td class="vc_file_line_text"> cont_level++;</td> </tr> <tr class="vc_row_odd" id="l1672"> <td class="vc_file_line_number"><a href="#l1672">1672</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1673"> <td class="vc_file_line_number"><a href="#l1673">1673</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1674"> <td class="vc_file_line_number"><a href="#l1674">1674</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1675"> <td class="vc_file_line_number"><a href="#l1675">1675</a></td> <td class="vc_file_line_text"> /* move to next continuation record */</td> </tr> <tr class="vc_row_odd" id="l1676"> <td class="vc_file_line_number"><a href="#l1676">1676</a></td> <td class="vc_file_line_text"> m = m-&gt;next;</td> </tr> <tr class="vc_row_odd" id="l1677"> <td class="vc_file_line_number"><a href="#l1677">1677</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1678"> <td class="vc_file_line_number"><a href="#l1678">1678</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1679"> <td class="vc_file_line_number"><a href="#l1679">1679</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01535)</td> </tr> <tr class="vc_row_odd" id="l1680"> <td class="vc_file_line_number"><a href="#l1680">1680</a></td> <td class="vc_file_line_text"> MODNAME &quot;: matched after %d rules&quot;, rule_counter);</td> </tr> <tr class="vc_row_odd" id="l1681"> <td class="vc_file_line_number"><a href="#l1681">1681</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1682"> <td class="vc_file_line_number"><a href="#l1682">1682</a></td> <td class="vc_file_line_text"> return 1; /* all through */</td> </tr> <tr class="vc_row_odd" id="l1683"> <td class="vc_file_line_number"><a href="#l1683">1683</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1684"> <td class="vc_file_line_number"><a href="#l1684">1684</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1685"> <td class="vc_file_line_number"><a href="#l1685">1685</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01536)</td> </tr> <tr class="vc_row_odd" id="l1686"> <td class="vc_file_line_number"><a href="#l1686">1686</a></td> <td class="vc_file_line_text"> MODNAME &quot;: failed after %d rules&quot;, rule_counter);</td> </tr> <tr class="vc_row_odd" id="l1687"> <td class="vc_file_line_number"><a href="#l1687">1687</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1688"> <td class="vc_file_line_number"><a href="#l1688">1688</a></td> <td class="vc_file_line_text"> return 0; /* no match at all */</td> </tr> <tr class="vc_row_odd" id="l1689"> <td class="vc_file_line_number"><a href="#l1689">1689</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1690"> <td class="vc_file_line_number"><a href="#l1690">1690</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1691"> <td class="vc_file_line_number"><a href="#l1691">1691</a></td> <td class="vc_file_line_text">static void mprint(request_rec *r, union VALUETYPE *p, struct magic *m)</td> </tr> <tr class="vc_row_odd" id="l1692"> <td class="vc_file_line_number"><a href="#l1692">1692</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1693"> <td class="vc_file_line_number"><a href="#l1693">1693</a></td> <td class="vc_file_line_text"> char *pp;</td> </tr> <tr class="vc_row_odd" id="l1694"> <td class="vc_file_line_number"><a href="#l1694">1694</a></td> <td class="vc_file_line_text"> unsigned long v;</td> </tr> <tr class="vc_row_odd" id="l1695"> <td class="vc_file_line_number"><a href="#l1695">1695</a></td> <td class="vc_file_line_text"> char time_str[APR_CTIME_LEN];</td> </tr> <tr class="vc_row_odd" id="l1696"> <td class="vc_file_line_number"><a href="#l1696">1696</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1697"> <td class="vc_file_line_number"><a href="#l1697">1697</a></td> <td class="vc_file_line_text"> switch (m-&gt;type) {</td> </tr> <tr class="vc_row_odd" id="l1698"> <td class="vc_file_line_number"><a href="#l1698">1698</a></td> <td class="vc_file_line_text"> case BYTE:</td> </tr> <tr class="vc_row_odd" id="l1699"> <td class="vc_file_line_number"><a href="#l1699">1699</a></td> <td class="vc_file_line_text"> v = p-&gt;b;</td> </tr> <tr class="vc_row_odd" id="l1700"> <td class="vc_file_line_number"><a href="#l1700">1700</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1701"> <td class="vc_file_line_number"><a href="#l1701">1701</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1702"> <td class="vc_file_line_number"><a href="#l1702">1702</a></td> <td class="vc_file_line_text"> case SHORT:</td> </tr> <tr class="vc_row_odd" id="l1703"> <td class="vc_file_line_number"><a href="#l1703">1703</a></td> <td class="vc_file_line_text"> case BESHORT:</td> </tr> <tr class="vc_row_odd" id="l1704"> <td class="vc_file_line_number"><a href="#l1704">1704</a></td> <td class="vc_file_line_text"> case LESHORT:</td> </tr> <tr class="vc_row_odd" id="l1705"> <td class="vc_file_line_number"><a href="#l1705">1705</a></td> <td class="vc_file_line_text"> v = p-&gt;h;</td> </tr> <tr class="vc_row_odd" id="l1706"> <td class="vc_file_line_number"><a href="#l1706">1706</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1707"> <td class="vc_file_line_number"><a href="#l1707">1707</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1708"> <td class="vc_file_line_number"><a href="#l1708">1708</a></td> <td class="vc_file_line_text"> case LONG:</td> </tr> <tr class="vc_row_odd" id="l1709"> <td class="vc_file_line_number"><a href="#l1709">1709</a></td> <td class="vc_file_line_text"> case BELONG:</td> </tr> <tr class="vc_row_odd" id="l1710"> <td class="vc_file_line_number"><a href="#l1710">1710</a></td> <td class="vc_file_line_text"> case LELONG:</td> </tr> <tr class="vc_row_odd" id="l1711"> <td class="vc_file_line_number"><a href="#l1711">1711</a></td> <td class="vc_file_line_text"> v = p-&gt;l;</td> </tr> <tr class="vc_row_odd" id="l1712"> <td class="vc_file_line_number"><a href="#l1712">1712</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1713"> <td class="vc_file_line_number"><a href="#l1713">1713</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1714"> <td class="vc_file_line_number"><a href="#l1714">1714</a></td> <td class="vc_file_line_text"> case STRING:</td> </tr> <tr class="vc_row_odd" id="l1715"> <td class="vc_file_line_number"><a href="#l1715">1715</a></td> <td class="vc_file_line_text"> if (m-&gt;reln == &#39;=&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1716"> <td class="vc_file_line_number"><a href="#l1716">1716</a></td> <td class="vc_file_line_text"> (void) magic_rsl_printf(r, m-&gt;desc, m-&gt;value.s);</td> </tr> <tr class="vc_row_odd" id="l1717"> <td class="vc_file_line_number"><a href="#l1717">1717</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1718"> <td class="vc_file_line_number"><a href="#l1718">1718</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l1719"> <td class="vc_file_line_number"><a href="#l1719">1719</a></td> <td class="vc_file_line_text"> (void) magic_rsl_printf(r, m-&gt;desc, p-&gt;s);</td> </tr> <tr class="vc_row_odd" id="l1720"> <td class="vc_file_line_number"><a href="#l1720">1720</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1721"> <td class="vc_file_line_number"><a href="#l1721">1721</a></td> <td class="vc_file_line_text"> return;</td> </tr> <tr class="vc_row_odd" id="l1722"> <td class="vc_file_line_number"><a href="#l1722">1722</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1723"> <td class="vc_file_line_number"><a href="#l1723">1723</a></td> <td class="vc_file_line_text"> case DATE:</td> </tr> <tr class="vc_row_odd" id="l1724"> <td class="vc_file_line_number"><a href="#l1724">1724</a></td> <td class="vc_file_line_text"> case BEDATE:</td> </tr> <tr class="vc_row_odd" id="l1725"> <td class="vc_file_line_number"><a href="#l1725">1725</a></td> <td class="vc_file_line_text"> case LEDATE:</td> </tr> <tr class="vc_row_odd" id="l1726"> <td class="vc_file_line_number"><a href="#l1726">1726</a></td> <td class="vc_file_line_text"> apr_ctime(time_str, apr_time_from_sec(*(time_t *)&amp;p-&gt;l));</td> </tr> <tr class="vc_row_odd" id="l1727"> <td class="vc_file_line_number"><a href="#l1727">1727</a></td> <td class="vc_file_line_text"> pp = time_str;</td> </tr> <tr class="vc_row_odd" id="l1728"> <td class="vc_file_line_number"><a href="#l1728">1728</a></td> <td class="vc_file_line_text"> (void) magic_rsl_printf(r, m-&gt;desc, pp);</td> </tr> <tr class="vc_row_odd" id="l1729"> <td class="vc_file_line_number"><a href="#l1729">1729</a></td> <td class="vc_file_line_text"> return;</td> </tr> <tr class="vc_row_odd" id="l1730"> <td class="vc_file_line_number"><a href="#l1730">1730</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1731"> <td class="vc_file_line_number"><a href="#l1731">1731</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01537)</td> </tr> <tr class="vc_row_odd" id="l1732"> <td class="vc_file_line_number"><a href="#l1732">1732</a></td> <td class="vc_file_line_text"> MODNAME &quot;: invalid m-&gt;type (%d) in mprint().&quot;,</td> </tr> <tr class="vc_row_odd" id="l1733"> <td class="vc_file_line_number"><a href="#l1733">1733</a></td> <td class="vc_file_line_text"> m-&gt;type);</td> </tr> <tr class="vc_row_odd" id="l1734"> <td class="vc_file_line_number"><a href="#l1734">1734</a></td> <td class="vc_file_line_text"> return;</td> </tr> <tr class="vc_row_odd" id="l1735"> <td class="vc_file_line_number"><a href="#l1735">1735</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1736"> <td class="vc_file_line_number"><a href="#l1736">1736</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1737"> <td class="vc_file_line_number"><a href="#l1737">1737</a></td> <td class="vc_file_line_text"> v = signextend(r-&gt;server, m, v) &amp; m-&gt;mask;</td> </tr> <tr class="vc_row_odd" id="l1738"> <td class="vc_file_line_number"><a href="#l1738">1738</a></td> <td class="vc_file_line_text"> (void) magic_rsl_printf(r, m-&gt;desc, (unsigned long) v);</td> </tr> <tr class="vc_row_odd" id="l1739"> <td class="vc_file_line_number"><a href="#l1739">1739</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1740"> <td class="vc_file_line_number"><a href="#l1740">1740</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1741"> <td class="vc_file_line_number"><a href="#l1741">1741</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l1742"> <td class="vc_file_line_number"><a href="#l1742">1742</a></td> <td class="vc_file_line_text"> * Convert the byte order of the data we are looking at</td> </tr> <tr class="vc_row_odd" id="l1743"> <td class="vc_file_line_number"><a href="#l1743">1743</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1744"> <td class="vc_file_line_number"><a href="#l1744">1744</a></td> <td class="vc_file_line_text">static int mconvert(request_rec *r, union VALUETYPE *p, struct magic *m)</td> </tr> <tr class="vc_row_odd" id="l1745"> <td class="vc_file_line_number"><a href="#l1745">1745</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1746"> <td class="vc_file_line_number"><a href="#l1746">1746</a></td> <td class="vc_file_line_text"> char *rt;</td> </tr> <tr class="vc_row_odd" id="l1747"> <td class="vc_file_line_number"><a href="#l1747">1747</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1748"> <td class="vc_file_line_number"><a href="#l1748">1748</a></td> <td class="vc_file_line_text"> switch (m-&gt;type) {</td> </tr> <tr class="vc_row_odd" id="l1749"> <td class="vc_file_line_number"><a href="#l1749">1749</a></td> <td class="vc_file_line_text"> case BYTE:</td> </tr> <tr class="vc_row_odd" id="l1750"> <td class="vc_file_line_number"><a href="#l1750">1750</a></td> <td class="vc_file_line_text"> case SHORT:</td> </tr> <tr class="vc_row_odd" id="l1751"> <td class="vc_file_line_number"><a href="#l1751">1751</a></td> <td class="vc_file_line_text"> case LONG:</td> </tr> <tr class="vc_row_odd" id="l1752"> <td class="vc_file_line_number"><a href="#l1752">1752</a></td> <td class="vc_file_line_text"> case DATE:</td> </tr> <tr class="vc_row_odd" id="l1753"> <td class="vc_file_line_number"><a href="#l1753">1753</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1754"> <td class="vc_file_line_number"><a href="#l1754">1754</a></td> <td class="vc_file_line_text"> case STRING:</td> </tr> <tr class="vc_row_odd" id="l1755"> <td class="vc_file_line_number"><a href="#l1755">1755</a></td> <td class="vc_file_line_text"> /* Null terminate and eat the return */</td> </tr> <tr class="vc_row_odd" id="l1756"> <td class="vc_file_line_number"><a href="#l1756">1756</a></td> <td class="vc_file_line_text"> p-&gt;s[sizeof(p-&gt;s) - 1] = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l1757"> <td class="vc_file_line_number"><a href="#l1757">1757</a></td> <td class="vc_file_line_text"> if ((rt = strchr(p-&gt;s, &#39;\n&#39;)) != NULL)</td> </tr> <tr class="vc_row_odd" id="l1758"> <td class="vc_file_line_number"><a href="#l1758">1758</a></td> <td class="vc_file_line_text"> *rt = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l1759"> <td class="vc_file_line_number"><a href="#l1759">1759</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1760"> <td class="vc_file_line_number"><a href="#l1760">1760</a></td> <td class="vc_file_line_text"> case BESHORT:</td> </tr> <tr class="vc_row_odd" id="l1761"> <td class="vc_file_line_number"><a href="#l1761">1761</a></td> <td class="vc_file_line_text"> p-&gt;h = (short) ((p-&gt;hs[0] &lt;&lt; 8) | (p-&gt;hs[1]));</td> </tr> <tr class="vc_row_odd" id="l1762"> <td class="vc_file_line_number"><a href="#l1762">1762</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1763"> <td class="vc_file_line_number"><a href="#l1763">1763</a></td> <td class="vc_file_line_text"> case BELONG:</td> </tr> <tr class="vc_row_odd" id="l1764"> <td class="vc_file_line_number"><a href="#l1764">1764</a></td> <td class="vc_file_line_text"> case BEDATE:</td> </tr> <tr class="vc_row_odd" id="l1765"> <td class="vc_file_line_number"><a href="#l1765">1765</a></td> <td class="vc_file_line_text"> p-&gt;l = (long)</td> </tr> <tr class="vc_row_odd" id="l1766"> <td class="vc_file_line_number"><a href="#l1766">1766</a></td> <td class="vc_file_line_text"> ((p-&gt;hl[0] &lt;&lt; 24) | (p-&gt;hl[1] &lt;&lt; 16) | (p-&gt;hl[2] &lt;&lt; 8) | (p-&gt;hl[3]));</td> </tr> <tr class="vc_row_odd" id="l1767"> <td class="vc_file_line_number"><a href="#l1767">1767</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1768"> <td class="vc_file_line_number"><a href="#l1768">1768</a></td> <td class="vc_file_line_text"> case LESHORT:</td> </tr> <tr class="vc_row_odd" id="l1769"> <td class="vc_file_line_number"><a href="#l1769">1769</a></td> <td class="vc_file_line_text"> p-&gt;h = (short) ((p-&gt;hs[1] &lt;&lt; 8) | (p-&gt;hs[0]));</td> </tr> <tr class="vc_row_odd" id="l1770"> <td class="vc_file_line_number"><a href="#l1770">1770</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1771"> <td class="vc_file_line_number"><a href="#l1771">1771</a></td> <td class="vc_file_line_text"> case LELONG:</td> </tr> <tr class="vc_row_odd" id="l1772"> <td class="vc_file_line_number"><a href="#l1772">1772</a></td> <td class="vc_file_line_text"> case LEDATE:</td> </tr> <tr class="vc_row_odd" id="l1773"> <td class="vc_file_line_number"><a href="#l1773">1773</a></td> <td class="vc_file_line_text"> p-&gt;l = (long)</td> </tr> <tr class="vc_row_odd" id="l1774"> <td class="vc_file_line_number"><a href="#l1774">1774</a></td> <td class="vc_file_line_text"> ((p-&gt;hl[3] &lt;&lt; 24) | (p-&gt;hl[2] &lt;&lt; 16) | (p-&gt;hl[1] &lt;&lt; 8) | (p-&gt;hl[0]));</td> </tr> <tr class="vc_row_odd" id="l1775"> <td class="vc_file_line_number"><a href="#l1775">1775</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1776"> <td class="vc_file_line_number"><a href="#l1776">1776</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1777"> <td class="vc_file_line_number"><a href="#l1777">1777</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01538)</td> </tr> <tr class="vc_row_odd" id="l1778"> <td class="vc_file_line_number"><a href="#l1778">1778</a></td> <td class="vc_file_line_text"> MODNAME &quot;: invalid type %d in mconvert().&quot;, m-&gt;type);</td> </tr> <tr class="vc_row_odd" id="l1779"> <td class="vc_file_line_number"><a href="#l1779">1779</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1780"> <td class="vc_file_line_number"><a href="#l1780">1780</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1781"> <td class="vc_file_line_number"><a href="#l1781">1781</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1782"> <td class="vc_file_line_number"><a href="#l1782">1782</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1783"> <td class="vc_file_line_number"><a href="#l1783">1783</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1784"> <td class="vc_file_line_number"><a href="#l1784">1784</a></td> <td class="vc_file_line_text">static int mget(request_rec *r, union VALUETYPE *p, unsigned char *s,</td> </tr> <tr class="vc_row_odd" id="l1785"> <td class="vc_file_line_number"><a href="#l1785">1785</a></td> <td class="vc_file_line_text"> struct magic *m, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l1786"> <td class="vc_file_line_number"><a href="#l1786">1786</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1787"> <td class="vc_file_line_number"><a href="#l1787">1787</a></td> <td class="vc_file_line_text"> long offset = m-&gt;offset;</td> </tr> <tr class="vc_row_odd" id="l1788"> <td class="vc_file_line_number"><a href="#l1788">1788</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1789"> <td class="vc_file_line_number"><a href="#l1789">1789</a></td> <td class="vc_file_line_text"> if (offset + sizeof(union VALUETYPE) &gt; nbytes)</td> </tr> <tr class="vc_row_odd" id="l1790"> <td class="vc_file_line_number"><a href="#l1790">1790</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1791"> <td class="vc_file_line_number"><a href="#l1791">1791</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1792"> <td class="vc_file_line_number"><a href="#l1792">1792</a></td> <td class="vc_file_line_text"> memcpy(p, s + offset, sizeof(union VALUETYPE));</td> </tr> <tr class="vc_row_odd" id="l1793"> <td class="vc_file_line_number"><a href="#l1793">1793</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1794"> <td class="vc_file_line_number"><a href="#l1794">1794</a></td> <td class="vc_file_line_text"> if (!mconvert(r, p, m))</td> </tr> <tr class="vc_row_odd" id="l1795"> <td class="vc_file_line_number"><a href="#l1795">1795</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1796"> <td class="vc_file_line_number"><a href="#l1796">1796</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1797"> <td class="vc_file_line_number"><a href="#l1797">1797</a></td> <td class="vc_file_line_text"> if (m-&gt;flag &amp; INDIR) {</td> </tr> <tr class="vc_row_odd" id="l1798"> <td class="vc_file_line_number"><a href="#l1798">1798</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1799"> <td class="vc_file_line_number"><a href="#l1799">1799</a></td> <td class="vc_file_line_text"> switch (m-&gt;in.type) {</td> </tr> <tr class="vc_row_odd" id="l1800"> <td class="vc_file_line_number"><a href="#l1800">1800</a></td> <td class="vc_file_line_text"> case BYTE:</td> </tr> <tr class="vc_row_odd" id="l1801"> <td class="vc_file_line_number"><a href="#l1801">1801</a></td> <td class="vc_file_line_text"> offset = p-&gt;b + m-&gt;in.offset;</td> </tr> <tr class="vc_row_odd" id="l1802"> <td class="vc_file_line_number"><a href="#l1802">1802</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1803"> <td class="vc_file_line_number"><a href="#l1803">1803</a></td> <td class="vc_file_line_text"> case SHORT:</td> </tr> <tr class="vc_row_odd" id="l1804"> <td class="vc_file_line_number"><a href="#l1804">1804</a></td> <td class="vc_file_line_text"> offset = p-&gt;h + m-&gt;in.offset;</td> </tr> <tr class="vc_row_odd" id="l1805"> <td class="vc_file_line_number"><a href="#l1805">1805</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1806"> <td class="vc_file_line_number"><a href="#l1806">1806</a></td> <td class="vc_file_line_text"> case LONG:</td> </tr> <tr class="vc_row_odd" id="l1807"> <td class="vc_file_line_number"><a href="#l1807">1807</a></td> <td class="vc_file_line_text"> offset = p-&gt;l + m-&gt;in.offset;</td> </tr> <tr class="vc_row_odd" id="l1808"> <td class="vc_file_line_number"><a href="#l1808">1808</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1809"> <td class="vc_file_line_number"><a href="#l1809">1809</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1810"> <td class="vc_file_line_number"><a href="#l1810">1810</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1811"> <td class="vc_file_line_number"><a href="#l1811">1811</a></td> <td class="vc_file_line_text"> if (offset + sizeof(union VALUETYPE) &gt; nbytes)</td> </tr> <tr class="vc_row_odd" id="l1812"> <td class="vc_file_line_number"><a href="#l1812">1812</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1813"> <td class="vc_file_line_number"><a href="#l1813">1813</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1814"> <td class="vc_file_line_number"><a href="#l1814">1814</a></td> <td class="vc_file_line_text"> memcpy(p, s + offset, sizeof(union VALUETYPE));</td> </tr> <tr class="vc_row_odd" id="l1815"> <td class="vc_file_line_number"><a href="#l1815">1815</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1816"> <td class="vc_file_line_number"><a href="#l1816">1816</a></td> <td class="vc_file_line_text"> if (!mconvert(r, p, m))</td> </tr> <tr class="vc_row_odd" id="l1817"> <td class="vc_file_line_number"><a href="#l1817">1817</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1818"> <td class="vc_file_line_number"><a href="#l1818">1818</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1819"> <td class="vc_file_line_number"><a href="#l1819">1819</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1820"> <td class="vc_file_line_number"><a href="#l1820">1820</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1821"> <td class="vc_file_line_number"><a href="#l1821">1821</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1822"> <td class="vc_file_line_number"><a href="#l1822">1822</a></td> <td class="vc_file_line_text">static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)</td> </tr> <tr class="vc_row_odd" id="l1823"> <td class="vc_file_line_number"><a href="#l1823">1823</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1824"> <td class="vc_file_line_number"><a href="#l1824">1824</a></td> <td class="vc_file_line_text"> register unsigned long l = m-&gt;value.l;</td> </tr> <tr class="vc_row_odd" id="l1825"> <td class="vc_file_line_number"><a href="#l1825">1825</a></td> <td class="vc_file_line_text"> register unsigned long v;</td> </tr> <tr class="vc_row_odd" id="l1826"> <td class="vc_file_line_number"><a href="#l1826">1826</a></td> <td class="vc_file_line_text"> int matched;</td> </tr> <tr class="vc_row_odd" id="l1827"> <td class="vc_file_line_number"><a href="#l1827">1827</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1828"> <td class="vc_file_line_number"><a href="#l1828">1828</a></td> <td class="vc_file_line_text"> if ((m-&gt;value.s[0] == &#39;x&#39;) &amp;&amp; (m-&gt;value.s[1] == &#39;\0&#39;)) {</td> </tr> <tr class="vc_row_odd" id="l1829"> <td class="vc_file_line_number"><a href="#l1829">1829</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01539)</td> </tr> <tr class="vc_row_odd" id="l1830"> <td class="vc_file_line_number"><a href="#l1830">1830</a></td> <td class="vc_file_line_text"> MODNAME &quot;: BOINK&quot;);</td> </tr> <tr class="vc_row_odd" id="l1831"> <td class="vc_file_line_number"><a href="#l1831">1831</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1832"> <td class="vc_file_line_number"><a href="#l1832">1832</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1833"> <td class="vc_file_line_number"><a href="#l1833">1833</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1834"> <td class="vc_file_line_number"><a href="#l1834">1834</a></td> <td class="vc_file_line_text"> switch (m-&gt;type) {</td> </tr> <tr class="vc_row_odd" id="l1835"> <td class="vc_file_line_number"><a href="#l1835">1835</a></td> <td class="vc_file_line_text"> case BYTE:</td> </tr> <tr class="vc_row_odd" id="l1836"> <td class="vc_file_line_number"><a href="#l1836">1836</a></td> <td class="vc_file_line_text"> v = p-&gt;b;</td> </tr> <tr class="vc_row_odd" id="l1837"> <td class="vc_file_line_number"><a href="#l1837">1837</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1838"> <td class="vc_file_line_number"><a href="#l1838">1838</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1839"> <td class="vc_file_line_number"><a href="#l1839">1839</a></td> <td class="vc_file_line_text"> case SHORT:</td> </tr> <tr class="vc_row_odd" id="l1840"> <td class="vc_file_line_number"><a href="#l1840">1840</a></td> <td class="vc_file_line_text"> case BESHORT:</td> </tr> <tr class="vc_row_odd" id="l1841"> <td class="vc_file_line_number"><a href="#l1841">1841</a></td> <td class="vc_file_line_text"> case LESHORT:</td> </tr> <tr class="vc_row_odd" id="l1842"> <td class="vc_file_line_number"><a href="#l1842">1842</a></td> <td class="vc_file_line_text"> v = p-&gt;h;</td> </tr> <tr class="vc_row_odd" id="l1843"> <td class="vc_file_line_number"><a href="#l1843">1843</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1844"> <td class="vc_file_line_number"><a href="#l1844">1844</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1845"> <td class="vc_file_line_number"><a href="#l1845">1845</a></td> <td class="vc_file_line_text"> case LONG:</td> </tr> <tr class="vc_row_odd" id="l1846"> <td class="vc_file_line_number"><a href="#l1846">1846</a></td> <td class="vc_file_line_text"> case BELONG:</td> </tr> <tr class="vc_row_odd" id="l1847"> <td class="vc_file_line_number"><a href="#l1847">1847</a></td> <td class="vc_file_line_text"> case LELONG:</td> </tr> <tr class="vc_row_odd" id="l1848"> <td class="vc_file_line_number"><a href="#l1848">1848</a></td> <td class="vc_file_line_text"> case DATE:</td> </tr> <tr class="vc_row_odd" id="l1849"> <td class="vc_file_line_number"><a href="#l1849">1849</a></td> <td class="vc_file_line_text"> case BEDATE:</td> </tr> <tr class="vc_row_odd" id="l1850"> <td class="vc_file_line_number"><a href="#l1850">1850</a></td> <td class="vc_file_line_text"> case LEDATE:</td> </tr> <tr class="vc_row_odd" id="l1851"> <td class="vc_file_line_number"><a href="#l1851">1851</a></td> <td class="vc_file_line_text"> v = p-&gt;l;</td> </tr> <tr class="vc_row_odd" id="l1852"> <td class="vc_file_line_number"><a href="#l1852">1852</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1853"> <td class="vc_file_line_number"><a href="#l1853">1853</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1854"> <td class="vc_file_line_number"><a href="#l1854">1854</a></td> <td class="vc_file_line_text"> case STRING:</td> </tr> <tr class="vc_row_odd" id="l1855"> <td class="vc_file_line_number"><a href="#l1855">1855</a></td> <td class="vc_file_line_text"> l = 0;</td> </tr> <tr class="vc_row_odd" id="l1856"> <td class="vc_file_line_number"><a href="#l1856">1856</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1857"> <td class="vc_file_line_number"><a href="#l1857">1857</a></td> <td class="vc_file_line_text"> * What we want here is: v = strncmp(m-&gt;value.s, p-&gt;s, m-&gt;vallen);</td> </tr> <tr class="vc_row_odd" id="l1858"> <td class="vc_file_line_number"><a href="#l1858">1858</a></td> <td class="vc_file_line_text"> * but ignoring any nulls. bcmp doesn&#39;t give -/+/0 and isn&#39;t</td> </tr> <tr class="vc_row_odd" id="l1859"> <td class="vc_file_line_number"><a href="#l1859">1859</a></td> <td class="vc_file_line_text"> * universally available anyway.</td> </tr> <tr class="vc_row_odd" id="l1860"> <td class="vc_file_line_number"><a href="#l1860">1860</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1861"> <td class="vc_file_line_number"><a href="#l1861">1861</a></td> <td class="vc_file_line_text"> v = 0;</td> </tr> <tr class="vc_row_odd" id="l1862"> <td class="vc_file_line_number"><a href="#l1862">1862</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l1863"> <td class="vc_file_line_number"><a href="#l1863">1863</a></td> <td class="vc_file_line_text"> register unsigned char *a = (unsigned char *) m-&gt;value.s;</td> </tr> <tr class="vc_row_odd" id="l1864"> <td class="vc_file_line_number"><a href="#l1864">1864</a></td> <td class="vc_file_line_text"> register unsigned char *b = (unsigned char *) p-&gt;s;</td> </tr> <tr class="vc_row_odd" id="l1865"> <td class="vc_file_line_number"><a href="#l1865">1865</a></td> <td class="vc_file_line_text"> register int len = m-&gt;vallen;</td> </tr> <tr class="vc_row_odd" id="l1866"> <td class="vc_file_line_number"><a href="#l1866">1866</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1867"> <td class="vc_file_line_number"><a href="#l1867">1867</a></td> <td class="vc_file_line_text"> while (--len &gt;= 0)</td> </tr> <tr class="vc_row_odd" id="l1868"> <td class="vc_file_line_number"><a href="#l1868">1868</a></td> <td class="vc_file_line_text"> if ((v = *b++ - *a++) != 0)</td> </tr> <tr class="vc_row_odd" id="l1869"> <td class="vc_file_line_number"><a href="#l1869">1869</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1870"> <td class="vc_file_line_number"><a href="#l1870">1870</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1871"> <td class="vc_file_line_number"><a href="#l1871">1871</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1872"> <td class="vc_file_line_number"><a href="#l1872">1872</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1873"> <td class="vc_file_line_number"><a href="#l1873">1873</a></td> <td class="vc_file_line_text"> /* bogosity, pretend that it just wasn&#39;t a match */</td> </tr> <tr class="vc_row_odd" id="l1874"> <td class="vc_file_line_number"><a href="#l1874">1874</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01540)</td> </tr> <tr class="vc_row_odd" id="l1875"> <td class="vc_file_line_number"><a href="#l1875">1875</a></td> <td class="vc_file_line_text"> MODNAME &quot;: invalid type %d in mcheck().&quot;, m-&gt;type);</td> </tr> <tr class="vc_row_odd" id="l1876"> <td class="vc_file_line_number"><a href="#l1876">1876</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l1877"> <td class="vc_file_line_number"><a href="#l1877">1877</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1878"> <td class="vc_file_line_number"><a href="#l1878">1878</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1879"> <td class="vc_file_line_number"><a href="#l1879">1879</a></td> <td class="vc_file_line_text"> v = signextend(r-&gt;server, m, v) &amp; m-&gt;mask;</td> </tr> <tr class="vc_row_odd" id="l1880"> <td class="vc_file_line_number"><a href="#l1880">1880</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1881"> <td class="vc_file_line_number"><a href="#l1881">1881</a></td> <td class="vc_file_line_text"> switch (m-&gt;reln) {</td> </tr> <tr class="vc_row_odd" id="l1882"> <td class="vc_file_line_number"><a href="#l1882">1882</a></td> <td class="vc_file_line_text"> case &#39;x&#39;:</td> </tr> <tr class="vc_row_odd" id="l1883"> <td class="vc_file_line_number"><a href="#l1883">1883</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1884"> <td class="vc_file_line_number"><a href="#l1884">1884</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01541)</td> </tr> <tr class="vc_row_odd" id="l1885"> <td class="vc_file_line_number"><a href="#l1885">1885</a></td> <td class="vc_file_line_text"> &quot;%lu == *any* = 1&quot;, v);</td> </tr> <tr class="vc_row_odd" id="l1886"> <td class="vc_file_line_number"><a href="#l1886">1886</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1887"> <td class="vc_file_line_number"><a href="#l1887">1887</a></td> <td class="vc_file_line_text"> matched = 1;</td> </tr> <tr class="vc_row_odd" id="l1888"> <td class="vc_file_line_number"><a href="#l1888">1888</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1889"> <td class="vc_file_line_number"><a href="#l1889">1889</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1890"> <td class="vc_file_line_number"><a href="#l1890">1890</a></td> <td class="vc_file_line_text"> case &#39;!&#39;:</td> </tr> <tr class="vc_row_odd" id="l1891"> <td class="vc_file_line_number"><a href="#l1891">1891</a></td> <td class="vc_file_line_text"> matched = v != l;</td> </tr> <tr class="vc_row_odd" id="l1892"> <td class="vc_file_line_number"><a href="#l1892">1892</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1893"> <td class="vc_file_line_number"><a href="#l1893">1893</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01542)</td> </tr> <tr class="vc_row_odd" id="l1894"> <td class="vc_file_line_number"><a href="#l1894">1894</a></td> <td class="vc_file_line_text"> &quot;%lu != %lu = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1895"> <td class="vc_file_line_number"><a href="#l1895">1895</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1896"> <td class="vc_file_line_number"><a href="#l1896">1896</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1897"> <td class="vc_file_line_number"><a href="#l1897">1897</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1898"> <td class="vc_file_line_number"><a href="#l1898">1898</a></td> <td class="vc_file_line_text"> case &#39;=&#39;:</td> </tr> <tr class="vc_row_odd" id="l1899"> <td class="vc_file_line_number"><a href="#l1899">1899</a></td> <td class="vc_file_line_text"> matched = v == l;</td> </tr> <tr class="vc_row_odd" id="l1900"> <td class="vc_file_line_number"><a href="#l1900">1900</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1901"> <td class="vc_file_line_number"><a href="#l1901">1901</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01543)</td> </tr> <tr class="vc_row_odd" id="l1902"> <td class="vc_file_line_number"><a href="#l1902">1902</a></td> <td class="vc_file_line_text"> &quot;%lu == %lu = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1903"> <td class="vc_file_line_number"><a href="#l1903">1903</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1904"> <td class="vc_file_line_number"><a href="#l1904">1904</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1905"> <td class="vc_file_line_number"><a href="#l1905">1905</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1906"> <td class="vc_file_line_number"><a href="#l1906">1906</a></td> <td class="vc_file_line_text"> case &#39;&gt;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1907"> <td class="vc_file_line_number"><a href="#l1907">1907</a></td> <td class="vc_file_line_text"> if (m-&gt;flag &amp; UNSIGNED) {</td> </tr> <tr class="vc_row_odd" id="l1908"> <td class="vc_file_line_number"><a href="#l1908">1908</a></td> <td class="vc_file_line_text"> matched = v &gt; l;</td> </tr> <tr class="vc_row_odd" id="l1909"> <td class="vc_file_line_number"><a href="#l1909">1909</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1910"> <td class="vc_file_line_number"><a href="#l1910">1910</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01544)</td> </tr> <tr class="vc_row_odd" id="l1911"> <td class="vc_file_line_number"><a href="#l1911">1911</a></td> <td class="vc_file_line_text"> &quot;%lu &gt; %lu = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1912"> <td class="vc_file_line_number"><a href="#l1912">1912</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1913"> <td class="vc_file_line_number"><a href="#l1913">1913</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1914"> <td class="vc_file_line_number"><a href="#l1914">1914</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l1915"> <td class="vc_file_line_number"><a href="#l1915">1915</a></td> <td class="vc_file_line_text"> matched = (long) v &gt; (long) l;</td> </tr> <tr class="vc_row_odd" id="l1916"> <td class="vc_file_line_number"><a href="#l1916">1916</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1917"> <td class="vc_file_line_number"><a href="#l1917">1917</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01545)</td> </tr> <tr class="vc_row_odd" id="l1918"> <td class="vc_file_line_number"><a href="#l1918">1918</a></td> <td class="vc_file_line_text"> &quot;%ld &gt; %ld = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1919"> <td class="vc_file_line_number"><a href="#l1919">1919</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1920"> <td class="vc_file_line_number"><a href="#l1920">1920</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1921"> <td class="vc_file_line_number"><a href="#l1921">1921</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1922"> <td class="vc_file_line_number"><a href="#l1922">1922</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1923"> <td class="vc_file_line_number"><a href="#l1923">1923</a></td> <td class="vc_file_line_text"> case &#39;&lt;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1924"> <td class="vc_file_line_number"><a href="#l1924">1924</a></td> <td class="vc_file_line_text"> if (m-&gt;flag &amp; UNSIGNED) {</td> </tr> <tr class="vc_row_odd" id="l1925"> <td class="vc_file_line_number"><a href="#l1925">1925</a></td> <td class="vc_file_line_text"> matched = v &lt; l;</td> </tr> <tr class="vc_row_odd" id="l1926"> <td class="vc_file_line_number"><a href="#l1926">1926</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1927"> <td class="vc_file_line_number"><a href="#l1927">1927</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01546)</td> </tr> <tr class="vc_row_odd" id="l1928"> <td class="vc_file_line_number"><a href="#l1928">1928</a></td> <td class="vc_file_line_text"> &quot;%lu &lt; %lu = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1929"> <td class="vc_file_line_number"><a href="#l1929">1929</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1930"> <td class="vc_file_line_number"><a href="#l1930">1930</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1931"> <td class="vc_file_line_number"><a href="#l1931">1931</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l1932"> <td class="vc_file_line_number"><a href="#l1932">1932</a></td> <td class="vc_file_line_text"> matched = (long) v &lt; (long) l;</td> </tr> <tr class="vc_row_odd" id="l1933"> <td class="vc_file_line_number"><a href="#l1933">1933</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1934"> <td class="vc_file_line_number"><a href="#l1934">1934</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01547)</td> </tr> <tr class="vc_row_odd" id="l1935"> <td class="vc_file_line_number"><a href="#l1935">1935</a></td> <td class="vc_file_line_text"> &quot;%ld &lt; %ld = %d&quot;, v, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1936"> <td class="vc_file_line_number"><a href="#l1936">1936</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1937"> <td class="vc_file_line_number"><a href="#l1937">1937</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1938"> <td class="vc_file_line_number"><a href="#l1938">1938</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1939"> <td class="vc_file_line_number"><a href="#l1939">1939</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1940"> <td class="vc_file_line_number"><a href="#l1940">1940</a></td> <td class="vc_file_line_text"> case &#39;&amp;&#39;:</td> </tr> <tr class="vc_row_odd" id="l1941"> <td class="vc_file_line_number"><a href="#l1941">1941</a></td> <td class="vc_file_line_text"> matched = (v &amp; l) == l;</td> </tr> <tr class="vc_row_odd" id="l1942"> <td class="vc_file_line_number"><a href="#l1942">1942</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1943"> <td class="vc_file_line_number"><a href="#l1943">1943</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01548)</td> </tr> <tr class="vc_row_odd" id="l1944"> <td class="vc_file_line_number"><a href="#l1944">1944</a></td> <td class="vc_file_line_text"> &quot;((%lx &amp; %lx) == %lx) = %d&quot;, v, l, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1945"> <td class="vc_file_line_number"><a href="#l1945">1945</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1946"> <td class="vc_file_line_number"><a href="#l1946">1946</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1947"> <td class="vc_file_line_number"><a href="#l1947">1947</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1948"> <td class="vc_file_line_number"><a href="#l1948">1948</a></td> <td class="vc_file_line_text"> case &#39;^&#39;:</td> </tr> <tr class="vc_row_odd" id="l1949"> <td class="vc_file_line_number"><a href="#l1949">1949</a></td> <td class="vc_file_line_text"> matched = (v &amp; l) != l;</td> </tr> <tr class="vc_row_odd" id="l1950"> <td class="vc_file_line_number"><a href="#l1950">1950</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l1951"> <td class="vc_file_line_number"><a href="#l1951">1951</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01549)</td> </tr> <tr class="vc_row_odd" id="l1952"> <td class="vc_file_line_number"><a href="#l1952">1952</a></td> <td class="vc_file_line_text"> &quot;((%lx &amp; %lx) != %lx) = %d&quot;, v, l, l, matched);</td> </tr> <tr class="vc_row_odd" id="l1953"> <td class="vc_file_line_number"><a href="#l1953">1953</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l1954"> <td class="vc_file_line_number"><a href="#l1954">1954</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1955"> <td class="vc_file_line_number"><a href="#l1955">1955</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1956"> <td class="vc_file_line_number"><a href="#l1956">1956</a></td> <td class="vc_file_line_text"> default:</td> </tr> <tr class="vc_row_odd" id="l1957"> <td class="vc_file_line_number"><a href="#l1957">1957</a></td> <td class="vc_file_line_text"> /* bogosity, pretend it didn&#39;t match */</td> </tr> <tr class="vc_row_odd" id="l1958"> <td class="vc_file_line_number"><a href="#l1958">1958</a></td> <td class="vc_file_line_text"> matched = 0;</td> </tr> <tr class="vc_row_odd" id="l1959"> <td class="vc_file_line_number"><a href="#l1959">1959</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01550)</td> </tr> <tr class="vc_row_odd" id="l1960"> <td class="vc_file_line_number"><a href="#l1960">1960</a></td> <td class="vc_file_line_text"> MODNAME &quot;: mcheck: can&#39;t happen: invalid relation %d.&quot;,</td> </tr> <tr class="vc_row_odd" id="l1961"> <td class="vc_file_line_number"><a href="#l1961">1961</a></td> <td class="vc_file_line_text"> m-&gt;reln);</td> </tr> <tr class="vc_row_odd" id="l1962"> <td class="vc_file_line_number"><a href="#l1962">1962</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l1963"> <td class="vc_file_line_number"><a href="#l1963">1963</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1964"> <td class="vc_file_line_number"><a href="#l1964">1964</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1965"> <td class="vc_file_line_number"><a href="#l1965">1965</a></td> <td class="vc_file_line_text"> return matched;</td> </tr> <tr class="vc_row_odd" id="l1966"> <td class="vc_file_line_number"><a href="#l1966">1966</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l1967"> <td class="vc_file_line_number"><a href="#l1967">1967</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1968"> <td class="vc_file_line_number"><a href="#l1968">1968</a></td> <td class="vc_file_line_text">/* an optimization over plain strcmp() */</td> </tr> <tr class="vc_row_odd" id="l1969"> <td class="vc_file_line_number"><a href="#l1969">1969</a></td> <td class="vc_file_line_text">#define STREQ(a, b) (*(a) == *(b) &amp;&amp; strcmp((a), (b)) == 0)</td> </tr> <tr class="vc_row_odd" id="l1970"> <td class="vc_file_line_number"><a href="#l1970">1970</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1971"> <td class="vc_file_line_number"><a href="#l1971">1971</a></td> <td class="vc_file_line_text">static int ascmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l1972"> <td class="vc_file_line_number"><a href="#l1972">1972</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l1973"> <td class="vc_file_line_number"><a href="#l1973">1973</a></td> <td class="vc_file_line_text"> int has_escapes = 0;</td> </tr> <tr class="vc_row_odd" id="l1974"> <td class="vc_file_line_number"><a href="#l1974">1974</a></td> <td class="vc_file_line_text"> unsigned char *s;</td> </tr> <tr class="vc_row_odd" id="l1975"> <td class="vc_file_line_number"><a href="#l1975">1975</a></td> <td class="vc_file_line_text"> char nbuf[SMALL_HOWMANY + 1]; /* one extra for terminating &#39;\0&#39; */</td> </tr> <tr class="vc_row_odd" id="l1976"> <td class="vc_file_line_number"><a href="#l1976">1976</a></td> <td class="vc_file_line_text"> char *token;</td> </tr> <tr class="vc_row_odd" id="l1977"> <td class="vc_file_line_number"><a href="#l1977">1977</a></td> <td class="vc_file_line_text"> const struct names *p;</td> </tr> <tr class="vc_row_odd" id="l1978"> <td class="vc_file_line_number"><a href="#l1978">1978</a></td> <td class="vc_file_line_text"> int small_nbytes;</td> </tr> <tr class="vc_row_odd" id="l1979"> <td class="vc_file_line_number"><a href="#l1979">1979</a></td> <td class="vc_file_line_text"> char *strtok_state;</td> </tr> <tr class="vc_row_odd" id="l1980"> <td class="vc_file_line_number"><a href="#l1980">1980</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1981"> <td class="vc_file_line_number"><a href="#l1981">1981</a></td> <td class="vc_file_line_text"> /* these are easy, do them first */</td> </tr> <tr class="vc_row_odd" id="l1982"> <td class="vc_file_line_number"><a href="#l1982">1982</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1983"> <td class="vc_file_line_number"><a href="#l1983">1983</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l1984"> <td class="vc_file_line_number"><a href="#l1984">1984</a></td> <td class="vc_file_line_text"> * for troff, look for . + letter + letter or .\&quot;; this must be done to</td> </tr> <tr class="vc_row_odd" id="l1985"> <td class="vc_file_line_number"><a href="#l1985">1985</a></td> <td class="vc_file_line_text"> * disambiguate tar archives&#39; ./file and other trash from real troff</td> </tr> <tr class="vc_row_odd" id="l1986"> <td class="vc_file_line_number"><a href="#l1986">1986</a></td> <td class="vc_file_line_text"> * input.</td> </tr> <tr class="vc_row_odd" id="l1987"> <td class="vc_file_line_number"><a href="#l1987">1987</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l1988"> <td class="vc_file_line_number"><a href="#l1988">1988</a></td> <td class="vc_file_line_text"> if (*buf == &#39;.&#39;) {</td> </tr> <tr class="vc_row_odd" id="l1989"> <td class="vc_file_line_number"><a href="#l1989">1989</a></td> <td class="vc_file_line_text"> unsigned char *tp = buf + 1;</td> </tr> <tr class="vc_row_odd" id="l1990"> <td class="vc_file_line_number"><a href="#l1990">1990</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l1991"> <td class="vc_file_line_number"><a href="#l1991">1991</a></td> <td class="vc_file_line_text"> while (apr_isspace(*tp))</td> </tr> <tr class="vc_row_odd" id="l1992"> <td class="vc_file_line_number"><a href="#l1992">1992</a></td> <td class="vc_file_line_text"> ++tp; /* skip leading whitespace */</td> </tr> <tr class="vc_row_odd" id="l1993"> <td class="vc_file_line_number"><a href="#l1993">1993</a></td> <td class="vc_file_line_text"> if ((apr_isalnum(*tp) || *tp == &#39;\\&#39;) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l1994"> <td class="vc_file_line_number"><a href="#l1994">1994</a></td> <td class="vc_file_line_text"> (apr_isalnum(*(tp + 1)) || *tp == &#39;&quot;&#39;)) {</td> </tr> <tr class="vc_row_odd" id="l1995"> <td class="vc_file_line_number"><a href="#l1995">1995</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, &quot;application/x-troff&quot;);</td> </tr> <tr class="vc_row_odd" id="l1996"> <td class="vc_file_line_number"><a href="#l1996">1996</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l1997"> <td class="vc_file_line_number"><a href="#l1997">1997</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1998"> <td class="vc_file_line_number"><a href="#l1998">1998</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l1999"> <td class="vc_file_line_number"><a href="#l1999">1999</a></td> <td class="vc_file_line_text"> if ((*buf == &#39;c&#39; || *buf == &#39;C&#39;) &amp;&amp; apr_isspace(*(buf + 1))) {</td> </tr> <tr class="vc_row_odd" id="l2000"> <td class="vc_file_line_number"><a href="#l2000">2000</a></td> <td class="vc_file_line_text"> /* Fortran */</td> </tr> <tr class="vc_row_odd" id="l2001"> <td class="vc_file_line_number"><a href="#l2001">2001</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, &quot;text/plain&quot;);</td> </tr> <tr class="vc_row_odd" id="l2002"> <td class="vc_file_line_number"><a href="#l2002">2002</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l2003"> <td class="vc_file_line_number"><a href="#l2003">2003</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2004"> <td class="vc_file_line_number"><a href="#l2004">2004</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2005"> <td class="vc_file_line_number"><a href="#l2005">2005</a></td> <td class="vc_file_line_text"> /* look for tokens from names.h - this is expensive!, so we&#39;ll limit</td> </tr> <tr class="vc_row_odd" id="l2006"> <td class="vc_file_line_number"><a href="#l2006">2006</a></td> <td class="vc_file_line_text"> * ourselves to only SMALL_HOWMANY bytes */</td> </tr> <tr class="vc_row_odd" id="l2007"> <td class="vc_file_line_number"><a href="#l2007">2007</a></td> <td class="vc_file_line_text"> small_nbytes = (nbytes &gt; SMALL_HOWMANY) ? SMALL_HOWMANY : nbytes;</td> </tr> <tr class="vc_row_odd" id="l2008"> <td class="vc_file_line_number"><a href="#l2008">2008</a></td> <td class="vc_file_line_text"> /* make a copy of the buffer here because apr_strtok() will destroy it */</td> </tr> <tr class="vc_row_odd" id="l2009"> <td class="vc_file_line_number"><a href="#l2009">2009</a></td> <td class="vc_file_line_text"> s = (unsigned char *) memcpy(nbuf, buf, small_nbytes);</td> </tr> <tr class="vc_row_odd" id="l2010"> <td class="vc_file_line_number"><a href="#l2010">2010</a></td> <td class="vc_file_line_text"> s[small_nbytes] = &#39;\0&#39;;</td> </tr> <tr class="vc_row_odd" id="l2011"> <td class="vc_file_line_number"><a href="#l2011">2011</a></td> <td class="vc_file_line_text"> has_escapes = (memchr(s, &#39;\033&#39;, small_nbytes) != NULL);</td> </tr> <tr class="vc_row_odd" id="l2012"> <td class="vc_file_line_number"><a href="#l2012">2012</a></td> <td class="vc_file_line_text"> while ((token = apr_strtok((char *) s, &quot; \t\n\r\f&quot;, &amp;strtok_state)) != NULL) {</td> </tr> <tr class="vc_row_odd" id="l2013"> <td class="vc_file_line_number"><a href="#l2013">2013</a></td> <td class="vc_file_line_text"> s = NULL; /* make apr_strtok() keep on tokin&#39; */</td> </tr> <tr class="vc_row_odd" id="l2014"> <td class="vc_file_line_number"><a href="#l2014">2014</a></td> <td class="vc_file_line_text"> for (p = names; p &lt; names + NNAMES; p++) {</td> </tr> <tr class="vc_row_odd" id="l2015"> <td class="vc_file_line_number"><a href="#l2015">2015</a></td> <td class="vc_file_line_text"> if (STREQ(p-&gt;name, token)) {</td> </tr> <tr class="vc_row_odd" id="l2016"> <td class="vc_file_line_number"><a href="#l2016">2016</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, types[p-&gt;type]);</td> </tr> <tr class="vc_row_odd" id="l2017"> <td class="vc_file_line_number"><a href="#l2017">2017</a></td> <td class="vc_file_line_text"> if (has_escapes)</td> </tr> <tr class="vc_row_odd" id="l2018"> <td class="vc_file_line_number"><a href="#l2018">2018</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, &quot; (with escape sequences)&quot;);</td> </tr> <tr class="vc_row_odd" id="l2019"> <td class="vc_file_line_number"><a href="#l2019">2019</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l2020"> <td class="vc_file_line_number"><a href="#l2020">2020</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2021"> <td class="vc_file_line_number"><a href="#l2021">2021</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2022"> <td class="vc_file_line_number"><a href="#l2022">2022</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2023"> <td class="vc_file_line_number"><a href="#l2023">2023</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2024"> <td class="vc_file_line_number"><a href="#l2024">2024</a></td> <td class="vc_file_line_text"> switch (is_tar(buf, nbytes)) {</td> </tr> <tr class="vc_row_odd" id="l2025"> <td class="vc_file_line_number"><a href="#l2025">2025</a></td> <td class="vc_file_line_text"> case 1:</td> </tr> <tr class="vc_row_odd" id="l2026"> <td class="vc_file_line_number"><a href="#l2026">2026</a></td> <td class="vc_file_line_text"> /* V7 tar archive */</td> </tr> <tr class="vc_row_odd" id="l2027"> <td class="vc_file_line_number"><a href="#l2027">2027</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, &quot;application/x-tar&quot;);</td> </tr> <tr class="vc_row_odd" id="l2028"> <td class="vc_file_line_number"><a href="#l2028">2028</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l2029"> <td class="vc_file_line_number"><a href="#l2029">2029</a></td> <td class="vc_file_line_text"> case 2:</td> </tr> <tr class="vc_row_odd" id="l2030"> <td class="vc_file_line_number"><a href="#l2030">2030</a></td> <td class="vc_file_line_text"> /* POSIX tar archive */</td> </tr> <tr class="vc_row_odd" id="l2031"> <td class="vc_file_line_number"><a href="#l2031">2031</a></td> <td class="vc_file_line_text"> magic_rsl_puts(r, &quot;application/x-tar&quot;);</td> </tr> <tr class="vc_row_odd" id="l2032"> <td class="vc_file_line_number"><a href="#l2032">2032</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l2033"> <td class="vc_file_line_number"><a href="#l2033">2033</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2034"> <td class="vc_file_line_number"><a href="#l2034">2034</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2035"> <td class="vc_file_line_number"><a href="#l2035">2035</a></td> <td class="vc_file_line_text"> /* all else fails, but it is ascii... */</td> </tr> <tr class="vc_row_odd" id="l2036"> <td class="vc_file_line_number"><a href="#l2036">2036</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2037"> <td class="vc_file_line_number"><a href="#l2037">2037</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2038"> <td class="vc_file_line_number"><a href="#l2038">2038</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2039"> <td class="vc_file_line_number"><a href="#l2039">2039</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2040"> <td class="vc_file_line_number"><a href="#l2040">2040</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2041"> <td class="vc_file_line_number"><a href="#l2041">2041</a></td> <td class="vc_file_line_text"> * compress routines: zmagic() - returns 0 if not recognized, uncompresses</td> </tr> <tr class="vc_row_odd" id="l2042"> <td class="vc_file_line_number"><a href="#l2042">2042</a></td> <td class="vc_file_line_text"> * and prints information if recognized uncompress(s, method, old, n, newch)</td> </tr> <tr class="vc_row_odd" id="l2043"> <td class="vc_file_line_number"><a href="#l2043">2043</a></td> <td class="vc_file_line_text"> * - uncompress old into new, using method, return sizeof new</td> </tr> <tr class="vc_row_odd" id="l2044"> <td class="vc_file_line_number"><a href="#l2044">2044</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2045"> <td class="vc_file_line_number"><a href="#l2045">2045</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2046"> <td class="vc_file_line_number"><a href="#l2046">2046</a></td> <td class="vc_file_line_text">static const struct {</td> </tr> <tr class="vc_row_odd" id="l2047"> <td class="vc_file_line_number"><a href="#l2047">2047</a></td> <td class="vc_file_line_text"> const char *magic;</td> </tr> <tr class="vc_row_odd" id="l2048"> <td class="vc_file_line_number"><a href="#l2048">2048</a></td> <td class="vc_file_line_text"> apr_size_t maglen;</td> </tr> <tr class="vc_row_odd" id="l2049"> <td class="vc_file_line_number"><a href="#l2049">2049</a></td> <td class="vc_file_line_text"> const char *argv[3];</td> </tr> <tr class="vc_row_odd" id="l2050"> <td class="vc_file_line_number"><a href="#l2050">2050</a></td> <td class="vc_file_line_text"> int silent;</td> </tr> <tr class="vc_row_odd" id="l2051"> <td class="vc_file_line_number"><a href="#l2051">2051</a></td> <td class="vc_file_line_text"> const char *encoding; /* MUST be lowercase */</td> </tr> <tr class="vc_row_odd" id="l2052"> <td class="vc_file_line_number"><a href="#l2052">2052</a></td> <td class="vc_file_line_text">} compr[] = {</td> </tr> <tr class="vc_row_odd" id="l2053"> <td class="vc_file_line_number"><a href="#l2053">2053</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2054"> <td class="vc_file_line_number"><a href="#l2054">2054</a></td> <td class="vc_file_line_text"> /* we use gzip here rather than uncompress because we have to pass</td> </tr> <tr class="vc_row_odd" id="l2055"> <td class="vc_file_line_number"><a href="#l2055">2055</a></td> <td class="vc_file_line_text"> * it a full filename -- and uncompress only considers filenames</td> </tr> <tr class="vc_row_odd" id="l2056"> <td class="vc_file_line_number"><a href="#l2056">2056</a></td> <td class="vc_file_line_text"> * ending with .Z</td> </tr> <tr class="vc_row_odd" id="l2057"> <td class="vc_file_line_number"><a href="#l2057">2057</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2058"> <td class="vc_file_line_number"><a href="#l2058">2058</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l2059"> <td class="vc_file_line_number"><a href="#l2059">2059</a></td> <td class="vc_file_line_text"> &quot;\037\235&quot;, 2, {</td> </tr> <tr class="vc_row_odd" id="l2060"> <td class="vc_file_line_number"><a href="#l2060">2060</a></td> <td class="vc_file_line_text"> &quot;gzip&quot;, &quot;-dcq&quot;, NULL</td> </tr> <tr class="vc_row_odd" id="l2061"> <td class="vc_file_line_number"><a href="#l2061">2061</a></td> <td class="vc_file_line_text"> }, 0, &quot;x-compress&quot;</td> </tr> <tr class="vc_row_odd" id="l2062"> <td class="vc_file_line_number"><a href="#l2062">2062</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l2063"> <td class="vc_file_line_number"><a href="#l2063">2063</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l2064"> <td class="vc_file_line_number"><a href="#l2064">2064</a></td> <td class="vc_file_line_text"> &quot;\037\213&quot;, 2, {</td> </tr> <tr class="vc_row_odd" id="l2065"> <td class="vc_file_line_number"><a href="#l2065">2065</a></td> <td class="vc_file_line_text"> &quot;gzip&quot;, &quot;-dcq&quot;, NULL</td> </tr> <tr class="vc_row_odd" id="l2066"> <td class="vc_file_line_number"><a href="#l2066">2066</a></td> <td class="vc_file_line_text"> }, 1, &quot;x-gzip&quot;</td> </tr> <tr class="vc_row_odd" id="l2067"> <td class="vc_file_line_number"><a href="#l2067">2067</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l2068"> <td class="vc_file_line_number"><a href="#l2068">2068</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l2069"> <td class="vc_file_line_number"><a href="#l2069">2069</a></td> <td class="vc_file_line_text"> * XXX pcat does not work, cause I don&#39;t know how to make it read stdin,</td> </tr> <tr class="vc_row_odd" id="l2070"> <td class="vc_file_line_number"><a href="#l2070">2070</a></td> <td class="vc_file_line_text"> * so we use gzip</td> </tr> <tr class="vc_row_odd" id="l2071"> <td class="vc_file_line_number"><a href="#l2071">2071</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2072"> <td class="vc_file_line_number"><a href="#l2072">2072</a></td> <td class="vc_file_line_text"> {</td> </tr> <tr class="vc_row_odd" id="l2073"> <td class="vc_file_line_number"><a href="#l2073">2073</a></td> <td class="vc_file_line_text"> &quot;\037\036&quot;, 2, {</td> </tr> <tr class="vc_row_odd" id="l2074"> <td class="vc_file_line_number"><a href="#l2074">2074</a></td> <td class="vc_file_line_text"> &quot;gzip&quot;, &quot;-dcq&quot;, NULL</td> </tr> <tr class="vc_row_odd" id="l2075"> <td class="vc_file_line_number"><a href="#l2075">2075</a></td> <td class="vc_file_line_text"> }, 0, &quot;x-gzip&quot;</td> </tr> <tr class="vc_row_odd" id="l2076"> <td class="vc_file_line_number"><a href="#l2076">2076</a></td> <td class="vc_file_line_text"> },</td> </tr> <tr class="vc_row_odd" id="l2077"> <td class="vc_file_line_number"><a href="#l2077">2077</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l2078"> <td class="vc_file_line_number"><a href="#l2078">2078</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2079"> <td class="vc_file_line_number"><a href="#l2079">2079</a></td> <td class="vc_file_line_text">#define ncompr (sizeof(compr) / sizeof(compr[0]))</td> </tr> <tr class="vc_row_odd" id="l2080"> <td class="vc_file_line_number"><a href="#l2080">2080</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2081"> <td class="vc_file_line_number"><a href="#l2081">2081</a></td> <td class="vc_file_line_text">static int zmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l2082"> <td class="vc_file_line_number"><a href="#l2082">2082</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2083"> <td class="vc_file_line_number"><a href="#l2083">2083</a></td> <td class="vc_file_line_text"> unsigned char *newbuf;</td> </tr> <tr class="vc_row_odd" id="l2084"> <td class="vc_file_line_number"><a href="#l2084">2084</a></td> <td class="vc_file_line_text"> int newsize;</td> </tr> <tr class="vc_row_odd" id="l2085"> <td class="vc_file_line_number"><a href="#l2085">2085</a></td> <td class="vc_file_line_text"> int i;</td> </tr> <tr class="vc_row_odd" id="l2086"> <td class="vc_file_line_number"><a href="#l2086">2086</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2087"> <td class="vc_file_line_number"><a href="#l2087">2087</a></td> <td class="vc_file_line_text"> for (i = 0; i &lt; ncompr; i++) {</td> </tr> <tr class="vc_row_odd" id="l2088"> <td class="vc_file_line_number"><a href="#l2088">2088</a></td> <td class="vc_file_line_text"> if (nbytes &lt; compr[i].maglen)</td> </tr> <tr class="vc_row_odd" id="l2089"> <td class="vc_file_line_number"><a href="#l2089">2089</a></td> <td class="vc_file_line_text"> continue;</td> </tr> <tr class="vc_row_odd" id="l2090"> <td class="vc_file_line_number"><a href="#l2090">2090</a></td> <td class="vc_file_line_text"> if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0)</td> </tr> <tr class="vc_row_odd" id="l2091"> <td class="vc_file_line_number"><a href="#l2091">2091</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l2092"> <td class="vc_file_line_number"><a href="#l2092">2092</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2093"> <td class="vc_file_line_number"><a href="#l2093">2093</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2094"> <td class="vc_file_line_number"><a href="#l2094">2094</a></td> <td class="vc_file_line_text"> if (i == ncompr)</td> </tr> <tr class="vc_row_odd" id="l2095"> <td class="vc_file_line_number"><a href="#l2095">2095</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2096"> <td class="vc_file_line_number"><a href="#l2096">2096</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2097"> <td class="vc_file_line_number"><a href="#l2097">2097</a></td> <td class="vc_file_line_text"> if ((newsize = uncompress(r, i, &amp;newbuf, HOWMANY)) &gt; 0) {</td> </tr> <tr class="vc_row_odd" id="l2098"> <td class="vc_file_line_number"><a href="#l2098">2098</a></td> <td class="vc_file_line_text"> /* set encoding type in the request record */</td> </tr> <tr class="vc_row_odd" id="l2099"> <td class="vc_file_line_number"><a href="#l2099">2099</a></td> <td class="vc_file_line_text"> r-&gt;content_encoding = compr[i].encoding;</td> </tr> <tr class="vc_row_odd" id="l2100"> <td class="vc_file_line_number"><a href="#l2100">2100</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2101"> <td class="vc_file_line_number"><a href="#l2101">2101</a></td> <td class="vc_file_line_text"> newbuf[newsize-1] = &#39;\0&#39;; /* null-terminate uncompressed data */</td> </tr> <tr class="vc_row_odd" id="l2102"> <td class="vc_file_line_number"><a href="#l2102">2102</a></td> <td class="vc_file_line_text"> /* Try to detect the content type of the uncompressed data */</td> </tr> <tr class="vc_row_odd" id="l2103"> <td class="vc_file_line_number"><a href="#l2103">2103</a></td> <td class="vc_file_line_text"> if (tryit(r, newbuf, newsize, 0) != OK) {</td> </tr> <tr class="vc_row_odd" id="l2104"> <td class="vc_file_line_number"><a href="#l2104">2104</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2105"> <td class="vc_file_line_number"><a href="#l2105">2105</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2106"> <td class="vc_file_line_number"><a href="#l2106">2106</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2107"> <td class="vc_file_line_number"><a href="#l2107">2107</a></td> <td class="vc_file_line_text"> return 1;</td> </tr> <tr class="vc_row_odd" id="l2108"> <td class="vc_file_line_number"><a href="#l2108">2108</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2109"> <td class="vc_file_line_number"><a href="#l2109">2109</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2110"> <td class="vc_file_line_number"><a href="#l2110">2110</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2111"> <td class="vc_file_line_number"><a href="#l2111">2111</a></td> <td class="vc_file_line_text">struct uncompress_parms {</td> </tr> <tr class="vc_row_odd" id="l2112"> <td class="vc_file_line_number"><a href="#l2112">2112</a></td> <td class="vc_file_line_text"> request_rec *r;</td> </tr> <tr class="vc_row_odd" id="l2113"> <td class="vc_file_line_number"><a href="#l2113">2113</a></td> <td class="vc_file_line_text"> int method;</td> </tr> <tr class="vc_row_odd" id="l2114"> <td class="vc_file_line_number"><a href="#l2114">2114</a></td> <td class="vc_file_line_text">};</td> </tr> <tr class="vc_row_odd" id="l2115"> <td class="vc_file_line_number"><a href="#l2115">2115</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2116"> <td class="vc_file_line_number"><a href="#l2116">2116</a></td> <td class="vc_file_line_text">static int create_uncompress_child(struct uncompress_parms *parm, apr_pool_t *cntxt,</td> </tr> <tr class="vc_row_odd" id="l2117"> <td class="vc_file_line_number"><a href="#l2117">2117</a></td> <td class="vc_file_line_text"> apr_file_t **pipe_in)</td> </tr> <tr class="vc_row_odd" id="l2118"> <td class="vc_file_line_number"><a href="#l2118">2118</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2119"> <td class="vc_file_line_number"><a href="#l2119">2119</a></td> <td class="vc_file_line_text"> int rc = 1;</td> </tr> <tr class="vc_row_odd" id="l2120"> <td class="vc_file_line_number"><a href="#l2120">2120</a></td> <td class="vc_file_line_text"> const char *new_argv[4];</td> </tr> <tr class="vc_row_odd" id="l2121"> <td class="vc_file_line_number"><a href="#l2121">2121</a></td> <td class="vc_file_line_text"> request_rec *r = parm-&gt;r;</td> </tr> <tr class="vc_row_odd" id="l2122"> <td class="vc_file_line_number"><a href="#l2122">2122</a></td> <td class="vc_file_line_text"> apr_pool_t *child_context = cntxt;</td> </tr> <tr class="vc_row_odd" id="l2123"> <td class="vc_file_line_number"><a href="#l2123">2123</a></td> <td class="vc_file_line_text"> apr_procattr_t *procattr;</td> </tr> <tr class="vc_row_odd" id="l2124"> <td class="vc_file_line_number"><a href="#l2124">2124</a></td> <td class="vc_file_line_text"> apr_proc_t *procnew;</td> </tr> <tr class="vc_row_odd" id="l2125"> <td class="vc_file_line_number"><a href="#l2125">2125</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2126"> <td class="vc_file_line_number"><a href="#l2126">2126</a></td> <td class="vc_file_line_text"> /* XXX missing 1.3 logic:</td> </tr> <tr class="vc_row_odd" id="l2127"> <td class="vc_file_line_number"><a href="#l2127">2127</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2128"> <td class="vc_file_line_number"><a href="#l2128">2128</a></td> <td class="vc_file_line_text"> * what happens when !compr[parm-&gt;method].silent?</td> </tr> <tr class="vc_row_odd" id="l2129"> <td class="vc_file_line_number"><a href="#l2129">2129</a></td> <td class="vc_file_line_text"> * Should we create the err pipe, read it, and copy to the log?</td> </tr> <tr class="vc_row_odd" id="l2130"> <td class="vc_file_line_number"><a href="#l2130">2130</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2131"> <td class="vc_file_line_number"><a href="#l2131">2131</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2132"> <td class="vc_file_line_number"><a href="#l2132">2132</a></td> <td class="vc_file_line_text"> if ((apr_procattr_create(&amp;procattr, child_context) != APR_SUCCESS) ||</td> </tr> <tr class="vc_row_odd" id="l2133"> <td class="vc_file_line_number"><a href="#l2133">2133</a></td> <td class="vc_file_line_text"> (apr_procattr_io_set(procattr, APR_FULL_BLOCK,</td> </tr> <tr class="vc_row_odd" id="l2134"> <td class="vc_file_line_number"><a href="#l2134">2134</a></td> <td class="vc_file_line_text"> APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) ||</td> </tr> <tr class="vc_row_odd" id="l2135"> <td class="vc_file_line_number"><a href="#l2135">2135</a></td> <td class="vc_file_line_text"> (apr_procattr_dir_set(procattr,</td> </tr> <tr class="vc_row_odd" id="l2136"> <td class="vc_file_line_number"><a href="#l2136">2136</a></td> <td class="vc_file_line_text"> ap_make_dirstr_parent(r-&gt;pool, r-&gt;filename)) != APR_SUCCESS) ||</td> </tr> <tr class="vc_row_odd" id="l2137"> <td class="vc_file_line_number"><a href="#l2137">2137</a></td> <td class="vc_file_line_text"> (apr_procattr_cmdtype_set(procattr, APR_PROGRAM_PATH) != APR_SUCCESS)) {</td> </tr> <tr class="vc_row_odd" id="l2138"> <td class="vc_file_line_number"><a href="#l2138">2138</a></td> <td class="vc_file_line_text"> /* Something bad happened, tell the world. */</td> </tr> <tr class="vc_row_odd" id="l2139"> <td class="vc_file_line_number"><a href="#l2139">2139</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r, APLOGNO(01551)</td> </tr> <tr class="vc_row_odd" id="l2140"> <td class="vc_file_line_number"><a href="#l2140">2140</a></td> <td class="vc_file_line_text"> &quot;couldn&#39;t setup child process: %s&quot;, r-&gt;filename);</td> </tr> <tr class="vc_row_odd" id="l2141"> <td class="vc_file_line_number"><a href="#l2141">2141</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2142"> <td class="vc_file_line_number"><a href="#l2142">2142</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l2143"> <td class="vc_file_line_number"><a href="#l2143">2143</a></td> <td class="vc_file_line_text"> new_argv[0] = compr[parm-&gt;method].argv[0];</td> </tr> <tr class="vc_row_odd" id="l2144"> <td class="vc_file_line_number"><a href="#l2144">2144</a></td> <td class="vc_file_line_text"> new_argv[1] = compr[parm-&gt;method].argv[1];</td> </tr> <tr class="vc_row_odd" id="l2145"> <td class="vc_file_line_number"><a href="#l2145">2145</a></td> <td class="vc_file_line_text"> new_argv[2] = r-&gt;filename;</td> </tr> <tr class="vc_row_odd" id="l2146"> <td class="vc_file_line_number"><a href="#l2146">2146</a></td> <td class="vc_file_line_text"> new_argv[3] = NULL;</td> </tr> <tr class="vc_row_odd" id="l2147"> <td class="vc_file_line_number"><a href="#l2147">2147</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2148"> <td class="vc_file_line_number"><a href="#l2148">2148</a></td> <td class="vc_file_line_text"> procnew = apr_pcalloc(child_context, sizeof(*procnew));</td> </tr> <tr class="vc_row_odd" id="l2149"> <td class="vc_file_line_number"><a href="#l2149">2149</a></td> <td class="vc_file_line_text"> rc = apr_proc_create(procnew, compr[parm-&gt;method].argv[0],</td> </tr> <tr class="vc_row_odd" id="l2150"> <td class="vc_file_line_number"><a href="#l2150">2150</a></td> <td class="vc_file_line_text"> new_argv, NULL, procattr, child_context);</td> </tr> <tr class="vc_row_odd" id="l2151"> <td class="vc_file_line_number"><a href="#l2151">2151</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2152"> <td class="vc_file_line_number"><a href="#l2152">2152</a></td> <td class="vc_file_line_text"> if (rc != APR_SUCCESS) {</td> </tr> <tr class="vc_row_odd" id="l2153"> <td class="vc_file_line_number"><a href="#l2153">2153</a></td> <td class="vc_file_line_text"> /* Bad things happened. Everyone should have cleaned up. */</td> </tr> <tr class="vc_row_odd" id="l2154"> <td class="vc_file_line_number"><a href="#l2154">2154</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, APR_ENOPROC, r, APLOGNO(01552)</td> </tr> <tr class="vc_row_odd" id="l2155"> <td class="vc_file_line_number"><a href="#l2155">2155</a></td> <td class="vc_file_line_text"> MODNAME &quot;: could not execute `%s&#39;.&quot;,</td> </tr> <tr class="vc_row_odd" id="l2156"> <td class="vc_file_line_number"><a href="#l2156">2156</a></td> <td class="vc_file_line_text"> compr[parm-&gt;method].argv[0]);</td> </tr> <tr class="vc_row_odd" id="l2157"> <td class="vc_file_line_number"><a href="#l2157">2157</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2158"> <td class="vc_file_line_number"><a href="#l2158">2158</a></td> <td class="vc_file_line_text"> else {</td> </tr> <tr class="vc_row_odd" id="l2159"> <td class="vc_file_line_number"><a href="#l2159">2159</a></td> <td class="vc_file_line_text"> apr_pool_note_subprocess(child_context, procnew, APR_KILL_AFTER_TIMEOUT);</td> </tr> <tr class="vc_row_odd" id="l2160"> <td class="vc_file_line_number"><a href="#l2160">2160</a></td> <td class="vc_file_line_text"> *pipe_in = procnew-&gt;out;</td> </tr> <tr class="vc_row_odd" id="l2161"> <td class="vc_file_line_number"><a href="#l2161">2161</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2162"> <td class="vc_file_line_number"><a href="#l2162">2162</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2163"> <td class="vc_file_line_number"><a href="#l2163">2163</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2164"> <td class="vc_file_line_number"><a href="#l2164">2164</a></td> <td class="vc_file_line_text"> return (rc);</td> </tr> <tr class="vc_row_odd" id="l2165"> <td class="vc_file_line_number"><a href="#l2165">2165</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2166"> <td class="vc_file_line_number"><a href="#l2166">2166</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2167"> <td class="vc_file_line_number"><a href="#l2167">2167</a></td> <td class="vc_file_line_text">static int uncompress(request_rec *r, int method,</td> </tr> <tr class="vc_row_odd" id="l2168"> <td class="vc_file_line_number"><a href="#l2168">2168</a></td> <td class="vc_file_line_text"> unsigned char **newch, apr_size_t n)</td> </tr> <tr class="vc_row_odd" id="l2169"> <td class="vc_file_line_number"><a href="#l2169">2169</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2170"> <td class="vc_file_line_number"><a href="#l2170">2170</a></td> <td class="vc_file_line_text"> struct uncompress_parms parm;</td> </tr> <tr class="vc_row_odd" id="l2171"> <td class="vc_file_line_number"><a href="#l2171">2171</a></td> <td class="vc_file_line_text"> apr_file_t *pipe_out = NULL;</td> </tr> <tr class="vc_row_odd" id="l2172"> <td class="vc_file_line_number"><a href="#l2172">2172</a></td> <td class="vc_file_line_text"> apr_pool_t *sub_context;</td> </tr> <tr class="vc_row_odd" id="l2173"> <td class="vc_file_line_number"><a href="#l2173">2173</a></td> <td class="vc_file_line_text"> apr_status_t rv;</td> </tr> <tr class="vc_row_odd" id="l2174"> <td class="vc_file_line_number"><a href="#l2174">2174</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2175"> <td class="vc_file_line_number"><a href="#l2175">2175</a></td> <td class="vc_file_line_text"> parm.r = r;</td> </tr> <tr class="vc_row_odd" id="l2176"> <td class="vc_file_line_number"><a href="#l2176">2176</a></td> <td class="vc_file_line_text"> parm.method = method;</td> </tr> <tr class="vc_row_odd" id="l2177"> <td class="vc_file_line_number"><a href="#l2177">2177</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2178"> <td class="vc_file_line_number"><a href="#l2178">2178</a></td> <td class="vc_file_line_text"> /* We make a sub_pool so that we can collect our child early, otherwise</td> </tr> <tr class="vc_row_odd" id="l2179"> <td class="vc_file_line_number"><a href="#l2179">2179</a></td> <td class="vc_file_line_text"> * there are cases (i.e. generating directory indices with mod_autoindex)</td> </tr> <tr class="vc_row_odd" id="l2180"> <td class="vc_file_line_number"><a href="#l2180">2180</a></td> <td class="vc_file_line_text"> * where we would end up with LOTS of zombies.</td> </tr> <tr class="vc_row_odd" id="l2181"> <td class="vc_file_line_number"><a href="#l2181">2181</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2182"> <td class="vc_file_line_number"><a href="#l2182">2182</a></td> <td class="vc_file_line_text"> if (apr_pool_create(&amp;sub_context, r-&gt;pool) != APR_SUCCESS)</td> </tr> <tr class="vc_row_odd" id="l2183"> <td class="vc_file_line_number"><a href="#l2183">2183</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l2184"> <td class="vc_file_line_number"><a href="#l2184">2184</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2185"> <td class="vc_file_line_number"><a href="#l2185">2185</a></td> <td class="vc_file_line_text"> if ((rv = create_uncompress_child(&amp;parm, sub_context, &amp;pipe_out)) != APR_SUCCESS) {</td> </tr> <tr class="vc_row_odd" id="l2186"> <td class="vc_file_line_number"><a href="#l2186">2186</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01553)</td> </tr> <tr class="vc_row_odd" id="l2187"> <td class="vc_file_line_number"><a href="#l2187">2187</a></td> <td class="vc_file_line_text"> MODNAME &quot;: couldn&#39;t spawn uncompress process: %s&quot;, r-&gt;uri);</td> </tr> <tr class="vc_row_odd" id="l2188"> <td class="vc_file_line_number"><a href="#l2188">2188</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l2189"> <td class="vc_file_line_number"><a href="#l2189">2189</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2190"> <td class="vc_file_line_number"><a href="#l2190">2190</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2191"> <td class="vc_file_line_number"><a href="#l2191">2191</a></td> <td class="vc_file_line_text"> *newch = (unsigned char *) apr_palloc(r-&gt;pool, n);</td> </tr> <tr class="vc_row_odd" id="l2192"> <td class="vc_file_line_number"><a href="#l2192">2192</a></td> <td class="vc_file_line_text"> rv = apr_file_read(pipe_out, *newch, &amp;n);</td> </tr> <tr class="vc_row_odd" id="l2193"> <td class="vc_file_line_number"><a href="#l2193">2193</a></td> <td class="vc_file_line_text"> if (n == 0) {</td> </tr> <tr class="vc_row_odd" id="l2194"> <td class="vc_file_line_number"><a href="#l2194">2194</a></td> <td class="vc_file_line_text"> apr_pool_destroy(sub_context);</td> </tr> <tr class="vc_row_odd" id="l2195"> <td class="vc_file_line_number"><a href="#l2195">2195</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01554)</td> </tr> <tr class="vc_row_odd" id="l2196"> <td class="vc_file_line_number"><a href="#l2196">2196</a></td> <td class="vc_file_line_text"> MODNAME &quot;: read failed from uncompress of %s&quot;, r-&gt;filename);</td> </tr> <tr class="vc_row_odd" id="l2197"> <td class="vc_file_line_number"><a href="#l2197">2197</a></td> <td class="vc_file_line_text"> return -1;</td> </tr> <tr class="vc_row_odd" id="l2198"> <td class="vc_file_line_number"><a href="#l2198">2198</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2199"> <td class="vc_file_line_number"><a href="#l2199">2199</a></td> <td class="vc_file_line_text"> apr_pool_destroy(sub_context);</td> </tr> <tr class="vc_row_odd" id="l2200"> <td class="vc_file_line_number"><a href="#l2200">2200</a></td> <td class="vc_file_line_text"> return n;</td> </tr> <tr class="vc_row_odd" id="l2201"> <td class="vc_file_line_number"><a href="#l2201">2201</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2202"> <td class="vc_file_line_number"><a href="#l2202">2202</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2203"> <td class="vc_file_line_number"><a href="#l2203">2203</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2204"> <td class="vc_file_line_number"><a href="#l2204">2204</a></td> <td class="vc_file_line_text"> * is_tar() -- figure out whether file is a tar archive.</td> </tr> <tr class="vc_row_odd" id="l2205"> <td class="vc_file_line_number"><a href="#l2205">2205</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2206"> <td class="vc_file_line_number"><a href="#l2206">2206</a></td> <td class="vc_file_line_text"> * Stolen (by author of file utility) from the public domain tar program: Public</td> </tr> <tr class="vc_row_odd" id="l2207"> <td class="vc_file_line_number"><a href="#l2207">2207</a></td> <td class="vc_file_line_text"> * Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu).</td> </tr> <tr class="vc_row_odd" id="l2208"> <td class="vc_file_line_number"><a href="#l2208">2208</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2209"> <td class="vc_file_line_number"><a href="#l2209">2209</a></td> <td class="vc_file_line_text"> * @(#)list.c 1.18 9/23/86 Public Domain - gnu $Id: mod_mime_magic.c,v 1.7</td> </tr> <tr class="vc_row_odd" id="l2210"> <td class="vc_file_line_number"><a href="#l2210">2210</a></td> <td class="vc_file_line_text"> * 1997/06/24 00:41:02 ikluft Exp ikluft $</td> </tr> <tr class="vc_row_odd" id="l2211"> <td class="vc_file_line_number"><a href="#l2211">2211</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2212"> <td class="vc_file_line_number"><a href="#l2212">2212</a></td> <td class="vc_file_line_text"> * Comments changed and some code/comments reformatted for file command by Ian</td> </tr> <tr class="vc_row_odd" id="l2213"> <td class="vc_file_line_number"><a href="#l2213">2213</a></td> <td class="vc_file_line_text"> * Darwin.</td> </tr> <tr class="vc_row_odd" id="l2214"> <td class="vc_file_line_number"><a href="#l2214">2214</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2215"> <td class="vc_file_line_number"><a href="#l2215">2215</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2216"> <td class="vc_file_line_number"><a href="#l2216">2216</a></td> <td class="vc_file_line_text">#define isodigit(c) (((unsigned char)(c) &gt;= &#39;0&#39;) &amp;&amp; ((unsigned char)(c) &lt;= &#39;7&#39;))</td> </tr> <tr class="vc_row_odd" id="l2217"> <td class="vc_file_line_number"><a href="#l2217">2217</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2218"> <td class="vc_file_line_number"><a href="#l2218">2218</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2219"> <td class="vc_file_line_number"><a href="#l2219">2219</a></td> <td class="vc_file_line_text"> * Return 0 if the checksum is bad (i.e., probably not a tar archive), 1 for</td> </tr> <tr class="vc_row_odd" id="l2220"> <td class="vc_file_line_number"><a href="#l2220">2220</a></td> <td class="vc_file_line_text"> * old UNIX tar file, 2 for Unix Std (POSIX) tar file.</td> </tr> <tr class="vc_row_odd" id="l2221"> <td class="vc_file_line_number"><a href="#l2221">2221</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2222"> <td class="vc_file_line_number"><a href="#l2222">2222</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2223"> <td class="vc_file_line_number"><a href="#l2223">2223</a></td> <td class="vc_file_line_text">static int is_tar(unsigned char *buf, apr_size_t nbytes)</td> </tr> <tr class="vc_row_odd" id="l2224"> <td class="vc_file_line_number"><a href="#l2224">2224</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2225"> <td class="vc_file_line_number"><a href="#l2225">2225</a></td> <td class="vc_file_line_text"> register union record *header = (union record *) buf;</td> </tr> <tr class="vc_row_odd" id="l2226"> <td class="vc_file_line_number"><a href="#l2226">2226</a></td> <td class="vc_file_line_text"> register int i;</td> </tr> <tr class="vc_row_odd" id="l2227"> <td class="vc_file_line_number"><a href="#l2227">2227</a></td> <td class="vc_file_line_text"> register long sum, recsum;</td> </tr> <tr class="vc_row_odd" id="l2228"> <td class="vc_file_line_number"><a href="#l2228">2228</a></td> <td class="vc_file_line_text"> register char *p;</td> </tr> <tr class="vc_row_odd" id="l2229"> <td class="vc_file_line_number"><a href="#l2229">2229</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2230"> <td class="vc_file_line_number"><a href="#l2230">2230</a></td> <td class="vc_file_line_text"> if (nbytes &lt; sizeof(union record))</td> </tr> <tr class="vc_row_odd" id="l2231"> <td class="vc_file_line_number"><a href="#l2231">2231</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2232"> <td class="vc_file_line_number"><a href="#l2232">2232</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2233"> <td class="vc_file_line_number"><a href="#l2233">2233</a></td> <td class="vc_file_line_text"> recsum = from_oct(8, header-&gt;header.chksum);</td> </tr> <tr class="vc_row_odd" id="l2234"> <td class="vc_file_line_number"><a href="#l2234">2234</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2235"> <td class="vc_file_line_number"><a href="#l2235">2235</a></td> <td class="vc_file_line_text"> sum = 0;</td> </tr> <tr class="vc_row_odd" id="l2236"> <td class="vc_file_line_number"><a href="#l2236">2236</a></td> <td class="vc_file_line_text"> p = header-&gt;charptr;</td> </tr> <tr class="vc_row_odd" id="l2237"> <td class="vc_file_line_number"><a href="#l2237">2237</a></td> <td class="vc_file_line_text"> for (i = sizeof(union record); --i &gt;= 0;) {</td> </tr> <tr class="vc_row_odd" id="l2238"> <td class="vc_file_line_number"><a href="#l2238">2238</a></td> <td class="vc_file_line_text"> /*</td> </tr> <tr class="vc_row_odd" id="l2239"> <td class="vc_file_line_number"><a href="#l2239">2239</a></td> <td class="vc_file_line_text"> * We can&#39;t use unsigned char here because of old compilers, e.g. V7.</td> </tr> <tr class="vc_row_odd" id="l2240"> <td class="vc_file_line_number"><a href="#l2240">2240</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2241"> <td class="vc_file_line_number"><a href="#l2241">2241</a></td> <td class="vc_file_line_text"> sum += 0xFF &amp; *p++;</td> </tr> <tr class="vc_row_odd" id="l2242"> <td class="vc_file_line_number"><a href="#l2242">2242</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2243"> <td class="vc_file_line_number"><a href="#l2243">2243</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2244"> <td class="vc_file_line_number"><a href="#l2244">2244</a></td> <td class="vc_file_line_text"> /* Adjust checksum to count the &quot;chksum&quot; field as blanks. */</td> </tr> <tr class="vc_row_odd" id="l2245"> <td class="vc_file_line_number"><a href="#l2245">2245</a></td> <td class="vc_file_line_text"> for (i = sizeof(header-&gt;header.chksum); --i &gt;= 0;)</td> </tr> <tr class="vc_row_odd" id="l2246"> <td class="vc_file_line_number"><a href="#l2246">2246</a></td> <td class="vc_file_line_text"> sum -= 0xFF &amp; header-&gt;header.chksum[i];</td> </tr> <tr class="vc_row_odd" id="l2247"> <td class="vc_file_line_number"><a href="#l2247">2247</a></td> <td class="vc_file_line_text"> sum += &#39; &#39; * sizeof header-&gt;header.chksum;</td> </tr> <tr class="vc_row_odd" id="l2248"> <td class="vc_file_line_number"><a href="#l2248">2248</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2249"> <td class="vc_file_line_number"><a href="#l2249">2249</a></td> <td class="vc_file_line_text"> if (sum != recsum)</td> </tr> <tr class="vc_row_odd" id="l2250"> <td class="vc_file_line_number"><a href="#l2250">2250</a></td> <td class="vc_file_line_text"> return 0; /* Not a tar archive */</td> </tr> <tr class="vc_row_odd" id="l2251"> <td class="vc_file_line_number"><a href="#l2251">2251</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2252"> <td class="vc_file_line_number"><a href="#l2252">2252</a></td> <td class="vc_file_line_text"> if (0 == strcmp(header-&gt;header.magic, TMAGIC))</td> </tr> <tr class="vc_row_odd" id="l2253"> <td class="vc_file_line_number"><a href="#l2253">2253</a></td> <td class="vc_file_line_text"> return 2; /* Unix Standard tar archive */</td> </tr> <tr class="vc_row_odd" id="l2254"> <td class="vc_file_line_number"><a href="#l2254">2254</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2255"> <td class="vc_file_line_number"><a href="#l2255">2255</a></td> <td class="vc_file_line_text"> return 1; /* Old fashioned tar archive */</td> </tr> <tr class="vc_row_odd" id="l2256"> <td class="vc_file_line_number"><a href="#l2256">2256</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2257"> <td class="vc_file_line_number"><a href="#l2257">2257</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2258"> <td class="vc_file_line_number"><a href="#l2258">2258</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2259"> <td class="vc_file_line_number"><a href="#l2259">2259</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2260"> <td class="vc_file_line_number"><a href="#l2260">2260</a></td> <td class="vc_file_line_text"> * Quick and dirty octal conversion.</td> </tr> <tr class="vc_row_odd" id="l2261"> <td class="vc_file_line_number"><a href="#l2261">2261</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2262"> <td class="vc_file_line_number"><a href="#l2262">2262</a></td> <td class="vc_file_line_text"> * Result is -1 if the field is invalid (all blank, or nonoctal).</td> </tr> <tr class="vc_row_odd" id="l2263"> <td class="vc_file_line_number"><a href="#l2263">2263</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2264"> <td class="vc_file_line_number"><a href="#l2264">2264</a></td> <td class="vc_file_line_text">static long from_oct(int digs, char *where)</td> </tr> <tr class="vc_row_odd" id="l2265"> <td class="vc_file_line_number"><a href="#l2265">2265</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2266"> <td class="vc_file_line_number"><a href="#l2266">2266</a></td> <td class="vc_file_line_text"> register long value;</td> </tr> <tr class="vc_row_odd" id="l2267"> <td class="vc_file_line_number"><a href="#l2267">2267</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2268"> <td class="vc_file_line_number"><a href="#l2268">2268</a></td> <td class="vc_file_line_text"> while (apr_isspace(*where)) { /* Skip spaces */</td> </tr> <tr class="vc_row_odd" id="l2269"> <td class="vc_file_line_number"><a href="#l2269">2269</a></td> <td class="vc_file_line_text"> where++;</td> </tr> <tr class="vc_row_odd" id="l2270"> <td class="vc_file_line_number"><a href="#l2270">2270</a></td> <td class="vc_file_line_text"> if (--digs &lt;= 0)</td> </tr> <tr class="vc_row_odd" id="l2271"> <td class="vc_file_line_number"><a href="#l2271">2271</a></td> <td class="vc_file_line_text"> return -1; /* All blank field */</td> </tr> <tr class="vc_row_odd" id="l2272"> <td class="vc_file_line_number"><a href="#l2272">2272</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2273"> <td class="vc_file_line_number"><a href="#l2273">2273</a></td> <td class="vc_file_line_text"> value = 0;</td> </tr> <tr class="vc_row_odd" id="l2274"> <td class="vc_file_line_number"><a href="#l2274">2274</a></td> <td class="vc_file_line_text"> while (digs &gt; 0 &amp;&amp; isodigit(*where)) { /* Scan til nonoctal */</td> </tr> <tr class="vc_row_odd" id="l2275"> <td class="vc_file_line_number"><a href="#l2275">2275</a></td> <td class="vc_file_line_text"> value = (value &lt;&lt; 3) | (*where++ - &#39;0&#39;);</td> </tr> <tr class="vc_row_odd" id="l2276"> <td class="vc_file_line_number"><a href="#l2276">2276</a></td> <td class="vc_file_line_text"> --digs;</td> </tr> <tr class="vc_row_odd" id="l2277"> <td class="vc_file_line_number"><a href="#l2277">2277</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2278"> <td class="vc_file_line_number"><a href="#l2278">2278</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2279"> <td class="vc_file_line_number"><a href="#l2279">2279</a></td> <td class="vc_file_line_text"> if (digs &gt; 0 &amp;&amp; *where &amp;&amp; !apr_isspace(*where))</td> </tr> <tr class="vc_row_odd" id="l2280"> <td class="vc_file_line_number"><a href="#l2280">2280</a></td> <td class="vc_file_line_text"> return -1; /* Ended on non-space/nul */</td> </tr> <tr class="vc_row_odd" id="l2281"> <td class="vc_file_line_number"><a href="#l2281">2281</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2282"> <td class="vc_file_line_number"><a href="#l2282">2282</a></td> <td class="vc_file_line_text"> return value;</td> </tr> <tr class="vc_row_odd" id="l2283"> <td class="vc_file_line_number"><a href="#l2283">2283</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2284"> <td class="vc_file_line_number"><a href="#l2284">2284</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2285"> <td class="vc_file_line_number"><a href="#l2285">2285</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2286"> <td class="vc_file_line_number"><a href="#l2286">2286</a></td> <td class="vc_file_line_text"> * Check for file-revision suffix</td> </tr> <tr class="vc_row_odd" id="l2287"> <td class="vc_file_line_number"><a href="#l2287">2287</a></td> <td class="vc_file_line_text"> *</td> </tr> <tr class="vc_row_odd" id="l2288"> <td class="vc_file_line_number"><a href="#l2288">2288</a></td> <td class="vc_file_line_text"> * This is for an obscure document control system used on an intranet.</td> </tr> <tr class="vc_row_odd" id="l2289"> <td class="vc_file_line_number"><a href="#l2289">2289</a></td> <td class="vc_file_line_text"> * The web representation of each file&#39;s revision has an @1, @2, etc</td> </tr> <tr class="vc_row_odd" id="l2290"> <td class="vc_file_line_number"><a href="#l2290">2290</a></td> <td class="vc_file_line_text"> * appended with the revision number. This needs to be stripped off to</td> </tr> <tr class="vc_row_odd" id="l2291"> <td class="vc_file_line_number"><a href="#l2291">2291</a></td> <td class="vc_file_line_text"> * find the file suffix, which can be recognized by sending the name back</td> </tr> <tr class="vc_row_odd" id="l2292"> <td class="vc_file_line_number"><a href="#l2292">2292</a></td> <td class="vc_file_line_text"> * through a sub-request. The base file name (without the @num suffix)</td> </tr> <tr class="vc_row_odd" id="l2293"> <td class="vc_file_line_number"><a href="#l2293">2293</a></td> <td class="vc_file_line_text"> * must exist because its type will be used as the result.</td> </tr> <tr class="vc_row_odd" id="l2294"> <td class="vc_file_line_number"><a href="#l2294">2294</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2295"> <td class="vc_file_line_number"><a href="#l2295">2295</a></td> <td class="vc_file_line_text">static int revision_suffix(request_rec *r)</td> </tr> <tr class="vc_row_odd" id="l2296"> <td class="vc_file_line_number"><a href="#l2296">2296</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2297"> <td class="vc_file_line_number"><a href="#l2297">2297</a></td> <td class="vc_file_line_text"> int suffix_pos, result;</td> </tr> <tr class="vc_row_odd" id="l2298"> <td class="vc_file_line_number"><a href="#l2298">2298</a></td> <td class="vc_file_line_text"> char *sub_filename;</td> </tr> <tr class="vc_row_odd" id="l2299"> <td class="vc_file_line_number"><a href="#l2299">2299</a></td> <td class="vc_file_line_text"> request_rec *sub;</td> </tr> <tr class="vc_row_odd" id="l2300"> <td class="vc_file_line_number"><a href="#l2300">2300</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2301"> <td class="vc_file_line_number"><a href="#l2301">2301</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l2302"> <td class="vc_file_line_number"><a href="#l2302">2302</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01555)</td> </tr> <tr class="vc_row_odd" id="l2303"> <td class="vc_file_line_number"><a href="#l2303">2303</a></td> <td class="vc_file_line_text"> MODNAME &quot;: revision_suffix checking %s&quot;, r-&gt;filename);</td> </tr> <tr class="vc_row_odd" id="l2304"> <td class="vc_file_line_number"><a href="#l2304">2304</a></td> <td class="vc_file_line_text">#endif /* MIME_MAGIC_DEBUG */</td> </tr> <tr class="vc_row_odd" id="l2305"> <td class="vc_file_line_number"><a href="#l2305">2305</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2306"> <td class="vc_file_line_number"><a href="#l2306">2306</a></td> <td class="vc_file_line_text"> /* check for recognized revision suffix */</td> </tr> <tr class="vc_row_odd" id="l2307"> <td class="vc_file_line_number"><a href="#l2307">2307</a></td> <td class="vc_file_line_text"> suffix_pos = strlen(r-&gt;filename) - 1;</td> </tr> <tr class="vc_row_odd" id="l2308"> <td class="vc_file_line_number"><a href="#l2308">2308</a></td> <td class="vc_file_line_text"> if (!apr_isdigit(r-&gt;filename[suffix_pos])) {</td> </tr> <tr class="vc_row_odd" id="l2309"> <td class="vc_file_line_number"><a href="#l2309">2309</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2310"> <td class="vc_file_line_number"><a href="#l2310">2310</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2311"> <td class="vc_file_line_number"><a href="#l2311">2311</a></td> <td class="vc_file_line_text"> while (suffix_pos &gt;= 0 &amp;&amp; apr_isdigit(r-&gt;filename[suffix_pos]))</td> </tr> <tr class="vc_row_odd" id="l2312"> <td class="vc_file_line_number"><a href="#l2312">2312</a></td> <td class="vc_file_line_text"> suffix_pos--;</td> </tr> <tr class="vc_row_odd" id="l2313"> <td class="vc_file_line_number"><a href="#l2313">2313</a></td> <td class="vc_file_line_text"> if (suffix_pos &lt; 0 || r-&gt;filename[suffix_pos] != &#39;@&#39;) {</td> </tr> <tr class="vc_row_odd" id="l2314"> <td class="vc_file_line_number"><a href="#l2314">2314</a></td> <td class="vc_file_line_text"> return 0;</td> </tr> <tr class="vc_row_odd" id="l2315"> <td class="vc_file_line_number"><a href="#l2315">2315</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2316"> <td class="vc_file_line_number"><a href="#l2316">2316</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2317"> <td class="vc_file_line_number"><a href="#l2317">2317</a></td> <td class="vc_file_line_text"> /* perform sub-request for the file name without the suffix */</td> </tr> <tr class="vc_row_odd" id="l2318"> <td class="vc_file_line_number"><a href="#l2318">2318</a></td> <td class="vc_file_line_text"> result = 0;</td> </tr> <tr class="vc_row_odd" id="l2319"> <td class="vc_file_line_number"><a href="#l2319">2319</a></td> <td class="vc_file_line_text"> sub_filename = apr_pstrndup(r-&gt;pool, r-&gt;filename, suffix_pos);</td> </tr> <tr class="vc_row_odd" id="l2320"> <td class="vc_file_line_number"><a href="#l2320">2320</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l2321"> <td class="vc_file_line_number"><a href="#l2321">2321</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01556)</td> </tr> <tr class="vc_row_odd" id="l2322"> <td class="vc_file_line_number"><a href="#l2322">2322</a></td> <td class="vc_file_line_text"> MODNAME &quot;: subrequest lookup for %s&quot;, sub_filename);</td> </tr> <tr class="vc_row_odd" id="l2323"> <td class="vc_file_line_number"><a href="#l2323">2323</a></td> <td class="vc_file_line_text">#endif /* MIME_MAGIC_DEBUG */</td> </tr> <tr class="vc_row_odd" id="l2324"> <td class="vc_file_line_number"><a href="#l2324">2324</a></td> <td class="vc_file_line_text"> sub = ap_sub_req_lookup_file(sub_filename, r, NULL);</td> </tr> <tr class="vc_row_odd" id="l2325"> <td class="vc_file_line_number"><a href="#l2325">2325</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2326"> <td class="vc_file_line_number"><a href="#l2326">2326</a></td> <td class="vc_file_line_text"> /* extract content type/encoding/language from sub-request */</td> </tr> <tr class="vc_row_odd" id="l2327"> <td class="vc_file_line_number"><a href="#l2327">2327</a></td> <td class="vc_file_line_text"> if (sub-&gt;content_type) {</td> </tr> <tr class="vc_row_odd" id="l2328"> <td class="vc_file_line_number"><a href="#l2328">2328</a></td> <td class="vc_file_line_text"> ap_set_content_type(r, apr_pstrdup(r-&gt;pool, sub-&gt;content_type));</td> </tr> <tr class="vc_row_odd" id="l2329"> <td class="vc_file_line_number"><a href="#l2329">2329</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l2330"> <td class="vc_file_line_number"><a href="#l2330">2330</a></td> <td class="vc_file_line_text"> ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01557)</td> </tr> <tr class="vc_row_odd" id="l2331"> <td class="vc_file_line_number"><a href="#l2331">2331</a></td> <td class="vc_file_line_text"> MODNAME &quot;: subrequest %s got %s&quot;,</td> </tr> <tr class="vc_row_odd" id="l2332"> <td class="vc_file_line_number"><a href="#l2332">2332</a></td> <td class="vc_file_line_text"> sub_filename, r-&gt;content_type);</td> </tr> <tr class="vc_row_odd" id="l2333"> <td class="vc_file_line_number"><a href="#l2333">2333</a></td> <td class="vc_file_line_text">#endif /* MIME_MAGIC_DEBUG */</td> </tr> <tr class="vc_row_odd" id="l2334"> <td class="vc_file_line_number"><a href="#l2334">2334</a></td> <td class="vc_file_line_text"> if (sub-&gt;content_encoding)</td> </tr> <tr class="vc_row_odd" id="l2335"> <td class="vc_file_line_number"><a href="#l2335">2335</a></td> <td class="vc_file_line_text"> r-&gt;content_encoding =</td> </tr> <tr class="vc_row_odd" id="l2336"> <td class="vc_file_line_number"><a href="#l2336">2336</a></td> <td class="vc_file_line_text"> apr_pstrdup(r-&gt;pool, sub-&gt;content_encoding);</td> </tr> <tr class="vc_row_odd" id="l2337"> <td class="vc_file_line_number"><a href="#l2337">2337</a></td> <td class="vc_file_line_text"> if (sub-&gt;content_languages) {</td> </tr> <tr class="vc_row_odd" id="l2338"> <td class="vc_file_line_number"><a href="#l2338">2338</a></td> <td class="vc_file_line_text"> int n;</td> </tr> <tr class="vc_row_odd" id="l2339"> <td class="vc_file_line_number"><a href="#l2339">2339</a></td> <td class="vc_file_line_text"> r-&gt;content_languages = apr_array_copy(r-&gt;pool,</td> </tr> <tr class="vc_row_odd" id="l2340"> <td class="vc_file_line_number"><a href="#l2340">2340</a></td> <td class="vc_file_line_text"> sub-&gt;content_languages);</td> </tr> <tr class="vc_row_odd" id="l2341"> <td class="vc_file_line_number"><a href="#l2341">2341</a></td> <td class="vc_file_line_text"> for (n = 0; n &lt; r-&gt;content_languages-&gt;nelts; ++n) {</td> </tr> <tr class="vc_row_odd" id="l2342"> <td class="vc_file_line_number"><a href="#l2342">2342</a></td> <td class="vc_file_line_text"> char **lang = ((char **)r-&gt;content_languages-&gt;elts) + n;</td> </tr> <tr class="vc_row_odd" id="l2343"> <td class="vc_file_line_number"><a href="#l2343">2343</a></td> <td class="vc_file_line_text"> *lang = apr_pstrdup(r-&gt;pool, *lang);</td> </tr> <tr class="vc_row_odd" id="l2344"> <td class="vc_file_line_number"><a href="#l2344">2344</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2345"> <td class="vc_file_line_number"><a href="#l2345">2345</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2346"> <td class="vc_file_line_number"><a href="#l2346">2346</a></td> <td class="vc_file_line_text"> result = 1;</td> </tr> <tr class="vc_row_odd" id="l2347"> <td class="vc_file_line_number"><a href="#l2347">2347</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2348"> <td class="vc_file_line_number"><a href="#l2348">2348</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2349"> <td class="vc_file_line_number"><a href="#l2349">2349</a></td> <td class="vc_file_line_text"> /* clean up */</td> </tr> <tr class="vc_row_odd" id="l2350"> <td class="vc_file_line_number"><a href="#l2350">2350</a></td> <td class="vc_file_line_text"> ap_destroy_sub_req(sub);</td> </tr> <tr class="vc_row_odd" id="l2351"> <td class="vc_file_line_number"><a href="#l2351">2351</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2352"> <td class="vc_file_line_number"><a href="#l2352">2352</a></td> <td class="vc_file_line_text"> return result;</td> </tr> <tr class="vc_row_odd" id="l2353"> <td class="vc_file_line_number"><a href="#l2353">2353</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2354"> <td class="vc_file_line_number"><a href="#l2354">2354</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2355"> <td class="vc_file_line_number"><a href="#l2355">2355</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2356"> <td class="vc_file_line_number"><a href="#l2356">2356</a></td> <td class="vc_file_line_text"> * initialize the module</td> </tr> <tr class="vc_row_odd" id="l2357"> <td class="vc_file_line_number"><a href="#l2357">2357</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2358"> <td class="vc_file_line_number"><a href="#l2358">2358</a></td> <td class="vc_file_line_text">static int magic_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *main_server)</td> </tr> <tr class="vc_row_odd" id="l2359"> <td class="vc_file_line_number"><a href="#l2359">2359</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2360"> <td class="vc_file_line_number"><a href="#l2360">2360</a></td> <td class="vc_file_line_text"> int result;</td> </tr> <tr class="vc_row_odd" id="l2361"> <td class="vc_file_line_number"><a href="#l2361">2361</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf;</td> </tr> <tr class="vc_row_odd" id="l2362"> <td class="vc_file_line_number"><a href="#l2362">2362</a></td> <td class="vc_file_line_text"> magic_server_config_rec *main_conf;</td> </tr> <tr class="vc_row_odd" id="l2363"> <td class="vc_file_line_number"><a href="#l2363">2363</a></td> <td class="vc_file_line_text"> server_rec *s;</td> </tr> <tr class="vc_row_odd" id="l2364"> <td class="vc_file_line_number"><a href="#l2364">2364</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l2365"> <td class="vc_file_line_number"><a href="#l2365">2365</a></td> <td class="vc_file_line_text"> struct magic *m, *prevm;</td> </tr> <tr class="vc_row_odd" id="l2366"> <td class="vc_file_line_number"><a href="#l2366">2366</a></td> <td class="vc_file_line_text">#endif /* MIME_MAGIC_DEBUG */</td> </tr> <tr class="vc_row_odd" id="l2367"> <td class="vc_file_line_number"><a href="#l2367">2367</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2368"> <td class="vc_file_line_number"><a href="#l2368">2368</a></td> <td class="vc_file_line_text"> main_conf = ap_get_module_config(main_server-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l2369"> <td class="vc_file_line_number"><a href="#l2369">2369</a></td> <td class="vc_file_line_text"> for (s = main_server; s; s = s-&gt;next) {</td> </tr> <tr class="vc_row_odd" id="l2370"> <td class="vc_file_line_number"><a href="#l2370">2370</a></td> <td class="vc_file_line_text"> conf = ap_get_module_config(s-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l2371"> <td class="vc_file_line_number"><a href="#l2371">2371</a></td> <td class="vc_file_line_text"> if (conf-&gt;magicfile == NULL &amp;&amp; s != main_server) {</td> </tr> <tr class="vc_row_odd" id="l2372"> <td class="vc_file_line_number"><a href="#l2372">2372</a></td> <td class="vc_file_line_text"> /* inherits from the parent */</td> </tr> <tr class="vc_row_odd" id="l2373"> <td class="vc_file_line_number"><a href="#l2373">2373</a></td> <td class="vc_file_line_text"> *conf = *main_conf;</td> </tr> <tr class="vc_row_odd" id="l2374"> <td class="vc_file_line_number"><a href="#l2374">2374</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2375"> <td class="vc_file_line_number"><a href="#l2375">2375</a></td> <td class="vc_file_line_text"> else if (conf-&gt;magicfile) {</td> </tr> <tr class="vc_row_odd" id="l2376"> <td class="vc_file_line_number"><a href="#l2376">2376</a></td> <td class="vc_file_line_text"> result = apprentice(s, p);</td> </tr> <tr class="vc_row_odd" id="l2377"> <td class="vc_file_line_number"><a href="#l2377">2377</a></td> <td class="vc_file_line_text"> if (result == -1)</td> </tr> <tr class="vc_row_odd" id="l2378"> <td class="vc_file_line_number"><a href="#l2378">2378</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l2379"> <td class="vc_file_line_number"><a href="#l2379">2379</a></td> <td class="vc_file_line_text">#if MIME_MAGIC_DEBUG</td> </tr> <tr class="vc_row_odd" id="l2380"> <td class="vc_file_line_number"><a href="#l2380">2380</a></td> <td class="vc_file_line_text"> prevm = 0;</td> </tr> <tr class="vc_row_odd" id="l2381"> <td class="vc_file_line_number"><a href="#l2381">2381</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01558)</td> </tr> <tr class="vc_row_odd" id="l2382"> <td class="vc_file_line_number"><a href="#l2382">2382</a></td> <td class="vc_file_line_text"> MODNAME &quot;: magic_init 1 test&quot;);</td> </tr> <tr class="vc_row_odd" id="l2383"> <td class="vc_file_line_number"><a href="#l2383">2383</a></td> <td class="vc_file_line_text"> for (m = conf-&gt;magic; m; m = m-&gt;next) {</td> </tr> <tr class="vc_row_odd" id="l2384"> <td class="vc_file_line_number"><a href="#l2384">2384</a></td> <td class="vc_file_line_text"> if (apr_isprint((((unsigned long) m) &gt;&gt; 24) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l2385"> <td class="vc_file_line_number"><a href="#l2385">2385</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 16) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l2386"> <td class="vc_file_line_number"><a href="#l2386">2386</a></td> <td class="vc_file_line_text"> apr_isprint((((unsigned long) m) &gt;&gt; 8) &amp; 255) &amp;&amp;</td> </tr> <tr class="vc_row_odd" id="l2387"> <td class="vc_file_line_number"><a href="#l2387">2387</a></td> <td class="vc_file_line_text"> apr_isprint(((unsigned long) m) &amp; 255)) {</td> </tr> <tr class="vc_row_odd" id="l2388"> <td class="vc_file_line_number"><a href="#l2388">2388</a></td> <td class="vc_file_line_text"> ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01559)</td> </tr> <tr class="vc_row_odd" id="l2389"> <td class="vc_file_line_number"><a href="#l2389">2389</a></td> <td class="vc_file_line_text"> MODNAME &quot;: magic_init 1: POINTER CLOBBERED! &quot;</td> </tr> <tr class="vc_row_odd" id="l2390"> <td class="vc_file_line_number"><a href="#l2390">2390</a></td> <td class="vc_file_line_text"> &quot;m=\&quot;%c%c%c%c\&quot; line=%d&quot;,</td> </tr> <tr class="vc_row_odd" id="l2391"> <td class="vc_file_line_number"><a href="#l2391">2391</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 24) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l2392"> <td class="vc_file_line_number"><a href="#l2392">2392</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 16) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l2393"> <td class="vc_file_line_number"><a href="#l2393">2393</a></td> <td class="vc_file_line_text"> (char)((((unsigned long) m) &gt;&gt; 8 ) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l2394"> <td class="vc_file_line_number"><a href="#l2394">2394</a></td> <td class="vc_file_line_text"> (char)(( (unsigned long) m ) &amp; 255),</td> </tr> <tr class="vc_row_odd" id="l2395"> <td class="vc_file_line_number"><a href="#l2395">2395</a></td> <td class="vc_file_line_text"> prevm ? prevm-&gt;lineno : -1);</td> </tr> <tr class="vc_row_odd" id="l2396"> <td class="vc_file_line_number"><a href="#l2396">2396</a></td> <td class="vc_file_line_text"> break;</td> </tr> <tr class="vc_row_odd" id="l2397"> <td class="vc_file_line_number"><a href="#l2397">2397</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2398"> <td class="vc_file_line_number"><a href="#l2398">2398</a></td> <td class="vc_file_line_text"> prevm = m;</td> </tr> <tr class="vc_row_odd" id="l2399"> <td class="vc_file_line_number"><a href="#l2399">2399</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2400"> <td class="vc_file_line_number"><a href="#l2400">2400</a></td> <td class="vc_file_line_text">#endif</td> </tr> <tr class="vc_row_odd" id="l2401"> <td class="vc_file_line_number"><a href="#l2401">2401</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2402"> <td class="vc_file_line_number"><a href="#l2402">2402</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2403"> <td class="vc_file_line_number"><a href="#l2403">2403</a></td> <td class="vc_file_line_text"> return OK;</td> </tr> <tr class="vc_row_odd" id="l2404"> <td class="vc_file_line_number"><a href="#l2404">2404</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2405"> <td class="vc_file_line_number"><a href="#l2405">2405</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2406"> <td class="vc_file_line_number"><a href="#l2406">2406</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2407"> <td class="vc_file_line_number"><a href="#l2407">2407</a></td> <td class="vc_file_line_text"> * Find the Content-Type from any resource this module has available</td> </tr> <tr class="vc_row_odd" id="l2408"> <td class="vc_file_line_number"><a href="#l2408">2408</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2409"> <td class="vc_file_line_number"><a href="#l2409">2409</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2410"> <td class="vc_file_line_number"><a href="#l2410">2410</a></td> <td class="vc_file_line_text">static int magic_find_ct(request_rec *r)</td> </tr> <tr class="vc_row_odd" id="l2411"> <td class="vc_file_line_number"><a href="#l2411">2411</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2412"> <td class="vc_file_line_number"><a href="#l2412">2412</a></td> <td class="vc_file_line_text"> int result;</td> </tr> <tr class="vc_row_odd" id="l2413"> <td class="vc_file_line_number"><a href="#l2413">2413</a></td> <td class="vc_file_line_text"> magic_server_config_rec *conf;</td> </tr> <tr class="vc_row_odd" id="l2414"> <td class="vc_file_line_number"><a href="#l2414">2414</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2415"> <td class="vc_file_line_number"><a href="#l2415">2415</a></td> <td class="vc_file_line_text"> /* the file has to exist */</td> </tr> <tr class="vc_row_odd" id="l2416"> <td class="vc_file_line_number"><a href="#l2416">2416</a></td> <td class="vc_file_line_text"> if (r-&gt;finfo.filetype == APR_NOFILE || !r-&gt;filename) {</td> </tr> <tr class="vc_row_odd" id="l2417"> <td class="vc_file_line_number"><a href="#l2417">2417</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l2418"> <td class="vc_file_line_number"><a href="#l2418">2418</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2419"> <td class="vc_file_line_number"><a href="#l2419">2419</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2420"> <td class="vc_file_line_number"><a href="#l2420">2420</a></td> <td class="vc_file_line_text"> /* was someone else already here? */</td> </tr> <tr class="vc_row_odd" id="l2421"> <td class="vc_file_line_number"><a href="#l2421">2421</a></td> <td class="vc_file_line_text"> if (r-&gt;content_type) {</td> </tr> <tr class="vc_row_odd" id="l2422"> <td class="vc_file_line_number"><a href="#l2422">2422</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l2423"> <td class="vc_file_line_number"><a href="#l2423">2423</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2424"> <td class="vc_file_line_number"><a href="#l2424">2424</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2425"> <td class="vc_file_line_number"><a href="#l2425">2425</a></td> <td class="vc_file_line_text"> conf = ap_get_module_config(r-&gt;server-&gt;module_config, &amp;mime_magic_module);</td> </tr> <tr class="vc_row_odd" id="l2426"> <td class="vc_file_line_number"><a href="#l2426">2426</a></td> <td class="vc_file_line_text"> if (!conf || !conf-&gt;magic) {</td> </tr> <tr class="vc_row_odd" id="l2427"> <td class="vc_file_line_number"><a href="#l2427">2427</a></td> <td class="vc_file_line_text"> return DECLINED;</td> </tr> <tr class="vc_row_odd" id="l2428"> <td class="vc_file_line_number"><a href="#l2428">2428</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2429"> <td class="vc_file_line_number"><a href="#l2429">2429</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2430"> <td class="vc_file_line_number"><a href="#l2430">2430</a></td> <td class="vc_file_line_text"> /* initialize per-request info */</td> </tr> <tr class="vc_row_odd" id="l2431"> <td class="vc_file_line_number"><a href="#l2431">2431</a></td> <td class="vc_file_line_text"> if (!magic_set_config(r)) {</td> </tr> <tr class="vc_row_odd" id="l2432"> <td class="vc_file_line_number"><a href="#l2432">2432</a></td> <td class="vc_file_line_text"> return HTTP_INTERNAL_SERVER_ERROR;</td> </tr> <tr class="vc_row_odd" id="l2433"> <td class="vc_file_line_number"><a href="#l2433">2433</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2434"> <td class="vc_file_line_number"><a href="#l2434">2434</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2435"> <td class="vc_file_line_number"><a href="#l2435">2435</a></td> <td class="vc_file_line_text"> /* try excluding file-revision suffixes */</td> </tr> <tr class="vc_row_odd" id="l2436"> <td class="vc_file_line_number"><a href="#l2436">2436</a></td> <td class="vc_file_line_text"> if (revision_suffix(r) != 1) {</td> </tr> <tr class="vc_row_odd" id="l2437"> <td class="vc_file_line_number"><a href="#l2437">2437</a></td> <td class="vc_file_line_text"> /* process it based on the file contents */</td> </tr> <tr class="vc_row_odd" id="l2438"> <td class="vc_file_line_number"><a href="#l2438">2438</a></td> <td class="vc_file_line_text"> if ((result = magic_process(r)) != OK) {</td> </tr> <tr class="vc_row_odd" id="l2439"> <td class="vc_file_line_number"><a href="#l2439">2439</a></td> <td class="vc_file_line_text"> return result;</td> </tr> <tr class="vc_row_odd" id="l2440"> <td class="vc_file_line_number"><a href="#l2440">2440</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2441"> <td class="vc_file_line_number"><a href="#l2441">2441</a></td> <td class="vc_file_line_text"> }</td> </tr> <tr class="vc_row_odd" id="l2442"> <td class="vc_file_line_number"><a href="#l2442">2442</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2443"> <td class="vc_file_line_number"><a href="#l2443">2443</a></td> <td class="vc_file_line_text"> /* if we have any results, put them in the request structure */</td> </tr> <tr class="vc_row_odd" id="l2444"> <td class="vc_file_line_number"><a href="#l2444">2444</a></td> <td class="vc_file_line_text"> return magic_rsl_to_request(r);</td> </tr> <tr class="vc_row_odd" id="l2445"> <td class="vc_file_line_number"><a href="#l2445">2445</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2446"> <td class="vc_file_line_number"><a href="#l2446">2446</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2447"> <td class="vc_file_line_number"><a href="#l2447">2447</a></td> <td class="vc_file_line_text">static void register_hooks(apr_pool_t *p)</td> </tr> <tr class="vc_row_odd" id="l2448"> <td class="vc_file_line_number"><a href="#l2448">2448</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2449"> <td class="vc_file_line_number"><a href="#l2449">2449</a></td> <td class="vc_file_line_text"> static const char * const aszPre[]={ &quot;mod_mime.c&quot;, NULL };</td> </tr> <tr class="vc_row_odd" id="l2450"> <td class="vc_file_line_number"><a href="#l2450">2450</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2451"> <td class="vc_file_line_number"><a href="#l2451">2451</a></td> <td class="vc_file_line_text"> /* mod_mime_magic should be run after mod_mime, if at all. */</td> </tr> <tr class="vc_row_odd" id="l2452"> <td class="vc_file_line_number"><a href="#l2452">2452</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2453"> <td class="vc_file_line_number"><a href="#l2453">2453</a></td> <td class="vc_file_line_text"> ap_hook_type_checker(magic_find_ct, aszPre, NULL, APR_HOOK_MIDDLE);</td> </tr> <tr class="vc_row_odd" id="l2454"> <td class="vc_file_line_number"><a href="#l2454">2454</a></td> <td class="vc_file_line_text"> ap_hook_post_config(magic_init, NULL, NULL, APR_HOOK_FIRST);</td> </tr> <tr class="vc_row_odd" id="l2455"> <td class="vc_file_line_number"><a href="#l2455">2455</a></td> <td class="vc_file_line_text">}</td> </tr> <tr class="vc_row_odd" id="l2456"> <td class="vc_file_line_number"><a href="#l2456">2456</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2457"> <td class="vc_file_line_number"><a href="#l2457">2457</a></td> <td class="vc_file_line_text">/*</td> </tr> <tr class="vc_row_odd" id="l2458"> <td class="vc_file_line_number"><a href="#l2458">2458</a></td> <td class="vc_file_line_text"> * Apache API module interface</td> </tr> <tr class="vc_row_odd" id="l2459"> <td class="vc_file_line_number"><a href="#l2459">2459</a></td> <td class="vc_file_line_text"> */</td> </tr> <tr class="vc_row_odd" id="l2460"> <td class="vc_file_line_number"><a href="#l2460">2460</a></td> <td class="vc_file_line_text"></td> </tr> <tr class="vc_row_odd" id="l2461"> <td class="vc_file_line_number"><a href="#l2461">2461</a></td> <td class="vc_file_line_text">AP_DECLARE_MODULE(mime_magic) =</td> </tr> <tr class="vc_row_odd" id="l2462"> <td class="vc_file_line_number"><a href="#l2462">2462</a></td> <td class="vc_file_line_text">{</td> </tr> <tr class="vc_row_odd" id="l2463"> <td class="vc_file_line_number"><a href="#l2463">2463</a></td> <td class="vc_file_line_text"> STANDARD20_MODULE_STUFF,</td> </tr> <tr class="vc_row_odd" id="l2464"> <td class="vc_file_line_number"><a href="#l2464">2464</a></td> <td class="vc_file_line_text"> NULL, /* dir config creator */</td> </tr> <tr class="vc_row_odd" id="l2465"> <td class="vc_file_line_number"><a href="#l2465">2465</a></td> <td class="vc_file_line_text"> NULL, /* dir merger --- default is to override */</td> </tr> <tr class="vc_row_odd" id="l2466"> <td class="vc_file_line_number"><a href="#l2466">2466</a></td> <td class="vc_file_line_text"> create_magic_server_config, /* server config */</td> </tr> <tr class="vc_row_odd" id="l2467"> <td class="vc_file_line_number"><a href="#l2467">2467</a></td> <td class="vc_file_line_text"> merge_magic_server_config, /* merge server config */</td> </tr> <tr class="vc_row_odd" id="l2468"> <td class="vc_file_line_number"><a href="#l2468">2468</a></td> <td class="vc_file_line_text"> mime_magic_cmds, /* command apr_table_t */</td> </tr> <tr class="vc_row_odd" id="l2469"> <td class="vc_file_line_number"><a href="#l2469">2469</a></td> <td class="vc_file_line_text"> register_hooks /* register hooks */</td> </tr> <tr class="vc_row_odd" id="l2470"> <td class="vc_file_line_number"><a href="#l2470">2470</a></td> <td class="vc_file_line_text">};</td> </tr> </table> </div> <hr/> <div class="vc_properties"> <h2>Properties</h2> <table cellspacing="1" cellpadding="2" class="auto"> <thead> <tr> <th class="vc_header_sort">Name</th> <th class="vc_header">Value</th> </tr> </thead> <tbody> <tr class="vc_row_even"> <td><strong>svn:eol-style</strong></td> <td style="white-space: pre;">native </td> </tr> </tbody> </table> </div> <hr /> <table> <tr> <td><address><a href="mailto:infrastructure at apache.org">infrastructure at apache.org</a></address></td> <td style="text-align: right;"><strong><a href="/vc-static/help_rootview.html">ViewVC Help</a></strong></td> </tr> <tr> <td>Powered by <a href="http://viewvc.tigris.org/">ViewVC 1.1.26</a></td> <td style="text-align: right;">&nbsp;</td> </tr> </table> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10