|
|
21ef37 |
From 51e3883a64ec1d787fb9a50e0aa9294e9b6bc63a Mon Sep 17 00:00:00 2001
|
|
|
21ef37 |
From: Petr Oros <poros@redhat.com>
|
|
|
21ef37 |
Date: Tue, 16 May 2017 08:27:18 +0200
|
|
|
21ef37 |
Subject: [PATCH] Show right version number
|
|
|
21ef37 |
|
|
|
21ef37 |
Signed-off-by: Petr Oros <poros@redhat.com>
|
|
|
21ef37 |
---
|
|
|
21ef37 |
src/core/version.cc | 93 ++---------------------------------------------------
|
|
|
21ef37 |
1 file changed, 2 insertions(+), 91 deletions(-)
|
|
|
21ef37 |
|
|
|
21ef37 |
diff --git a/src/core/version.cc b/src/core/version.cc
|
|
|
21ef37 |
index c9dc899..9666dd7 100644
|
|
|
21ef37 |
--- a/src/core/version.cc
|
|
|
21ef37 |
+++ b/src/core/version.cc
|
|
|
21ef37 |
@@ -18,102 +18,13 @@
|
|
|
21ef37 |
#include <resolv.h>
|
|
|
21ef37 |
#include <sys/types.h>
|
|
|
21ef37 |
|
|
|
21ef37 |
-#ifndef PACKETSZ
|
|
|
21ef37 |
-#define PACKETSZ 512
|
|
|
21ef37 |
-#endif
|
|
|
21ef37 |
-
|
|
|
21ef37 |
-
|
|
|
21ef37 |
-static char versiontag[] = "@(#) $URL$ >";
|
|
|
21ef37 |
-
|
|
|
21ef37 |
const char *getpackageversion()
|
|
|
21ef37 |
{
|
|
|
21ef37 |
- static char * result = NULL;
|
|
|
21ef37 |
- char * lastslash = NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if(result)
|
|
|
21ef37 |
- return result;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- lastslash = strrchr(versiontag, '/');
|
|
|
21ef37 |
- if(lastslash)
|
|
|
21ef37 |
- *lastslash = '\0'; // cut the basename off
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- lastslash = strrchr(versiontag, '/');
|
|
|
21ef37 |
- if(lastslash)
|
|
|
21ef37 |
- *lastslash = '\0'; // cut the basename off
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- lastslash = strrchr(versiontag, '/');
|
|
|
21ef37 |
- if(lastslash)
|
|
|
21ef37 |
- *lastslash = '\0'; // cut the basename off
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- lastslash = strrchr(versiontag, '/');
|
|
|
21ef37 |
- if(lastslash)
|
|
|
21ef37 |
- result = lastslash+1;
|
|
|
21ef37 |
- else
|
|
|
21ef37 |
- return "unknown";
|
|
|
21ef37 |
-
|
|
|
21ef37 |
+ static char result[] = "B.02.18";
|
|
|
21ef37 |
return result;
|
|
|
21ef37 |
}
|
|
|
21ef37 |
|
|
|
21ef37 |
-static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
|
|
|
21ef37 |
-{
|
|
|
21ef37 |
- unsigned char answer[PACKETSZ], *pt;
|
|
|
21ef37 |
- char host[128], *txt;
|
|
|
21ef37 |
- int len, exp, cttl, size, txtlen, type;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if(res_init() < 0)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- memset(answer, 0, PACKETSZ);
|
|
|
21ef37 |
- if((len = res_querydomain(name, domain, C_IN, T_TXT, answer, PACKETSZ)) < 0)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt = answer + sizeof(HEADER);
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt += exp;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- GETSHORT(type, pt);
|
|
|
21ef37 |
- if(type != T_TXT)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt += INT16SZ; /* class */
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if((exp = dn_expand(answer, answer + len, pt, host, sizeof(host))) < 0)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt += exp;
|
|
|
21ef37 |
- GETSHORT(type, pt);
|
|
|
21ef37 |
- if(type != T_TXT)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt += INT16SZ; /* class */
|
|
|
21ef37 |
- GETLONG(cttl, pt);
|
|
|
21ef37 |
- if(ttl)
|
|
|
21ef37 |
- *ttl = cttl;
|
|
|
21ef37 |
- GETSHORT(size, pt);
|
|
|
21ef37 |
- txtlen = *pt;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if(txtlen >= size || !txtlen)
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if(!(txt = (char*)malloc(txtlen + 1)))
|
|
|
21ef37 |
- return NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- pt++;
|
|
|
21ef37 |
- strncpy(txt, (char*)pt, txtlen);
|
|
|
21ef37 |
- txt[txtlen] = 0;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- return txt;
|
|
|
21ef37 |
-}
|
|
|
21ef37 |
-
|
|
|
21ef37 |
const char * checkupdates()
|
|
|
21ef37 |
{
|
|
|
21ef37 |
- static char *latest = NULL;
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- if(!latest)
|
|
|
21ef37 |
- latest = txtquery(PACKAGE, "ezix.org", NULL);
|
|
|
21ef37 |
-
|
|
|
21ef37 |
- return latest;
|
|
|
21ef37 |
+ return getpackageversion();
|
|
|
21ef37 |
}
|
|
|
21ef37 |
--
|
|
|
21ef37 |
2.13.0
|
|
|
21ef37 |
|