code:
diff --git a/C/Sha1.c b/C/Sha1.c
index 55c1c63..48b4c5d 100644
--- a/C/Sha1.c
+++ b/C/Sha1.c
@@ -104,39 +104,6 @@ void Sha1_GetBlockDigest(CSha1 *p, const UInt32 *data, UInt32 *destDigest)
   destDigest[4] = p->state[4] + e;
 }

-void Sha1_UpdateBlock_Rar(CSha1 *p, UInt32 *data, int returnRes)
-{
-  UInt32 a, b, c, d, e;
-  UInt32 W[kNumW];
-
-  a = p->state[0];
-  b = p->state[1];
-  c = p->state[2];
-  d = p->state[3];
-  e = p->state[4];
-
-  RX_15
-
-  RX_1_4(R0, R1, 15);
-
-  RX_20(R2, 20);
-  RX_20(R3, 40);
-  RX_20(R4, 60);
-
-  p->state[0] += a;
-  p->state[1] += b;
-  p->state[2] += c;
-  p->state[3] += d;
-  p->state[4] += e;
-
-  if (returnRes)
-  {
-    unsigned i;
-    for (i = 0 ; i < SHA1_NUM_BLOCK_WORDS; i++)
-      data[i] = W[kNumW - SHA1_NUM_BLOCK_WORDS + i];
-  }
-}
-
 #define Sha1_UpdateBlock(p) Sha1_GetBlockDigest(p, p->buffer, p->state)

 void Sha1_Update(CSha1 *p, const Byte *data, size_t size)
@@ -212,46 +179,6 @@ void Sha1_Update(CSha1 *p, const Byte *data, size_t size)
   }
 }

-void Sha1_Update_Rar(CSha1 *p, Byte *data, size_t size /* , int rar350Mode */)
-{
-  int returnRes = False;
-
-  unsigned pos = (unsigned)p->count & 0x3F;
-  p->count += size;
-
-  while (size--)
-  {
-    unsigned pos2 = (pos & 3);
-    UInt32 v = ((UInt32)*data++) << (8 * (3 - pos2));
-    UInt32 *ref = &(p->buffer[pos >> 2]);
-    pos++;
-    if (pos2 == 0)
-    {
-      *ref = v;
-      continue;
-    }
-    *ref |= v;
-
-    if (pos == SHA1_BLOCK_SIZE)
-    {
-      pos = 0;
-      Sha1_UpdateBlock_Rar(p, p->buffer, returnRes);
-      if (returnRes)
-      {
-        unsigned i;
-        for (i = 0; i < SHA1_NUM_BLOCK_WORDS; i++)
-        {
-          UInt32 d = p->buffer[i];
-          Byte *prev = data + i * 4 - SHA1_BLOCK_SIZE;
-          SetUi32(prev, d);
-        }
-      }
-      // returnRes = rar350Mode;
-      returnRes = True;
-    }
-  }
-}
-
 void Sha1_Final(CSha1 *p, Byte *digest)
 {
   unsigned pos = (unsigned)p->count & 0x3F;
diff --git a/C/Sha1.h b/C/Sha1.h
index aa22ec3..9c45653 100644
--- a/C/Sha1.h
+++ b/C/Sha1.h
@@ -27,8 +27,6 @@ void Sha1_GetBlockDigest(CSha1 *p, const UInt32 *data, UInt32 *destDigest);
 void Sha1_Update(CSha1 *p, const Byte *data, size_t size);
 void Sha1_Final(CSha1 *p, Byte *digest);

-void Sha1_Update_Rar(CSha1 *p, Byte *data, size_t size /* , int rar350Mode */);
-
 void Sha1_32_PrepareBlock(const CSha1 *p, UInt32 *block, unsigned size);
 void Sha1_32_Update(CSha1 *p, const UInt32 *data, size_t size);
 void Sha1_32_Final(CSha1 *p, UInt32 *digest);
diff --git a/CPP/7zip/Archive/7z/7zUpdate.cpp b/CPP/7zip/Archive/7z/7zUpdate.cpp
index a0571e7..43ad3e9 100644
--- a/CPP/7zip/Archive/7z/7zUpdate.cpp
+++ b/CPP/7zip/Archive/7z/7zUpdate.cpp
@@ -562,7 +562,7 @@ static int CompareEmptyItems(const unsigned *p1, const unsigned *p2, void *param
 }

 static const char *g_Exts =
-  " 7z xz lzma ace arc arj bz tbz bz2 tbz2 cab deb gz tgz ha lha lzh lzo lzx pak rar rpm sit zoo"
+  " 7z xz lzma ace arc arj bz tbz bz2 tbz2 cab deb gz tgz ha lha lzh lzo lzx pak rpm sit zoo"
   " zip jar ear war msi"
   " 3gp avi mov mpeg mpg mpe wmv"
   " aac ape fla flac la mp3 m4a mp4 ofr ogg pac ra rm rka shn swa tta wv wma wav"
diff --git a/CPP/7zip/Bundles/Format7zFree/makefile.list b/CPP/7zip/Bundles/Format7zFree/makefile.list
index da2056b..1dcf1a5 100644
--- a/CPP/7zip/Bundles/Format7zFree/makefile.list
+++ b/CPP/7zip/Bundles/Format7zFree/makefile.list
@@ -87,8 +87,6 @@ SRCS=\
   ../../../../CPP/7zip/Archive/PeHandler.cpp \
   ../../../../CPP/7zip/Archive/PpmdHandler.cpp \
   ../../../../CPP/7zip/Archive/QcowHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/RarHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp \
   ../../../../CPP/7zip/Archive/RpmHandler.cpp \
   ../../../../CPP/7zip/Archive/SplitHandler.cpp \
   ../../../../CPP/7zip/Archive/SquashfsHandler.cpp \
@@ -191,9 +189,6 @@ SRCS=\
   ../../../../CPP/7zip/Crypto/MyAesReg.cpp \
   ../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp \
   ../../../../CPP/7zip/Crypto/RandGen.cpp \
-  ../../../../CPP/7zip/Crypto/Rar20Crypto.cpp \
-  ../../../../CPP/7zip/Crypto/Rar5Aes.cpp \
-  ../../../../CPP/7zip/Crypto/RarAes.cpp \
   ../../../../CPP/7zip/Crypto/WzAes.cpp \
   ../../../../CPP/7zip/Crypto/ZipCrypto.cpp \
   ../../../../CPP/7zip/Crypto/ZipStrong.cpp \
@@ -485,10 +480,6 @@ PpmdHandler.o : ../../../../CPP/7zip/Archive/PpmdHandler.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Archive/PpmdHandler.cpp
 QcowHandler.o : ../../../../CPP/7zip/Archive/QcowHandler.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Archive/QcowHandler.cpp
-RarHandler.o : ../../../../CPP/7zip/Archive/Rar/RarHandler.cpp
-	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Archive/Rar/RarHandler.cpp
-Rar5Handler.o : ../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp
-	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp
 RpmHandler.o : ../../../../CPP/7zip/Archive/RpmHandler.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Archive/RpmHandler.cpp
 SplitHandler.o : ../../../../CPP/7zip/Archive/SplitHandler.cpp
@@ -693,12 +684,6 @@ Pbkdf2HmacSha1.o : ../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp
 RandGen.o : ../../../../CPP/7zip/Crypto/RandGen.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/RandGen.cpp
-Rar20Crypto.o : ../../../../CPP/7zip/Crypto/Rar20Crypto.cpp
-	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/Rar20Crypto.cpp
-Rar5Aes.o : ../../../../CPP/7zip/Crypto/Rar5Aes.cpp
-	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/Rar5Aes.cpp
-RarAes.o : ../../../../CPP/7zip/Crypto/RarAes.cpp
-	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/RarAes.cpp
 WzAes.o : ../../../../CPP/7zip/Crypto/WzAes.cpp
 	$(CXX) $(CXXFLAGS) ../../../../CPP/7zip/Crypto/WzAes.cpp
 ZipCrypto.o : ../../../../CPP/7zip/Crypto/ZipCrypto.cpp
@@ -869,8 +854,6 @@ OBJS=\
  PeHandler.o \
  PpmdHandler.o \
  QcowHandler.o \
- RarHandler.o \
- Rar5Handler.o \
  RpmHandler.o \
  SplitHandler.o \
  SquashfsHandler.o \
@@ -973,9 +956,6 @@ OBJS=\
  MyAesReg.o \
  Pbkdf2HmacSha1.o \
  RandGen.o \
- Rar20Crypto.o \
- Rar5Aes.o \
- RarAes.o \
  WzAes.o \
  ZipCrypto.o \
  ZipStrong.o \
diff --git a/CPP/7zip/CMAKE/Format7zFree/CMakeLists.txt b/CPP/7zip/CMAKE/Format7zFree/CMakeLists.txt
index 61f41f9..adc7117 100644
--- a/CPP/7zip/CMAKE/Format7zFree/CMakeLists.txt
+++ b/CPP/7zip/CMAKE/Format7zFree/CMakeLists.txt
@@ -126,8 +126,6 @@ add_library(7z MODULE
   "../../../../CPP/7zip/Archive/PeHandler.cpp"
   "../../../../CPP/7zip/Archive/PpmdHandler.cpp"
   "../../../../CPP/7zip/Archive/QcowHandler.cpp"
-  "../../../../CPP/7zip/Archive/Rar/RarHandler.cpp"
-  "../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp"
   "../../../../CPP/7zip/Archive/RpmHandler.cpp"
   "../../../../CPP/7zip/Archive/SplitHandler.cpp"
   "../../../../CPP/7zip/Archive/SquashfsHandler.cpp"
@@ -230,9 +228,6 @@ add_library(7z MODULE
   "../../../../CPP/7zip/Crypto/MyAesReg.cpp"
   "../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp"
   "../../../../CPP/7zip/Crypto/RandGen.cpp"
-  "../../../../CPP/7zip/Crypto/Rar20Crypto.cpp"
-  "../../../../CPP/7zip/Crypto/Rar5Aes.cpp"
-  "../../../../CPP/7zip/Crypto/RarAes.cpp"
   "../../../../CPP/7zip/Crypto/WzAes.cpp"
   "../../../../CPP/7zip/Crypto/ZipCrypto.cpp"
   "../../../../CPP/7zip/Crypto/ZipStrong.cpp"
diff --git a/CPP/7zip/Crypto/Sha1Cls.h b/CPP/7zip/Crypto/Sha1Cls.h
index 71acbde..cde4a57 100644
--- a/CPP/7zip/Crypto/Sha1Cls.h
+++ b/CPP/7zip/Crypto/Sha1Cls.h
@@ -28,7 +28,6 @@ class CContext: public CContextBase
 {
 public:
   void Update(const Byte *data, size_t size) throw() { Sha1_Update(&_s, data, size); }
-  void UpdateRar(Byte *data, size_t size /* , bool rar350Mode */) throw() { Sha1_Update_Rar(&_s, data, size /* , rar350Mode ? 1 : 0 */); }
   void Final(Byte *digest) throw() { Sha1_Final(&_s, digest); }
 };

diff --git a/CPP/7zip/Guid.txt b/CPP/7zip/Guid.txt
index 7edab6e..cc22992 100644
--- a/CPP/7zip/Guid.txt
+++ b/CPP/7zip/Guid.txt
@@ -151,7 +151,6 @@ Handler GUIDs:

   01 Zip
   02 BZip2
-  03 Rar
   04 Arj
   05 Z
   06 Lzh
@@ -168,7 +167,6 @@ Handler GUIDs:
   C9 VDI
   CA Qcow
   CB GPT
-  CC Rar5
   CD IHex
   CE Hxs
   CF TE
diff --git a/CPP/7zip/QMAKE/Format7zFree/Format7zFree.pro b/CPP/7zip/QMAKE/Format7zFree/Format7zFree.pro
index afa36d4..93c45c7 100644
--- a/CPP/7zip/QMAKE/Format7zFree/Format7zFree.pro
+++ b/CPP/7zip/QMAKE/Format7zFree/Format7zFree.pro
@@ -137,8 +137,6 @@ SOURCES +=  \
   ../../../../CPP/7zip/Archive/PeHandler.cpp \
   ../../../../CPP/7zip/Archive/PpmdHandler.cpp \
   ../../../../CPP/7zip/Archive/QcowHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/RarHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp \
   ../../../../CPP/7zip/Archive/RpmHandler.cpp \
   ../../../../CPP/7zip/Archive/SplitHandler.cpp \
   ../../../../CPP/7zip/Archive/SquashfsHandler.cpp \
@@ -241,9 +239,6 @@ SOURCES +=  \
   ../../../../CPP/7zip/Crypto/MyAesReg.cpp \
   ../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp \
   ../../../../CPP/7zip/Crypto/RandGen.cpp \
-  ../../../../CPP/7zip/Crypto/Rar20Crypto.cpp \
-  ../../../../CPP/7zip/Crypto/Rar5Aes.cpp \
-  ../../../../CPP/7zip/Crypto/RarAes.cpp \
   ../../../../CPP/7zip/Crypto/WzAes.cpp \
   ../../../../CPP/7zip/Crypto/ZipCrypto.cpp \
   ../../../../CPP/7zip/Crypto/ZipStrong.cpp \
diff --git a/CPP/7zip/QMAKE/all.pro b/CPP/7zip/QMAKE/all.pro
index a565ba8..6668619 100644
--- a/CPP/7zip/QMAKE/all.pro
+++ b/CPP/7zip/QMAKE/all.pro
@@ -4,7 +4,6 @@ SUBDIRS = 7za \
           7zr \
           7z_ \
           Format7zFree \
-          Rar \
           Lzham \
           test_lib

diff --git a/CPP/7zip/UI/Client7z/Client7z.cpp b/CPP/7zip/UI/Client7z/Client7z.cpp
index d0eca6d..7f4e6e2 100644
--- a/CPP/7zip/UI/Client7z/Client7z.cpp
+++ b/CPP/7zip/UI/Client7z/Client7z.cpp
@@ -32,7 +32,7 @@ HINSTANCE g_hInstance = 0;
 #endif

 // Tou can find the list of all GUIDs in Guid.txt file.
-// use another CLSIDs, if you want to support other formats (zip, rar, ...).
+// use another CLSIDs, if you want to support other formats (zip, ...).
 // {23170F69-40C1-278A-1000-000110070000}

 DEFINE_GUID(CLSID_CFormat7z,
diff --git a/CPP/7zip/UI/Common/LoadCodecs.h b/CPP/7zip/UI/Common/LoadCodecs.h
index ac9eeac..076bd1c 100644
--- a/CPP/7zip/UI/Common/LoadCodecs.h
+++ b/CPP/7zip/UI/Common/LoadCodecs.h
@@ -158,7 +158,6 @@ struct CArcInfoEx
   void AddExts(const UString &ext, const UString &addExt);

   bool IsSplit() const { return StringsAreEqualNoCase_Ascii(Name, "Split"); }
-  // bool IsRar() const { return StringsAreEqualNoCase_Ascii(Name, "Rar"); }

   CArcInfoEx():
       Flags(0),
diff --git a/CPP/7zip/UI/Common/OpenArchive.cpp b/CPP/7zip/UI/Common/OpenArchive.cpp
index 7d5b0c4..88ea5ab 100644
--- a/CPP/7zip/UI/Common/OpenArchive.cpp
+++ b/CPP/7zip/UI/Common/OpenArchive.cpp
@@ -1063,7 +1063,6 @@ static const char * const k_Formats_with_simple_signuature[] =
 {
     "7z"
   , "xz"
-  , "rar"
   , "bzip2"
   , "gzip"
   , "cab"
@@ -1720,29 +1719,6 @@ HRESULT CArc::OpenStream2(const COpenOptions &op)
         {
           // signature search was here
         }
-        else if (extension.IsEqualTo("000") || extension.IsEqualTo("001"))
-        {
-          int i = FindFormatForArchiveType(op.codecs, orderIndices, "rar");
-          if (i >= 0)
-          {
-            const size_t kBufSize = (1 << 10);
-            byteBuffer.Alloc(kBufSize);
-            size_t processedSize = kBufSize;
-            RINOK(ReadStream(op.stream, byteBuffer, &processedSize));
-            if (processedSize >= 16)
-            {
-              const Byte *buf = byteBuffer;
-              const Byte kRarHeader[] = { 0x52 , 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 };
-              if (TestSignature(buf, kRarHeader, 7) && buf[9] == 0x73 && (buf[10] & 1) != 0)
-              {
-                orderIndices2.Add(orderIndices[i]);
-                orderIndices[i] = -1;
-                if (i >= (int)numFinded)
-                  numFinded++;
-              }
-            }
-          }
-        }
         else
         {
           const size_t kBufSize = (1 << 10);
diff --git a/CPP/7zip/UI/FileManager/FM_rc.cpp b/CPP/7zip/UI/FileManager/FM_rc.cpp
index 83578ed..034feed 100644
--- a/CPP/7zip/UI/FileManager/FM_rc.cpp
+++ b/CPP/7zip/UI/FileManager/FM_rc.cpp
@@ -821,8 +821,6 @@ REGISTER_STRINGTABLE(g_stringTable)

 /////////////////////////////////////////////////////

-#include "res/ParentFolder.h"
-
 	SevenZipPanel::SevenZipPanel(MyFrame *frame, wxWindow *parent,int id,int panelIndex) :
 	       	wxPanel(parent,id) , m_frame(frame), _wList(0)
 	{
@@ -840,7 +838,7 @@ REGISTER_STRINGTABLE(g_stringTable)
 		int sizes[] = {150, 250, 350, -1};
 		wxArrayString pathArray;
 		wxBoxSizer *pPathSizer = new wxBoxSizer(wxHORIZONTAL);
-		m_pBmpButtonParentFolder = new wxBitmapButton(this, kParentFolderID, wxGetBitmapFromMemory(PARENT_FOLDER), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
+		m_pBmpButtonParentFolder = new wxBitmapButton(this, kParentFolderID, wxArtProvider::GetBitmap(wxART_GO_DIR_UP, wxART_TOOLBAR, wxDefaultSize), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
 		m_pComboBoxPath = new wxComboBox(this, _comboBoxID, wxEmptyString, wxDefaultPosition, wxSize(300,-1), pathArray, wxCB_DROPDOWN | wxCB_SORT );
 		pPathSizer->Add(m_pBmpButtonParentFolder, 0, wxALL|wxEXPAND, 0);
 		pPathSizer->Add(m_pComboBoxPath, 1, wxALL|wxEXPAND, 5);
diff --git a/CPP/ANDROID/Format7zFree/jni/Android.mk b/CPP/ANDROID/Format7zFree/jni/Android.mk
index 7c74e73..48cb4fa 100644
--- a/CPP/ANDROID/Format7zFree/jni/Android.mk
+++ b/CPP/ANDROID/Format7zFree/jni/Android.mk
@@ -91,8 +91,6 @@ LOCAL_SRC_FILES := \
   ../../../../CPP/7zip/Archive/PeHandler.cpp \
   ../../../../CPP/7zip/Archive/PpmdHandler.cpp \
   ../../../../CPP/7zip/Archive/QcowHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/RarHandler.cpp \
-  ../../../../CPP/7zip/Archive/Rar/Rar5Handler.cpp \
   ../../../../CPP/7zip/Archive/RpmHandler.cpp \
   ../../../../CPP/7zip/Archive/SplitHandler.cpp \
   ../../../../CPP/7zip/Archive/SquashfsHandler.cpp \
@@ -195,9 +193,6 @@ LOCAL_SRC_FILES := \
   ../../../../CPP/7zip/Crypto/MyAesReg.cpp \
   ../../../../CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp \
   ../../../../CPP/7zip/Crypto/RandGen.cpp \
-  ../../../../CPP/7zip/Crypto/Rar20Crypto.cpp \
-  ../../../../CPP/7zip/Crypto/Rar5Aes.cpp \
-  ../../../../CPP/7zip/Crypto/RarAes.cpp \
   ../../../../CPP/7zip/Crypto/WzAes.cpp \
   ../../../../CPP/7zip/Crypto/ZipCrypto.cpp \
   ../../../../CPP/7zip/Crypto/ZipStrong.cpp \
diff --git a/ChangeLog b/ChangeLog
index daabd8e..f2a01d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,7 +28,6 @@ Version 16.00 (never published)
       - 7z update bcj bugs were fixed.
       - split (aaa.001) fixed
       - iso loop fix
-      - rar4 multivol -stdin kpidSize
       - drag and drop 1<2.txt
       - memory access violation fix

@@ -80,11 +79,6 @@ Version 15.12 (never published)
     - "There are no errors" string after "Test" operation inside archive.
     - The bugs in LZMA SDK were fixed (but these bugs are not related directly to 7-Zip's code).

-
-  - From Windows version of 7-Zip 15.11 :
-        - Some bugs were fixed.
-        - 7-Zip 15.10 showed incorrect error message about missing volume for multivolume RAR archives.
-
    - ..../LZHAM added

@@ -104,9 +98,6 @@ Version 15.10 beta
 	  version (-m switch).
     - Some bugs were fixed.
       - extracting from solid wim archives worked incorrectly in some cases,
-    - Also there are some minor changes.
-      - 7-Zip can show the name of missing volume for multivolume RAR and VMDK archives.
-      - Some internal changes with 7-Zip Benchmark.

 Version 15.09 beta
 ==================
@@ -128,8 +119,6 @@ Version 15.08 beta
 Version 15.07 beta
 ==================

-  - "bin/Codecs/Rar29.so" renamed to "bin/Codecs/Rar.so"
-
   - support for cygwin 64 bits

   - support for cygwin 64 bits with asm
@@ -153,15 +142,12 @@ Version 15.07 beta

   - From Windows version of 7-zip 15.06 beta:

-    - 7-Zip now can extract RAR5 archives.
     - 7-Zip now doesn't sort files by type while adding to solid 7z archive.
       new -mqs switch to sort files by type while adding to solid 7z archive.
     - The BUG in 7-Zip File Manager was fixed:
       The "Move" operation to open 7z archive didn't delete empty files.
     - The BUG in 15.05 was fixed:
       console version added some text to the end of stdout stream, is -so switch was used.
-    - The BUG in 9.30 - 15.05 was fixed:
-      7-Zip could not open multivolume sfx RAR archive.
     - Some bugs were fixed.

   - From Windows version of 7-zip 15.05 beta:
@@ -214,9 +200,6 @@ Version 9.38
   - bug #139 "password from commanline is visible in processes list"
       Now the characters of the password are replaced with *.

-  - From Windows version of 7-zip
-     - bug#138 If you extract the password with # program crashes
-       7z now supports long password in RAR 3 and 4.

@@ -247,12 +230,6 @@ Version 9.22
   - #3283518 : Asm/x{32,64}/7zCrcT8U.asm introduces executable stack

-Version 9.20.1
-==============
-
-  - #3211479 "p7zip 9.20 - "unsupported method" with RAR files - " fixed
-    "install.sh" installs again "bin/Codecs/Rar29.so"
-
 Version 9.20
 ============

@@ -325,8 +302,6 @@ Version 9.13
     - Some bugs were fixed.

-  - #2863580 "Crash in Rar decoder on a corrupted file" fixed
-
   - #2860898 "Dereferencing a zero pointer in cab handler" fixed

   - #2860679 "Division by zero in cab decoder" fixed
@@ -455,7 +430,7 @@ Version 4.59 (never published)
     - It's allowed to use -t switch for "list" and "extract" commands.
     - Some bugs were fixed.

-  - Bug : wrong timestamp for files extracted from .zip or .rar archives
+  - Bug : wrong timestamp for files extracted from .zip archives

 Version 4.58
@@ -468,8 +443,6 @@ Version 4.58
         2) -mcu switch:  7-Zip uses UTF-8, if there are non-ASCII symbols.
         3) -mcl switch:  7-Zip uses local code page.
     - Now it's possible to store file creation time in 7z and ZIP archives (-mtc switch).
-    - 7-Zip now can unpack multivolume RAR archives created with
-      "old style volume names" scheme and names *.001, *.002, ...
     - Now it's possible to use -mSW- and -mSW+ switches instead of -mSW=off and -mSW=on
     - Some bugs were fixed.

@@ -685,7 +658,7 @@ Version 4.44

   - From Windows version of 7-zip 4.44 :
     - 7za : Cab support
-    - Speed optimizations for LZMA, Deflate, BZip2 and unRAR.
+    - Speed optimizations for LZMA, Deflate and BZip2.
     - fix : now, updating a crypted header archive keeps the crypted header

   - fixes in the help displayed by 7za/7z/7zr.
@@ -805,8 +778,6 @@ Version 4.38

   - patch #1465026 - Patch for install.sh for packagers

-  - DosDateTimeToFileTime fixed (rar format)
-
   - contrib/VirtualFileSystemForMidnightCommander/u7z updated
     (thank sgh_punk)

@@ -923,8 +894,6 @@ Version 4.25
     - Some bugs were fixed
     - DOCS/MANUAL/exit_codes.htm added

-  - new plugin for 7z : RAR format support (extracting only)
-
   - better dependencies in makefile

 Version 4.23
@@ -1112,9 +1081,6 @@ Version 4.10
   - new port of 7za from the source of 7za 4.10Beta for Windows
     => p7zip now work on big endian CPU.

-  - 7z for Unix is not maintain anymore (because as the source of unrar plugin for 7z
-    is not available, 7z is unless on Unix).
-
 Version 0.91
 ============
   - add support for FreeBSD 5.2.1
diff --git a/DOC/License.txt b/DOC/License.txt
index 0bcbe26..5b0dfaa 100644
--- a/DOC/License.txt
+++ b/DOC/License.txt
@@ -5,15 +5,6 @@

   7-Zip Copyright (C) 1999-2016 Igor Pavlov.

-  Licenses for files are:
-
-    1) CPP/7zip/Compress/Rar* files:  GNU LGPL + unRAR restriction
-    2) All other files:  GNU LGPL
-
-  The GNU LGPL + unRAR restriction means that you must follow both
-  GNU LGPL rules and unRAR restriction rules.
-
-
   GNU LGPL information
   --------------------

@@ -33,21 +24,5 @@
     USA

-  unRAR restriction
-  -----------------
-
-    The decompression engine for RAR archives was developed using source
-    code of unRAR program.
-    All copyrights to original unRAR code are owned by Alexander Roshal.
-
-    The license for original unRAR code has the following restriction:
-
-    The unRAR sources cannot be used to re-create the RAR compression algorithm,
-    which is proprietary. Distribution of modified unRAR sources in separate form
-    or as a part of other software is permitted, provided that it is clearly
-    stated in the documentation and source comments that the code may
-    not be used to develop a RAR (WinRAR) compatible archiver.
-
-
   --
   Igor Pavlov
diff --git a/DOC/MANUAL/cmdline/switches/update.htm b/DOC/MANUAL/cmdline/switches/update.htm
index 27385b1..0190fc1 100644
--- a/DOC/MANUAL/cmdline/switches/update.htm
+++ b/DOC/MANUAL/cmdline/switches/update.htm
@@ -139,7 +139,7 @@ someone in another time zone.</P>
 <LI>UTC file systems: NTFS
 <LI>UTC archive formats: .zip with -mtc switch, 7z, tar, gzip2, iso, wim
 <LI>Local time file systems : FAT, FAT32
-<LI>Local time archive formats : rar, zip, cab
+<LI>Local time archive formats : zip, cab
 </UL>

 <H4>Examples</H4>
diff --git a/DOC/MANUAL/general/formats.htm b/DOC/MANUAL/general/formats.htm
index 7996c5c..cd01bd6 100644
--- a/DOC/MANUAL/general/formats.htm
+++ b/DOC/MANUAL/general/formats.htm
@@ -47,7 +47,6 @@
   <TR> <TD align="center">NSIS</TD> <TD></TD> <TD>nsis</TD> </TR>
   <TR> <TD align="center">NTFS</TD> <TD></TD> <TD>ntfs img</TD> </TR>
   <TR> <TD align="center">MBR</TD> <TD></TD> <TD>mbr</TD> </TR>
-  <TR> <TD align="center">RAR</TD> <TD></TD> <TD>rar r00</TD> </TR>
   <TR> <TD align="center">RPM</TD>  <TD></TD> <TD>rpm</TD></TR>
   <TR> <TD align="center">PPMD</TD> <TD></TD> <TD>ppmd</TD> </TR>
   <TR> <TD align="center">QCOW2</TD> <TD></TD> <TD>qcow qcow2 qcow2c</TD> </TR>
diff --git a/DOC/Methods.txt b/DOC/Methods.txt
index 1a1c54c..daa94e2 100644
--- a/DOC/Methods.txt
+++ b/DOC/Methods.txt
@@ -97,12 +97,6 @@ List of defined IDs
    02 -
       02 - BZip2

-   03 - [Rar]
-      01 - Rar1
-      02 - Rar2
-      03 - Rar3
-      05 - Rar5
-
    04 - [Arj]
       01 - Arj(1,2,3)
       02 - Arj4
@@ -146,10 +140,6 @@ List of defined IDs
       01 - [Zip]
          01 - ZipCrypto (Main Zip crypto algo)

-      03 - [RAR]
-         02 -
-         03 - Rar29AES (AES-128 + modified SHA-1)
-
       07 - [7z]
          01 - 7zAES (AES-256 + SHA-256)

diff --git a/DOC/readme.txt b/DOC/readme.txt
index 4a6998c..00591d4 100644
--- a/DOC/readme.txt
+++ b/DOC/readme.txt
@@ -9,30 +9,9 @@
 License Info
 ------------

-7-Zip is free software distributed under the GNU LGPL
-(except for unRar code).
+7-Zip is free software distributed under the GNU LGPL.
 read License.txt for more infomation about license.

-Notes about unRAR license:
-
-Please check main restriction from unRar license:
-
-   2. The unRAR sources may be used in any software to handle RAR
-      archives without limitations free of charge, but cannot be used
-      to re-create the RAR compression algorithm, which is proprietary.
-      Distribution of modified unRAR sources in separate form or as a
-      part of other software is permitted, provided that it is clearly
-      stated in the documentation and source comments that the code may
-      not be used to develop a RAR (WinRAR) compatible archiver.
-
-In brief it means:
-1) You can compile and use compiled files under GNU LGPL rules, since
-   unRAR license almost has no restrictions for compiled files.
-   You can link these compiled files to LGPL programs.
-2) You can fix bugs in source code and use compiled fixed version.
-3) You can not use unRAR sources to re-create the RAR compression algorithm.
-
-
 LZMA SDK
 --------

@@ -96,7 +75,6 @@ DOC                Documentation
 ---
   7zFormat.txt   - 7z format description
   copying.txt    - GNU LGPL license
-  unRarLicense.txt - License for unRAR part of source code
   src-history.txt  - Sources history
   Methods.txt    - Compression method IDs
   readme.txt     - Readme file
diff --git a/DOC/src-history.txt b/DOC/src-history.txt
index 6b48c80..dda8057 100644
--- a/DOC/src-history.txt
+++ b/DOC/src-history.txt
@@ -188,8 +188,6 @@ HISTORY of the 7-Zip source code
 - 7-Zip now has 128 MB dictionary limit for 32-bit version:
   It's for speed optimization: kNumLogBits = 9 + sizeof(size_t) / 2;
 - TAR: 'D' link flag support.
-- 7-Zip now can unpack multivolume RAR archives created with
-  "old style volume names" scheme (-vn switch) and names *.001, *.002, ...
 - Fixed bugs:
   - 7-Zip FM could not copy / move files to root network folders like \\COMPNAME\FOLDERNAME\
     In case of move it removed original files.
@@ -200,8 +198,6 @@ HISTORY of the 7-Zip source code
       7-zip tries to delete all extra fileds (except for WzAES).
       And that code could hang.
   -  7-Zip GUI didn't suggest BZip2 dictionary size used in previous run.
-  -  If creation time stamp was included in .RAR archive, 7-zip used creation time stamp
-     as modification time stamp.

 4.58 alpha 2   2007-12-31
 -------------------------
@@ -251,7 +247,6 @@ HISTORY of the 7-Zip source code
   stratup code, or you must add CPP/Common/CRC.cpp to your project.
 - Method ID in .7z now is 63-bit integer (UInt64).
 - Open error messages
-- unRar 1.5 fixed
 - unShrink fixed
 - BUG of 4.43 beta and 4.44 beta was fixed.
   7-Zip compressing to .zip in multi-threading mode didn't work in some cases.
@@ -433,11 +428,6 @@ HISTORY of the 7-Zip source code
     contains common resurces

-2.30 Beta 19   2002-04-11
--------------------------
-- SDK/Archive/Rar/Handler.cpp
-    supporting RAR29
-
 2.30 Beta 18   2002-03-25
 -------------------------
 - SDK/Archive/Cab/MSZipDecoder.cpp
diff --git a/GUI/Contents/Info.plist b/GUI/Contents/Info.plist
index 71650e1..d60b262 100644
--- a/GUI/Contents/Info.plist
+++ b/GUI/Contents/Info.plist
@@ -311,24 +311,6 @@
 		<dict>
 			<key>CFBundleTypeExtensions</key>
 			<array>
-				<string>rar</string>
-				<string>RAR</string>
-				<string>.r00</string>
-			</array>
-			<key>CFBundleTypeIconFile</key>
-			<string>p7zip</string>
-			<key>CFBundleTypeName</key>
-			<string>Rar</string>
-			<key>CFBundleTypeRole</key>
-			<string>Viewer</string>
-			<key>LSTypeIsPackage</key>
-			<false/>
-			<key>NSPersistentStoreTypeKey</key>
-			<string>XML</string>
-		</dict>
-		<dict>
-			<key>CFBundleTypeExtensions</key>
-			<array>
 				<string>ace</string>
 				<string>ACE</string>
 				<string>.c00</string>
diff --git a/README b/README
index b76407f..c03917b 100644
--- a/README
+++ b/README
@@ -8,7 +8,7 @@ p7zip is a port of the Windows programs 7z.exe and 7za.exe provided by 7-zip.
 7-zip is a file archiver with the highest compression ratio.
 Homepage : www.7-zip.org

-  7z uses plugins (7z.so and Codecs/Rar.so) to handle archives.
+  7z uses plugins (7z.so) to handle archives.
   7za is a stand-alone executable (7za handles less archive formats than 7z).
   7zr is a light stand-alone executable that supports only 7z/LZMA/BCJ/BCJ2.

@@ -63,7 +63,6 @@ BUILD :
     make sfx      : to build bin/7zCon.sfx (7za can now create SFX archive)
     make 7z       : to build bin/7z and its plugins :
                           - "bin/7z.so" (GNU LGPL + AES code license)
-                          - "bin/Codecs/Rar.so" (GNU LGPL + unRAR restriction)
     make 7zr      : to build bin/7zr
     make all      : to build bin/7za and bin/7zCon.sfx
     make all2     : to build bin/7za, bin/7z (with its plugins) and bin/7zCon.sfx
@@ -74,7 +73,6 @@ BUILD :

     make 7zG      : to build bin/7zG and its plugins :
                           - "bin/7z.so" (GNU LGPL + AES code license)
-                          - "bin/Codecs/Rar.so" (GNU LGPL + unRAR restriction)
     make test_7zG : to test bin/7zG (extracting, archiving, ...)

diff --git a/Utils/bin_to_sources.py b/Utils/bin_to_sources.py
index 1be72ec..7da359a 100644
--- a/Utils/bin_to_sources.py
+++ b/Utils/bin_to_sources.py
@@ -13,9 +13,6 @@ file0='Utils/file_7zCon_sfx.py'
 dir0='CPP/7zip/UI/Console'
 file0='Utils/file_7z.py'

-dir0='CPP/7zip/Compress/Rar'
-file0='Utils/file_Codecs_Rar_so.py'
-
 dir0='CPP/7zip/Bundles/Format7zFree'
 file0='Utils/file_7z_so.py'

diff --git a/Utils/file_7z_so.py b/Utils/file_7z_so.py
index 7ca9fff..43edb87 100644
--- a/Utils/file_7z_so.py
+++ b/Utils/file_7z_so.py
@@ -111,8 +111,6 @@ files_cpp=[
  'CPP/7zip/Archive/PeHandler.cpp',
  'CPP/7zip/Archive/PpmdHandler.cpp',
  'CPP/7zip/Archive/QcowHandler.cpp',
- 'CPP/7zip/Archive/Rar/RarHandler.cpp',
- 'CPP/7zip/Archive/Rar/Rar5Handler.cpp',
  'CPP/7zip/Archive/RpmHandler.cpp',
  'CPP/7zip/Archive/SplitHandler.cpp',
  'CPP/7zip/Archive/SquashfsHandler.cpp',
@@ -215,9 +213,6 @@ files_cpp=[
  'CPP/7zip/Crypto/MyAesReg.cpp',
  'CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp',
  'CPP/7zip/Crypto/RandGen.cpp',
- 'CPP/7zip/Crypto/Rar20Crypto.cpp',
- 'CPP/7zip/Crypto/Rar5Aes.cpp',
- 'CPP/7zip/Crypto/RarAes.cpp',
  'CPP/7zip/Crypto/WzAes.cpp',
  'CPP/7zip/Crypto/ZipCrypto.cpp',
  'CPP/7zip/Crypto/ZipStrong.cpp',
diff --git a/Utils/generate.py b/Utils/generate.py
index 132024a..62c0456 100755
--- a/Utils/generate.py
+++ b/Utils/generate.py
@@ -281,7 +281,6 @@ import file_7zr
 import file_7zG
 import file_7zFM
 import file_7z_so
-import file_Codecs_Rar_so
 import file_Codecs_Lzham_so
 import file_LzmaCon
 import file_Client7z
@@ -440,43 +439,6 @@ LOCAL_CFLAGS := -DANDROID_NDK  -fexceptions \
 -I../../../include_windows
 ''')

-project_Codecs_Rar=Structure(name="Rar",name2="Rar",
-	type=TYPE_DLL,
-	need_AES=False,
-	includedirs=includedirs_7za,
-	defines=[ "EXTERNAL_CODECS", "_FILE_OFFSET_BITS=64", "_LARGEFILE_SOURCE", "_REENTRANT", "ENV_UNIX", "BREAK_HANDLER", "UNICODE", "_UNICODE", "UNIX_USE_WIN_FILE" ],
-	files_c=file_Codecs_Rar_so.files_c,
-	files_cpp=file_Codecs_Rar_so.files_cpp,
-	cmake_end='''
-
-find_library(DL_LIB dl)
-
-link_directories(${DL_LIB_PATH})
-
-IF(APPLE)
-   TARGET_LINK_LIBRARIES(Rar ${COREFOUNDATION_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
-ELSE(APPLE)
-  IF(HAVE_PTHREADS)
-   TARGET_LINK_LIBRARIES(Rar ${CMAKE_THREAD_LIBS_INIT} dl)
-  ENDIF(HAVE_PTHREADS)
-ENDIF(APPLE)
-
-''',
-android_header=r'''
-LOCAL_CFLAGS := -DANDROID_NDK  -fexceptions \
-	-DNDEBUG -D_REENTRANT -DENV_UNIX \
-	-DEXTERNAL_CODECS \
-	-DBREAK_HANDLER \
-	-DUNICODE -D_UNICODE -DUNIX_USE_WIN_FILE \
-	-I../../../Windows \
-	-I../../../Common \
-	-I../../../../C \
--I../../../myWindows \
--I../../../ \
--I../../../include_windows
-''')
-
-

 project_Codecs_Lzham=Structure(name="Lzham",name2="Lzham",
 	type=TYPE_DLL,
@@ -762,7 +724,6 @@ generate_makefile_list('../CPP/7zip/Bundles/Alone/makefile.list',project_7za)
 generate_makefile_list('../CPP/7zip/Bundles/Alone7z/makefile.list',project_7zr)
 generate_makefile_list('../CPP/7zip/UI/Console/makefile.list',project_7z)
 generate_makefile_list('../CPP/7zip/Bundles/Format7zFree/makefile.list',project_Format7zFree)
-generate_makefile_list('../CPP/7zip/Compress/Rar/makefile.list',project_Codecs_Rar,'../../../../bin/Codecs')
 generate_makefile_list('../CPP/7zip/Compress/Lzham/makefile.list',project_Codecs_Lzham,'../../../../bin/Codecs')
 generate_makefile_list('../CPP/7zip/Bundles/SFXCon/makefile.list',project_7zCon_sfx)
 generate_makefile_list('../CPP/7zip/UI/GUI/makefile.list',project_7zG)
@@ -776,7 +737,6 @@ generate_pro('../CPP/7zip/QMAKE/7za/7za.pro',project_7za)
 generate_pro('../CPP/7zip/QMAKE/7zr/7zr.pro',project_7zr)
 generate_pro('../CPP/7zip/QMAKE/7z_/7z_.pro',project_7z)
 generate_pro('../CPP/7zip/QMAKE/Format7zFree/Format7zFree.pro',project_Format7zFree)
-generate_pro('../CPP/7zip/QMAKE/Rar/Rar.pro',project_Codecs_Rar)
 generate_pro('../CPP/7zip/QMAKE/Lzham/Lzham.pro',project_Codecs_Lzham)

 generate_premake4('../CPP/7zip/PREMAKE/premake4.lua',project_7za)
diff --git a/contrib/qnx630sp3/qnx630sp3-shared b/contrib/qnx630sp3/qnx630sp3-shared
index 6f5481f..ea07114 100644
--- a/contrib/qnx630sp3/qnx630sp3-shared
+++ b/contrib/qnx630sp3/qnx630sp3-shared
@@ -8,7 +8,7 @@ mv ./bin/7z ../${BIN} && mv ./bin/7za ../${BIN} && mv ./bin/7zr ../${BIN} && mv
 make clean && \
 cp makefile.qnx_shared.so makefile.machine && \
 make 7z && \
-mv ./bin/7z.so ../${BIN} && mv ./bin/Codecs/Rar.so ../${BIN}/Codecs && \
+mv ./bin/7z.so ../${BIN} && \
 make clean && \
 mv makefile.machine.bak makefile.machine
 echo "All done - look for binaries in ../${BIN}"
diff --git a/makefile b/makefile
index 745c8ed..f8e8e33 100644
--- a/makefile
+++ b/makefile
@@ -31,7 +31,6 @@ depend:
 	$(MAKE) -C CPP/7zip/UI/Client7z           depend
 	$(MAKE) -C CPP/7zip/UI/Console            depend
 	$(MAKE) -C CPP/7zip/Bundles/Format7zFree  depend
-	$(MAKE) -C CPP/7zip/Compress/Rar          depend
 	$(MAKE) -C CPP/7zip/UI/GUI                depend
 	$(MAKE) -C CPP/7zip/UI/FileManager        depend

@@ -42,7 +41,6 @@ sfx: common
 common7z:common
 	$(MKDIR) bin/Codecs
 	$(MAKE) -C CPP/7zip/Bundles/Format7zFree all
-	$(MAKE) -C CPP/7zip/Compress/Rar         all

 lzham:common
 	$(MKDIR) bin/Codecs
@@ -67,7 +65,6 @@ clean_C:
 	$(MAKE) -C CPP/7zip/UI/FileManager       clean
 	$(MAKE) -C CPP/7zip/UI/GUI               clean
 	$(MAKE) -C CPP/7zip/Bundles/Format7zFree clean
-	$(MAKE) -C CPP/7zip/Compress/Rar         clean
 	$(MAKE) -C CPP/7zip/Compress/Lzham       clean
 	$(MAKE) -C CPP/7zip/Bundles/LzmaCon      clean2
 	$(MAKE) -C CPP/7zip/Bundles/AloneGCOV    clean
diff --git a/makefile.oldmake b/makefile.oldmake
index afc681c..690af08 100644
--- a/makefile.oldmake
+++ b/makefile.oldmake
@@ -31,7 +31,6 @@ depend:
 	cd CPP/7zip/UI/Client7z           ; $(MAKE) depend
 	cd CPP/7zip/UI/Console            ; $(MAKE) depend
 	cd CPP/7zip/Bundles/Format7zFree  ; $(MAKE) depend
-	cd CPP/7zip/Compress/Rar          ; $(MAKE) depend
 	cd CPP/7zip/UI/GUI                ; $(MAKE) depend
 	cd CPP/7zip/UI/FileManager        ; $(MAKE) depend

@@ -42,7 +41,6 @@ sfx: common
 common7z:common
 	$(MKDIR) bin/Codecs
 	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) all
-	cd CPP/7zip/Compress/Rar         ; $(MAKE) all

 lzham:common
 	$(MKDIR) bin/Codecs
@@ -67,7 +65,6 @@ clean_C:
 	cd CPP/7zip/UI/FileManager       ; $(MAKE) clean
 	cd CPP/7zip/UI/GUI               ; $(MAKE) clean
 	cd CPP/7zip/Bundles/Format7zFree ; $(MAKE) clean
-	cd CPP/7zip/Compress/Rar         ; $(MAKE) clean
 	cd CPP/7zip/Compress/Lzham       ; $(MAKE) clean
 	cd CPP/7zip/Bundles/LzmaCon      ; $(MAKE) clean2
 	cd CPP/7zip/Bundles/AloneGCOV    ; $(MAKE) clean
diff --git a/makefile.qnx_shared.so b/makefile.qnx_shared.so
index abd1caf..cff5485 100644
--- a/makefile.qnx_shared.so
+++ b/makefile.qnx_shared.so
@@ -1,5 +1,5 @@
 ###################################################
-# makefile.machine for "7z.so , Codecs/Rar.so" :
+# makefile.machine for "7z.so" :
 # tested with p7zip-4.47_beta on qnx-6.3.0 sp3 x86 target

 OPTFLAGS=-O -s


code:
Fix CVE-2020-10595:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-10595

Patch copied from upstream advisory:

https://seclists.org/oss-sec/2020/q1/128

diff --git a/prompting.c b/prompting.c
index e985d95..d81054f 100644
--- a/prompting.c
+++ b/prompting.c
@@ -314,26 +314,27 @@ pamk5_prompter_krb5(krb5_context context UNUSED, void *data, const char *name,
     /*
      * Reuse pam_prompts as a starting index and copy the data into the reply
      * area of the krb5_prompt structs.
      */
     pam_prompts = 0;
     if (name != NULL && !args->silent)
         pam_prompts++;
     if (banner != NULL && !args->silent)
         pam_prompts++;
     for (i = 0; i < num_prompts; i++, pam_prompts++) {
-        size_t len;
+        size_t len, allowed;

         if (resp[pam_prompts].resp == NULL)
             goto cleanup;
         len = strlen(resp[pam_prompts].resp);
-        if (len > prompts[i].reply->length)
+        allowed = prompts[i].reply->length;
+        if (allowed == 0 || len > allowed - 1)
             goto cleanup;

         /*
          * The trailing nul is not included in length, but other applications
          * expect it to be there.  Therefore, we copy one more byte than the
          * actual length of the password, but set length to just the length of
          * the password.
          */
         memcpy(prompts[i].reply->data, resp[pam_prompts].resp, len + 1);
         prompts[i].reply->length = (unsigned int) len;

license: mit


code:
From d4434c05e7c0cf05d87089404cfa2deedc60811a Mon Sep 17 00:00:00 2001
From: Ingo Franzki <ifranzki@linux.ibm.com>
Date: Mon, 29 Oct 2018 16:47:40 +0100
Subject: [PATCH] crypto: Add support for LUKS2

Cryptsetup version 2.0 added support for LUKS2.
This patch adds support for mounting LUKS2 volumes with
pam_mount.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
---
 src/crypto-dmc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/crypto-dmc.c b/src/crypto-dmc.c
index d0ab6ca..abd0358 100644
--- a/src/crypto-dmc.c
+++ b/src/crypto-dmc.c
@@ -21,6 +21,12 @@
 #include "libcryptmount.h"
 #include "pam_mount.h"

+#ifndef CRYPT_LUKS
+	#define CRYPT_LUKS	NULL /* Passing NULL to crypt_load will
+					default to LUKS(1) on older
+					libcryptsetup versions. */
+#endif
+
 /**
  * dmc_is_luks - check if @path points to a LUKS volume (cf. normal dm-crypt)
  * @path:	path to the crypto container
@@ -48,7 +54,7 @@ EXPORT_SYMBOL int ehd_is_luks(const char *path, bool blkdev)

 	ret = crypt_init(&cd, device);
 	if (ret == 0) {
-		ret = crypt_load(cd, CRYPT_LUKS1, NULL);
+		ret = crypt_load(cd, CRYPT_LUKS, NULL);
 		if (ret == -EINVAL)
 			ret = false;
 		else if (ret == 0)
@@ -106,7 +112,7 @@ static bool dmc_run(const struct ehd_mount_request *req,
 #endif
 	}

-	ret = crypt_load(cd, CRYPT_LUKS1, NULL);
+	ret = crypt_load(cd, CRYPT_LUKS, NULL);
 	if (ret == 0) {
 		ret = crypt_activate_by_passphrase(cd, mt->crypto_name,
 		      CRYPT_ANY_SLOT, req->key_data, req->key_size, flags);
--
2.21.0


code:
Skip Thai character test when libthai is unavailable.

Taken from upstream bug tracker:
https://gitlab.gnome.org/GNOME/pango/merge_requests/161
https://gitlab.gnome.org/GNOME/pango/commit/b73284747ac937e31dc9191f84ed6e24284c88ee

diff --git a/tests/test-break.c b/tests/test-break.c
index 8549b678bba69360d07dce3af21d915412f20d51..47fa3009165e19a331aa04a0df4351ae2323933b 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -305,6 +305,12 @@ main (int argc, char *argv[])
       if (!strstr (name, "break"))
         continue;

+#ifndef HAVE_LIBTHAI
+      /* four.break involves Thai, so only test it when we have libthai */
+      if (strstr (name, "four.break"))
+        continue;
+#endif
+
       path = g_strdup_printf ("/break/%s", name);
       g_test_add_data_func_full (path, g_test_build_filename (G_TEST_DIST, "breaks", name, NULL),
                                  test_break, g_free);


code:
See <http://lists.gnu.org/archive/html/bug-patch/2015-06/msg00009.html>

From 0507dfad5f060161f01840067e1bb1615257b636 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Mon, 8 Jun 2015 17:27:56 +0200
Subject: [PATCH] Do not rely on PATH_MAX when reading a symlink target.

* src/util.c (move_file, copy_file): Use 'fromst->st_size + 1' and
'tost->st_size + 1' for the allocation, and 'fromst->st_size' and
'tost->st_size' instead of PATH_MAX.  Fixes compilation on GNU/Hurd.
---
 src/util.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util.c b/src/util.c
index 1cc08ba..67dbd3a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -460,12 +460,12 @@ move_file (char const *from, bool *from_needs_removal,

 	  /* FROM contains the contents of the symlink we have patched; need
 	     to convert that back into a symlink. */
-	  char *buffer = xmalloc (PATH_MAX);
+	  char *buffer = xmalloc (fromst->st_size + 1);
 	  int fd, size = 0, i;

 	  if ((fd = safe_open (from, O_RDONLY | O_BINARY, 0)) < 0)
 	    pfatal ("Can't reopen file %s", quotearg (from));
-	  while ((i = read (fd, buffer + size, PATH_MAX - size)) > 0)
+	  while ((i = read (fd, buffer + size, fromst->st_size - size)) > 0)
 	    size += i;
 	  if (i != 0 || close (fd) != 0)
 	    read_fatal ();
@@ -610,10 +610,10 @@ copy_file (char const *from, char const *to, struct stat *tost,

   if (S_ISLNK (mode))
     {
-      char *buffer = xmalloc (PATH_MAX + 1);
+      char *buffer = xmalloc (tost->st_size + 1);
       ssize_t r;

-      if ((r = safe_readlink (from, buffer, PATH_MAX)) < 0)
+      if ((r = safe_readlink (from, buffer, tost->st_size)) < 0)
 	pfatal ("Can't read %s %s", "symbolic link", from);
       buffer[r] = '\0';
       if (safe_symlink (buffer, to) != 0)
--
2.16.2


code:
Need to mark one of the tests as PHONY to get permissions set correctly on
built scripts.

--- a/Makefile.in	2011-02-10 09:44:43.000000000 -0600
+++ b/Makefile.in	2018-11-29 21:52:05.000000000 -0600
@@ -1106,5 +1108,6 @@
 	rm -f $(DESTDIR)$(bindir)/"`echo lsdiff|sed '$(transform)'`"
 	rm -f $(DESTDIR)$(bindir)/"`echo grepdiff|sed '$(transform)'`"

+.PHONY: tests/newline1/run-test
 tests/newline1/run-test: src/combinediff$(EXEEXT) src/flipdiff$(EXEEXT) \
 		src/lsdiff$(EXEEXT) src/grepdiff$(EXEEXT) \
		scripts/splitdiff


code:
Add ability to detect GNU/Hurd when configuring.

Adapted from https://git.hadrons.org/cgit/debian/pkgs/pciutils.git/tree/debian/patches/00-configure-hurd.patch

From e39a3af22501234a91cf28e8c57b45f9379f9101 Mon Sep 17 00:00:00 2001
From: Damien Zammit <damien@zamaudio.com>
Date: Fri, 26 Oct 2018 09:24:04 -0400
Subject: [PATCH 2/2] Add ability to detect GNU/Hurd when configuring

---
 lib/configure |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/lib/configure
+++ b/lib/configure
@@ -25,7 +25,7 @@ if [ -z "$HOST" ] ; then
 		proc=`/usr/sbin/lsdev -C -c processor -S available -F name | head -1`
 		cpu=`/usr/sbin/lsattr -F value -l $proc -a type | sed 's/_.*//'`
 	else
-		cpu=`uname -m | sed 's/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
+		cpu=`uname -m | sed 's/^i.86-AT386/i386/;s/^i.86$/i386/;s/^sun4u$/sparc64/;s/^i86pc$/i386/;s/^BePC$/i386/;s/^BeMac$/powerpc/;s/^BeBox$/powerpc/'`
 	fi
 	if [ "$sys" = "DragonFly" ]
 	then
@@ -39,6 +39,10 @@ if [ -z "$HOST" ] ; then
 	then
 		sys=cygwin
 	fi
+	if [ "$sys" = "GNU" ]
+	then
+		sys=gnu
+	fi
 	HOST=${3:-$cpu-$sys}
 fi
 [ -n "$RELEASE" ] && rel="${RELEASE}"


code:
AutoSplit will fail to create an index for files whose modification time is 0
because its default time for a non-existent index is 1.  Set this default time
to -1 instead.

--- perl-5.16.1/cpan/AutoLoader/lib/AutoSplit.pm.orig	2012-02-14 22:44:36.000000000 -0600
+++ perl-5.16.1/cpan/AutoLoader/lib/AutoSplit.pm	2015-09-09 19:59:22.208708921 -0500
@@ -361,7 +361,7 @@
     my($al_idx_file) = catfile($autodir, $modpname, $IndexFile);

     if ($check_mod_time){
-	my($al_ts_time) = (stat("$al_idx_file"))[9] || 1;
+	my($al_ts_time) = (stat("$al_idx_file"))[9] || -1;
 	if ($al_ts_time >= $pm_mod_time and
 	    $al_ts_time >= $self_mod_time){
 	    print "AutoSplit skipped ($al_idx_file newer than $filename)\n"


code:
Submitted upstream.

From 4c3eb19a11dfe5c88c902481a8294c4f675fcd03 Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Sun, 19 Apr 2020 23:33:28 +0200
Subject: [PATCH] Support cross-compiling to the Hurd.

* cnf/hints/gnu: New file.
* cnf/configure_tool.sh: Guess it.
---
 cnf/configure_tool.sh |  4 ++++
 cnf/hints/gnu         | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 cnf/hints/gnu

diff --git a/cnf/configure_tool.sh b/cnf/configure_tool.sh
index 32201c0..7b0baa4 100644
--- a/cnf/configure_tool.sh
+++ b/cnf/configure_tool.sh
@@ -266,6 +266,10 @@ if not hinted 'osname'; then
 			define osname "bsd"
 			result "BSD"
 			;;
+		*-gnu*)
+			define osname "gnu"
+			result "GNU"
+			;;
 		*)
 			result "no"
 			;;
diff --git a/cnf/hints/gnu b/cnf/hints/gnu
new file mode 100644
index 0000000..a0583a2
--- /dev/null
+++ b/cnf/hints/gnu
@@ -0,0 +1,21 @@
+# Hurd syscalls
+d_voidsig='define'
+d_nanosleep='undef'
+d_clock_gettime='define'
+d_clock_getres='define'
+d_clock_nanosleep='define'
+d_clock='define'
+
+# From the original linux.sh
+usemallocwrap='define'
+
+# libraries to test
+libswanted='m crypt pthread nm ndbm gdbm dbm db dl gdbm_compat'
+
+d_procselfexe='undef'
+procselfexe='"undef"'
+
+st_ino_sign=1
+st_ino_size=8
+
+d_fcntl_can_lock='define'
--
2.26.0


code:
From <https://bugs.debian.org/801523>.

From c01f602d1926b0671fd2c8d91f7e52c4e4c9fb24 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sun, 11 Oct 2015 19:27:56 +0300
Subject: [PATCH] Sort the list of XS code files when generating RealPPPort.xs

all_files_in_dir() uses readdir() ordering to make the list of
input files. This can vary between build systems, breaking build
reproducibility.
---
 cpan/Devel-PPPort/PPPort_xs.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dist/Devel-PPPort/PPPort_xs.PL b/dist/Devel-PPPort/PPPort_xs.PL
index 5f18940..149f2fe 100644
--- a/dist/Devel-PPPort/PPPort_xs.PL
+++ b/dist/Devel-PPPort/PPPort_xs.PL
@@ -38,7 +38,7 @@ END
 my $file;
 my $sec;

-for $file (all_files_in_dir('parts/inc')) {
+for $file (sort(all_files_in_dir('parts/inc'))) {
   my $spec = parse_partspec($file);

   my $msg = 0;
--
2.5.1


code:
Rather than unconditionally using Mozilla's CA certificates, let the user tell
LWP's UserAgent where to find certificates with the PERL_LWP_SSL_CA_FILE,
HTTPS_CA_FILE, PERL_LWP_SSL_CA_PATH, or HTTPS_CA_DIR environment variables
instead.

--- Finance-Quote-1.37/lib/Finance/Quote/Tiaacref.pm.orig	2015-02-01 13:24:41.000000000 -0600
+++ Finance-Quote-1.37/lib/Finance/Quote/Tiaacref.pm	2015-07-07 20:09:47.278885944 -0500
@@ -30,7 +30,6 @@
 package Finance::Quote::Tiaacref;
 require 5.005;
 require LWP::Protocol::https;
-require Mozilla::CA;

 use strict;


code:
Work around a problem arising from the update to OpenSSL 1.0.2f, based on the
following upstream commit:

  https://github.com/noxxi/p5-io-socket-ssl/commit/6e23ee4a433f83f1065bd2467255eba5ee9b1ddd

Attempting to update to IO-Socket-SSL-2.023, which includes this commit,
caused other test failures.  See:

  https://lists.gnu.org/archive/html/guix-devel/2016-01/msg01032.html

Description from the upstream commit:

  OpenSSL 1.0.2f changed the behavior of SSL shutdown in case the TLS connection
  was not fully established (commit: f73c737c7ac908c5d6407c419769123392a3b0a9).
  This somehow resulted in Net::SSLeay::shutdown returning 0 (i.e. keep trying)
  which caused an endless loop. It will now ignore this result in case the TLS
  connection was not yet established and consider the TLS connection closed
  instead.

--- IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm.orig	2014-10-21 16:51:16.000000000 -0400
+++ IO-Socket-SSL-2.002/lib/IO/Socket/SSL.pm	2016-01-31 15:07:14.971099894 -0500
@@ -1213,6 +1213,11 @@
 		    # shutdown complete
 		    last;
 		}
+		if ((${*$self}{'_SSL_opened'}||0) <= 0) {
+		    # not really open, thus don't expect shutdown to return
+		    # something meaningful
+		    last;
+		}

 		# initiate or complete shutdown
 		local $SIG{PIPE} = 'IGNORE';


code:
Fix Perl module Module::Pluggable such that it can find plugins that live in
symlinked directories.

Patch borrowed/adapted from Nixpkgs.

--- Module-Pluggable-5.2/lib/Module/Pluggable/Object.pm   2015-04-08 23:28:48.120164135 -0500
+++ Module-Pluggable-5.2/lib/Module/Pluggable/Object.pm   2015-04-08 23:30:27.032166704 -0500
@@ -164,7 +164,7 @@
         my $sp = catdir($dir, (split /::/, $searchpath));

         # if it doesn't exist or it's not a dir then skip it
-        next unless ( -e $sp && -d _ ); # Use the cached stat the second time
+        next unless ( -e $sp );

         my @files = $self->find_files($sp);

@@ -279,7 +279,7 @@
                              (my $path = $File::Find::name) =~ s#^\\./##;
                              push @files, $path;
                            }
-                      }, $search_path );
+                      }, "$search_path/." );
     }
     #chdir $cwd;
     return @files;


code:
Patch borrowed from nixpkgs.  Works around warning message produced by the
current version of Moose:

"Passing a list of values to enum is deprecated. Enum values should be wrapped
in an arrayref."

--- Net-Amazon-S3-0.60/lib/Net/Amazon/S3/Client/Object.pm	2015-04-15 16:18:47.226410022 -0500
+++ Net-Amazon-S3-0.60/lib/Net/Amazon/S3/Client/Object.pm	2015-04-15 16:19:25.410408425 -0500
@@ -19,7 +19,7 @@
     [ qw(private public-read public-read-write authenticated-read) ];

 enum 'StorageClass' =>
-    qw(standard reduced_redundancy);
+    [ qw(standard reduced_redundancy) ];

 has 'client' =>
     ( is => 'ro', isa => 'Net::Amazon::S3::Client', required => 1 );


code:
perl-net-dns-resolver-programmable used the undocumented and internal
method Net::DNS::rcodesbyname [0], and that interface is no longer
exposed.

This patch, copied from [1], makes the program check for the existence
of the method before trying to use it.

[0]
<https://rt.cpan.org/Public/Bug/Display.html?id=95901>

[1]
<https://rt.cpan.org/Public/Bug/Display.html?id=95901#txn-1575108>

diff --git a/lib/Net/DNS/Resolver/Programmable.pm b/lib/Net/DNS/Resolver/Programmable.pm
index 1af72ce..e09a2f0 100644
--- a/lib/Net/DNS/Resolver/Programmable.pm
+++ b/lib/Net/DNS/Resolver/Programmable.pm
@@ -203,8 +203,10 @@ sub send {
     if (defined(my $resolver_code = $self->{resolver_code})) {
         ($result, $aa, @answer_rrs) = $resolver_code->($domain, $rr_type, $class);
     }
-
-    if (not defined($result) or defined($Net::DNS::rcodesbyname{$result})) {
+
+    if (not defined($result)
+         or defined($Net::DNS::Parameters::rcodebyname{$result})
+         or defined($Net::DNS::rcodesbyname{$result})) {
         # Valid RCODE, return a packet:

         $aa     = TRUE      if not defined($aa);


code:
Don't look for headers and libraries in "traditional" locations.

Patch adapted from Nixpkgs, originally by Eelco Dolstra
<eelco.dolstra@logicblox.com>.

diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
--- perl-5.20.0-orig/Configure	2014-05-26 15:34:18.000000000 +0200
+++ perl-5.20.0/Configure	2014-06-25 10:43:35.368285986 +0200
@@ -106,15 +106,7 @@
 fi

 : Proper PATH setting
-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
-paths="$paths /sbin /usr/sbin /usr/libexec"
-paths="$paths /system/gnu_library/bin"
+paths=''

 for p in $paths
 do
@@ -1337,8 +1329,7 @@
 archname=''
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+locincpth=""
 :
 : no include file wanted by default
 inclwanted=''
@@ -1349,17 +1340,12 @@

 libnames=''
 : change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
+xlibpth=''
 : Possible local library directories to search.
-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
+loclibpth=""

 : general looking path for locating libraries
-glibpth="/lib /usr/lib $xlibpth"
-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
-test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
-test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
+glibpth=""

 : Private path used by Configure to find libraries.  Its value
 : is prepended to libpth. This variable takes care of special
@@ -1391,8 +1377,6 @@
 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
 : We probably want to search /usr/shlib before most other libraries.
 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
-glibpth="/usr/shlib $glibpth"
 : Do not use vfork unless overridden by a hint file.
 usevfork=false

@@ -2446,7 +2430,6 @@
 zip
 "
 pth=`echo $PATH | sed -e "s/$p_/ /g"`
-pth="$pth $sysroot/lib $sysroot/usr/lib"
 for file in $loclist; do
 	eval xxx=\$$file
 	case "$xxx" in
@@ -4936,7 +4919,7 @@
 : Set private lib path
 case "$plibpth" in
 '') if ./mips; then
-	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
+	plibpth="$incpath/usr/lib"
     fi;;
 esac
 case "$libpth" in
@@ -8600,13 +8583,8 @@
 echo " "
 case "$sysman" in
 '')
-	syspath='/usr/share/man/man1 /usr/man/man1'
-	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
-	syspath="$syspath /usr/man/u_man/man1"
-	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
-	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
-	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
-	sysman=`./loc . /usr/man/man1 $syspath`
+	syspath=''
+	sysman=''
 	;;
 esac
 if $test -d "$sysman"; then
@@ -19900,9 +19878,10 @@
 case "$full_ar" in
 '') full_ar=$ar ;;
 esac
+full_ar=ar

 : Store the full pathname to the sed program for use in the C program
-full_sed=$sed
+full_sed=sed

 : see what type gids are declared as in the kernel
 echo " "
Only in perl-5.20.0/: Configure.orig
diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/ext/Errno/Errno_pm.PL perl-5.20.0/ext/Errno/Errno_pm.PL
--- perl-5.20.0-orig/ext/Errno/Errno_pm.PL	2014-05-26 15:34:20.000000000 +0200
+++ perl-5.20.0/ext/Errno/Errno_pm.PL	2014-06-25 10:31:24.317970047 +0200
@@ -114,7 +114,7 @@ sub get_files {
     # When cross-compiling we may store a path for gcc's "sysroot" option:
     my $sysroot = $Config{sysroot} || '';
     my $linux_errno_h;
-    if ($^O eq 'linux') {
+    if (0) {
 	# Some Linuxes have weird errno.hs which generate
 	# no #file or #line directives
 	($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" }
@@ -134,13 +134,6 @@ sub get_files {
 	if ($dep =~ /(\S+errno\.h)/) {
 	     $file{$1} = 1;
 	}
-    } elsif ($^O eq 'linux' &&
-	      $Config{gccversion} ne '' &&
-	      $Config{gccversion} !~ /intel/i &&
-	      # might be using, say, Intel's icc
-	      $linux_errno_h
-	     ) {
-	$file{$linux_errno_h} = 1;
     } elsif ($^O eq 'haiku') {
 	# hidden in a special place
 	$file{'/boot/develop/headers/posix/errno.h'} = 1;
diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/freebsd.sh
--- perl-5.20.0-orig/hints/freebsd.sh	2014-01-31 22:55:51.000000000 +0100
+++ perl-5.20.0/hints/freebsd.sh	2014-06-25 10:25:53.263964680 +0200
@@ -119,21 +119,21 @@
         objformat=`/usr/bin/objformat`
         if [ x$objformat = xaout ]; then
             if [ -e /usr/lib/aout ]; then
-                libpth="/usr/lib/aout /usr/local/lib /usr/lib"
-                glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
+                libpth=""
+                glibpth=""
             fi
             lddlflags='-Bshareable'
         else
-            libpth="/usr/lib /usr/local/lib"
-            glibpth="/usr/lib /usr/local/lib"
+            libpth=""
+            glibpth=""
             ldflags="-Wl,-E "
             lddlflags="-shared "
         fi
         cccdlflags='-DPIC -fPIC'
         ;;
 *)
-       libpth="/usr/lib /usr/local/lib"
-       glibpth="/usr/lib /usr/local/lib"
+       libpth=""
+       glibpth=""
        ldflags="-Wl,-E "
         lddlflags="-shared "
         cccdlflags='-DPIC -fPIC'
diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh
--- perl-5.20.0-orig/hints/linux.sh	2014-05-26 15:34:20.000000000 +0200
+++ perl-5.20.0/hints/linux.sh	2014-06-25 10:33:47.354883843 +0200
@@ -150,25 +150,6 @@
     ;;
 esac

-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
-# (such as -lm) in /lib or /usr/lib.  So we have to ask gcc to tell us
-# where to look.  We don't want gcc's own libraries, however, so we
-# filter those out.
-# This could be conditional on Unbuntu, but other distributions may
-# follow suit, and this scheme seems to work even on rather old gcc's.
-# This unconditionally uses gcc because even if the user is using another
-# compiler, we still need to find the math library and friends, and I don't
-# know how other compilers will cope with that situation.
-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
-# we don't want its libraries. So we try to prefer the system gcc
-# Still, as an escape hatch, allow Configure command line overrides to
-# plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
-    gcc=/usr/bin/gcc
-else
-    gcc=gcc
-fi
-
 case "$plibpth" in
 '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
 	cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
@@ -367,33 +322,6 @@
 	;;
 esac

-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
-# true libraries. The scripts cause binding against static
-# version of -lgdbm which is a bad idea. So if we have 'nm'
-# make sure it can read the file
-# NI-S 2003/08/07
-case "$nm" in
-    '') ;;
-    *)
-    for p in $plibpth
-    do
-        if $test -r $p/libndbm.so; then
-            if $nm $p/libndbm.so >/dev/null 2>&1 ; then
-                echo 'Your shared -lndbm seems to be a real library.'
-                _libndbm_real=1
-                break
-            fi
-        fi
-    done
-    if $test "X$_libndbm_real" = X; then
-        echo 'Your shared -lndbm is not a real library.'
-        set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
-        shift
-        libswanted="$*"
-    fi
-    ;;
-esac
-
 # Linux on Synology.
 if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
     # Tested on Synology DS213 and DS413
diff --git a/hints/linux.sh b/hints/linux.sh
index 3f38ea0..97aed11 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -195,32 +195,6 @@ case "$usequadmath" in
   ;;
 esac

-case "$libc" in
-'')
-# If you have glibc, then report the version for ./myconfig bug reporting.
-# (Configure doesn't need to know the specific version since it just uses
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
-    for p in $plibpth
-    do
-        for trylib in libc.so.6 libc.so
-        do
-            if $test -e $p/$trylib; then
-                libc=`ls -l $p/$trylib | awk '{print $NF}'`
-                if $test "X$libc" != X; then
-                    break
-                fi
-            fi
-        done
-        if $test "X$libc" != X; then
-            break
-        fi
-    done
-    ;;
-esac
-
 if ${sh:-/bin/sh} -c exit; then
   echo ''
   echo 'You appear to have a working bash.  Good.'


code:
Don't encode the current timestamp.

This affects the output of `perl -V`, specifically the message "Compiled
at [...]".

The 'cf_time' and 'cf_by' values show up in 'config.h' and
in 'Config_heavy.pl'.

Use the output of 'uname -s' instead of 'uname -a' to avoid recording
the kernel version ('uname -o' leads to directory names like
'x86_64-gnulinux' instead of 'x86_64-linux', which might cause breakage
down the road.)

diff --git a/perl.c b/perl.c
index 228a0d8..ed38313 100644
--- a/perl.c
+++ b/perl.c
@@ -1825,6 +1825,7 @@ S_Internals_V(pTHX_ CV *cv)
     PUSHs(Perl_newSVpvn_flags(aTHX_ non_bincompat_options,
 			      sizeof(non_bincompat_options) - 1, SVs_TEMP));

+#define PERL_BUILD_DATE "Jan  1 1970 00:00:00"
 #ifndef PERL_BUILD_DATE
 #  ifdef __DATE__
 #    ifdef __TIME__

--- a/Configure	1970-01-01 01:00:00.000000000 +0100
+++ b/Configure	2016-10-01 14:47:20.017319739 +0200
@@ -3276,7 +3276,7 @@ $eunicefix tr
 : Try to determine whether config.sh was made on this system
 case "$config_sh" in
 '')
-myuname=`$uname -a 2>/dev/null`
+myuname=`$uname -s 2>/dev/null`
 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
 # Downcase everything to avoid ambiguity.
 # Remove slashes and single quotes so we can use parts of this in
@@ -3845,10 +3845,10 @@
 . ./posthint.sh

 : who configured the system
-cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
+cf_time="1970-01-01"
 case "$cf_by" in
 "")
-	cf_by=`(logname) 2>/dev/null`
+	cf_by="guix"
 	case "$cf_by" in
 	"")
 		cf_by=`(whoami) 2>/dev/null`


code:
Description: Use the markdown library provided by the libmarkdown2 package.
Author: Alessandro Ghedini <al3xbio@gmail.com>
Origin: vendor
Forwarded: not-needed
Last-Update: 2012-01-01

--- a/Makefile.PL
+++ b/Makefile.PL
@@ -57,12 +57,6 @@

-sub MY::postamble {
-    return sprintf('
-$(MYEXTLIB):
-	%s
-', qq{( cd $extdir; CC='cc -fPIC' sh configure.sh; make )\n});
-}

 WriteMakefile(
     NAME              => 'Text::Markdown::Discount',
@@ -71,8 +65,6 @@
     ($] >= 5.005 ?
       (ABSTRACT_FROM  => 'lib/Text/Markdown/Discount.pm',
        AUTHOR         => 'Masayoshi Sekimura <sekimura@cpan.org>') : ()),
-    LIBS               => '-L' . $extdir,
-    INC               => '-I. -I' . $extdir,
-    MYEXTLIB          => $myextlib,
-    clean             => { FILES => $clean_files },
+    LIBS               => '-lmarkdown',
+    INC               => '-I.',
 );


code:
Fix build failure caused by erroneous use of an undeclared symbol.

Patch copied from upstream bug report:
https://rt.cpan.org/Public/Bug/Display.html?id=117793

From 0be0223422e6e5f4091c6e4e058d213623eed105 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 12 Sep 2016 14:40:44 +0200
Subject: [PATCH] Skip preprocessor symbol only CURL_STRICTER
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

CURL_STRICTER leaked into curl-constants.c when building against
curl-7.50.2. This is a preprocessor only macro without a value.

CPAN RT#117793

Signed-off-by: Petr Písař <ppisar@redhat.com>
---
 Makefile.PL | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index f9170bb..ad2bd3d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -127,7 +127,7 @@ if (!defined($curl_h)) {
     close H;

     for my $e (sort @syms) {
-       if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
+       if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|_LAST\z|_LASTENTRY\z)/) {
           next;
        }
        my ($group) = $e =~ m/^([^_]+_)/;
--
2.7.4


code:
https://sources.debian.org/data/main/p/picprog/1.9.1-3/debian/patches/20_iopl.patch

Description: Avoid some functions in some architectures
 Upstream uses iopl() function and other architecture-dependent
 codes. This patch adds building switches to avoid them in
 some architectures.
Author: Koichi Akabe <vbkaisetsu@gmail.com>
Last-Update: 2011-11-30

--- picprog-1.9.1.orig/picport.cc
+++ picprog-1.9.1/picport.cc
@@ -38,7 +38,12 @@
 #include <ctime>

 #include <sys/ioctl.h>
-#include <sys/io.h>
+
+#if defined(__i386__) || defined(__x86_64__)
+  #include <sys/io.h>
+  #define HAVE_IOPL
+#endif
+
 #include <fcntl.h>
 #include <sys/time.h>
 #include <unistd.h>
@@ -160,8 +165,12 @@
     // Not root.  Cannot use realtime scheduling.
     use_nanosleep = 0;
   }
+#ifdef HAVE_IOPL
   if (iopl (3))
     disable_interrupts = 0;
+#else
+  disable_interrupts = 0;
+#endif

 #ifdef CPU_SETSIZE
   // When computing the delay loops, we do not want the cpu's to change.
@@ -403,13 +412,17 @@
 {
   struct timeval tv1, tv2;
   gettimeofday (&tv1, 0);
+#if defined(__i386__) or defined(__x86_64__)
   if (tsc_1000ns > 1 && disable_interrupts)
     asm volatile("pushf; cli");
+#endif
   set_clock_data (1, b); // set data, clock up
   delay (cable_delay);
   set_clock_data (0, b); // clock down
+#if defined(__i386__) or defined(__x86_64__)
   if (tsc_1000ns > 1 && disable_interrupts)
     asm volatile("popf");
+#endif
   gettimeofday (&tv2, 0);

   // We may have spent a long time in an interrupt or in another task
@@ -428,13 +441,17 @@
 {
   struct timeval tv1, tv2;
   gettimeofday (&tv1, 0);
+#if defined(__i386__) or defined(__x86_64__)
   if (tsc_1000ns > 1 && disable_interrupts)
     asm volatile("pushf; cli");
+#endif
   set_clock_data (1, 1); // clock up
   delay (cable_delay);
   set_clock_data (0, 1); // set data up, clock down
+#if defined(__i386__) or defined(__x86_64__)
   if (tsc_1000ns > 1 && disable_interrupts)
     asm volatile("popf");
+#endif
   gettimeofday (&tv2, 0);

   // We may have spent a long time in an interrupt or in another task


code:
Support the PURPLE_PLUGIN_PATH environment variable.  This patch is based on
one from Nixpkgs, but properly handles the case where that variable is unset.

--- pidgin-2.10.11/libpurple/plugin.c.orig	2014-11-23 11:41:25.000000000 -0500
+++ pidgin-2.10.11/libpurple/plugin.c	2015-08-04 14:31:02.257366144 -0400
@@ -1178,8 +1178,19 @@
 void
 purple_plugins_init(void) {
 	void *handle = purple_plugins_get_handle();
+	const gchar *purple_plugin_path;

 	purple_plugins_add_search_path(LIBDIR);
+	purple_plugin_path = g_getenv("PURPLE_PLUGIN_PATH");
+	if (purple_plugin_path && *purple_plugin_path) {
+		gchar **paths = g_strsplit(purple_plugin_path, ":", -1);
+		if (paths) {
+			gchar **p;
+			for (p = paths; *p; ++p)
+				if (**p) purple_plugins_add_search_path(*p);
+		}
+		g_strfreev(paths);
+	}

 	purple_signal_register(handle, "plugin-load",
 						 purple_marshal_VOID__POINTER,


code:
From: Tobias Geerinckx-Rice <me@tobias.gr>
Date: Sun, 24 May 2020 16:11:01 +0200
Subject: [PATCH] gnu: pidgin: Find libnm.

Copied verbatim from[0].

[0]: https://git.archlinux.org/svntogit/packages.git/plain/trunk/pidgin-nm-1.0.patch?h=packages/pidgin

diff --git a/configure.ac b/configure.ac
index 04836fa..0a2d451 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1423,18 +1423,24 @@ fi
 dnl Check for NetworkManager.h; if we don't have it, oh well
 if test "x$enable_dbus" = "xyes" ; then
 	if test "x$enable_nm" = "xyes" ; then
-		PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [
+		PKG_CHECK_MODULES(NETWORKMANAGER, [libnm], [
 			AC_SUBST(NETWORKMANAGER_CFLAGS)
 			AC_SUBST(NETWORKMANAGER_LIBS)
 			AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.])
 		], [
-			enable_nm=no
-			if test "x$force_deps" = "xyes" ; then
-				AC_MSG_ERROR([
+			PKG_CHECK_MODULES(NETWORKMANAGER, [NetworkManager >= 0.5.0], [
+				AC_SUBST(NETWORKMANAGER_CFLAGS)
+				AC_SUBST(NETWORKMANAGER_LIBS)
+				AC_DEFINE(HAVE_NETWORKMANAGER, 1, [Define if we have NetworkManager.])
+			], [
+				enable_nm=no
+				if test "x$force_deps" = "xyes" ; then
+					AC_MSG_ERROR([
 NetworkManager development headers not found.
 Use --disable-nm if you do not need NetworkManager support.
 ])
-			fi])
+				fi])
+		])
 	fi
 else
 	enable_nm=no
diff --git a/libpurple/network.c b/libpurple/network.c
index c43e3c7..b17e439 100644
--- a/libpurple/network.c
+++ b/libpurple/network.c
@@ -939,8 +939,13 @@ nm_update_state(NMState state)
 #if NM_CHECK_VERSION(0,8,992)
 		case NM_STATE_DISCONNECTING:
 #endif
+#if NM_CHECK_VERSION(1,0,0)
+			if (prev != NM_STATE_CONNECTED_GLOBAL && prev != NM_STATE_UNKNOWN)
+				break;
+#else
 			if (prev != NM_STATE_CONNECTED && prev != NM_STATE_UNKNOWN)
 				break;
+#endif
 			if (ui_ops != NULL && ui_ops->network_disconnected != NULL)
 				ui_ops->network_disconnected();
 			break;


code:
Description: Add missing inlcudes of cstddef, fixing FTBFS13.1
Author: Regis Boudin <regis@debian.org>
Bug-Debian: http://bugs.debian.org/624953
Bug-Debian: http://bugs.debian.org/640726

--- pinball-0.3.1/base/Behavior.cpp
+++ pinball-0.3.1/base/Behavior.cpp
@@ -10,6 +10,8 @@
 #include "Behavior.h"
 #include "Group.h"

+#include <cstddef>
+
 Behavior::Behavior() {
 	//EM_COUT("Behavior::Behavior", 1);
 	p_Light = NULL;
--- pinball-0.3.1/base/SignalSender.cpp
+++ pinball-0.3.1/base/SignalSender.cpp
@@ -12,6 +12,8 @@
 #include "Group.h"
 #include "Behavior.h"

+#include <cstddef>
+
 SignalSender * SignalSender::p_SignalSender = NULL;

 SignalSender::SignalSender() {
--- pinball-0.3.1/base/BehaviorVisitor.cpp
+++ pinball-0.3.1/base/BehaviorVisitor.cpp
@@ -10,6 +10,8 @@
 #include "Behavior.h"
 #include "Group.h"

+#include <cstddef>
+
 BehaviorVisitor * BehaviorVisitor::p_BehaviorVisitor = NULL;

 BehaviorVisitor::BehaviorVisitor() {


code:
From: Markus Koschany <apo@gambaru.de>
Date: Sun, 3 Aug 2014 22:50:46 +0200
Subject: missing separators

Bug: https://bugs.debian.org/750082

---
 src/Makefile.am  | 14 +++++++-------
 src/Makefile.in  | 14 +++++++-------
 test/Makefile.am |  2 +-
 test/Makefile.in |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index fbd7e8f..96768d3 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -29,7 +29,7 @@ Script.cpp \
 StateBehavior.cpp \
 Table.cpp

-dnl libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES)
+# libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES)

 pininclude_HEADERS = \
 ArmBehavior.h \
@@ -56,10 +56,10 @@ Table.h
 # libemilia_pin.a libemilia_addon.a  libemilia_base.a libltdlc.a
 wpinball.exe:  ${pinball_OBJECTS} ${pinball_DEPENDENCIES}
 	${GCCLOCALDIR}g++ -g -W -Wall -O2 -o$@ $^ \
- -lSDL_mixer -lvorbisfile -lvorbis -logg -lsmpeg \
- -lSDL_image -lSDLmain -lSDL \
- -lglu32 -lopengl32 -ljpeg -lpng  \
- -lwinmm -luser32 -lgdi32 -ldxguid   \
- -lmingw32 -lSDLmain -lSDL  -mwindows \
- -L${GCCLOCALDIR}../lib
+	-lSDL_mixer -lvorbisfile -lvorbis -logg -lsmpeg \
+	-lSDL_image -lSDLmain -lSDL \
+	-lglu32 -lopengl32 -ljpeg -lpng \
+	-lwinmm -luser32 -lgdi32 -ldxguid \
+	-lmingw32 -lSDLmain -lSDL  -mwindows \
+	-L${GCCLOCALDIR}../lib
 # !-rzr : # have to solve it later # -lstdc++
diff --git a/src/Makefile.in b/src/Makefile.in
index ea7651b..8e95cd6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -505,7 +505,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am \
 	uninstall-pinincludeHEADERS uninstall-pinlibLIBRARIES

-dnl libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES)
+	dnl libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES)

 # !+rzr : This trick workaround a bad generated rule (under Linux mingw32)
 # src/ litool returns:  -L/usr/local//lib /usr/lib/libjpeg.so
@@ -514,12 +514,12 @@ dnl libemilia_pin_la_SOURCES = $(libemilia_pin_a_SOURCES)
 # libemilia_pin.a libemilia_addon.a  libemilia_base.a libltdlc.a
 wpinball.exe:  ${pinball_OBJECTS} ${pinball_DEPENDENCIES}
 	${GCCLOCALDIR}g++ -g -W -Wall -O2 -o$@ $^ \
- -lSDL_mixer -lvorbisfile -lvorbis -logg -lsmpeg \
- -lSDL_image -lSDLmain -lSDL \
- -lglu32 -lopengl32 -ljpeg -lpng  \
- -lwinmm -luser32 -lgdi32 -ldxguid   \
- -lmingw32 -lSDLmain -lSDL  -mwindows \
- -L${GCCLOCALDIR}../lib
+	-lSDL_mixer -lvorbisfile -lvorbis -logg -lsmpeg \
+	-lSDL_image -lSDLmain -lSDL \
+	-lglu32 -lopengl32 -ljpeg -lpng \
+	-lwinmm -luser32 -lgdi32 -ldxguid \
+	-lmingw32 -lSDLmain -lSDL  -mwindows \
+	-L${GCCLOCALDIR}../lib
 # !-rzr : # have to solve it later # -lstdc++
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/test/Makefile.am b/test/Makefile.am
index d87cf34..ea3ffc9 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -4,7 +4,7 @@ testlibdir = $(EM_LIBDIR)
 testdatadir = $(pkgdatadir)

 noinst_PROGRAMS = scale simple light texture load explode collision signal billboard font thread menu joy sound trans math misc varray unittest
-dnl noinst_PROGRAMS = unittest
+# noinst_PROGRAMS = unittest

 INCLUDES = -I../base -I../addon -I../src @INCLTDL@
 LDADD = ../src/libemilia_pin.a ../addon/libemilia_addon.a ../base/libemilia_base.a @LIBLTDL@
diff --git a/test/Makefile.in b/test/Makefile.in
index 6ba2646..47654dc 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -621,7 +621,7 @@ uninstall-am: uninstall-info-am uninstall-testlibLTLIBRARIES
 	mostlyclean-generic mostlyclean-libtool tags uninstall \
 	uninstall-am uninstall-info-am uninstall-testlibLTLIBRARIES

-dnl noinst_PROGRAMS = unittest
+# noinst_PROGRAMS = unittest
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:


code:
Fixes error during make:

"No rule to make target '../src/libemilia_pin.a', needed by 'pinball'.  Stop."

--- pinball-0.3.1/src/Makefile.in	2003-12-10 05:34:47.000000000 -0600
+++ pinball-0.3.1/src/Makefile.in	2016-01-31 22:29:13.134519889 -0600
@@ -116,7 +116,7 @@

 INCLUDES = -I../base -I../addon @INCLTDL@

-pinball_LDADD = ../src/libemilia_pin.a ../addon/libemilia_addon.a ../base/libemilia_base.a @LIBLTDL@
+pinball_LDADD = libemilia_pin.a ../addon/libemilia_addon.a ../base/libemilia_base.a @LIBLTDL@
 pinball_LDFLAGS = -export-dynamic

 pinball_SOURCES = Pinball.cpp
@@ -174,7 +174,7 @@

 am_pinball_OBJECTS = Pinball.$(OBJEXT)
 pinball_OBJECTS = $(am_pinball_OBJECTS)
-pinball_DEPENDENCIES = ../src/libemilia_pin.a ../addon/libemilia_addon.a \
+pinball_DEPENDENCIES = libemilia_pin.a ../addon/libemilia_addon.a \
 	../base/libemilia_base.a

 DEFS = @DEFS@


code:
--- pinball-0.3.1/configure.ac	2010-01-14 17:26:25.000000000 +0100
+++ pinball-0.3.1/configure.ac	2010-01-14 17:26:25.000000000 +0100
@@ -22,14 +22,12 @@
 [  --with-cxxflags=CXXFLAGS        use CXXFLAGS as compile time arguments.],
     [CXXFLAGS=$with_cxxflags; export CXXFLAGS])

-AC_CONFIG_SUBDIRS(libltdl)
-
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_INSTALL
 AC_LIBTOOL_DLOPEN
-AC_LIBLTDL_CONVENIENCE
+LTDL_INIT
 AC_PROG_LIBTOOL

 AC_SUBST(INCLTDL)


code:
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=pinentry.git;a=commit;h=948105b7a34ec9a9e5479d376b7c86bafee50a01
This patch can be removed with the next release of pinentry.

From 948105b7a34ec9a9e5479d376b7c86bafee50a01 Mon Sep 17 00:00:00 2001
From: "William L. Thomson Jr" <wlt@o-sinc.com>
Date: Tue, 29 May 2018 22:50:47 +0100
Subject: [PATCH] efl: Add an EFL-based pinentry.

* NEWS: Update.
* Makefile.am: Add new efl subdirectory.
* configure.ac: Add --enable-pinentry-efl option.
* efl/Makefile.am: New file.
* efl/pinentry-efl.c: New file.

Signed-off-by: Damien Goutte-Gattat <dgouttegattat@incenp.org>
---
 Makefile.am        |   8 +-
 configure.ac       |  44 +++-
 efl/Makefile.am    |  38 ++++
 efl/pinentry-efl.c | 623 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 716 insertions(+), 2 deletions(-)
 create mode 100644 efl/Makefile.am
 create mode 100644 efl/pinentry-efl.c

diff --git a/Makefile.am b/Makefile.am
index 8c8b8e5..b8fd0e1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -82,10 +82,16 @@ else
 pinentry_fltk =
 endif

+if BUILD_PINENTRY_EFL
+pinentry_efl = efl
+else
+pinentry_efl =
+endif
+
 SUBDIRS = m4 secmem pinentry ${pinentry_curses} ${pinentry_tty} \
 	${pinentry_emacs} ${pinentry_gtk_2} ${pinentry_gnome_3} \
 	${pinentry_qt} ${pinentry_tqt} ${pinentry_w32} \
-	${pinentry_fltk} doc
+	${pinentry_fltk} ${pinentry_efl} doc

 install-exec-local:
diff --git a/configure.ac b/configure.ac
index ff6c2e0..e305e44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -419,6 +419,42 @@ fi

 dnl
+dnl Check for EFL pinentry programs.
+dnl
+AC_ARG_ENABLE(pinentry-efl,
+            AC_HELP_STRING([--enable-pinentry-efl], [build EFL pinentry]),
+            pinentry_efl=$enableval, pinentry_efl=maybe)
+
+dnl check for pkg-config
+if test "$pinentry_efl" != "no"; then
+	AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+	if test x"${PKG_CONFIG}" = xno ; then
+		pinentry_efl=no
+	fi
+fi
+
+if test "$pinentry_efl" != "no"; then
+	AC_MSG_CHECKING([for efl])
+	"${PKG_CONFIG}" --exists 'elementary >= 1.18'
+	if test $? -ne 0 ; then
+		AC_MSG_RESULT([no])
+		AC_MSG_WARN([efl >= 1.18 is required for efl pinentry])
+		pinentry_efl=no
+	else
+		AC_MSG_RESULT([yes])
+		EFL_CFLAGS=`"${PKG_CONFIG}" --cflags ecore-x elementary`
+		EFL_LIBS=`"${PKG_CONFIG}" --libs ecore-x elementary`
+		AC_SUBST(EFL_CFLAGS)
+		AC_SUBST(EFL_LIBS)
+		if test "$pinentry_efl" != "no"
+		then
+			pinentry_efl=yes
+		fi
+	fi
+fi
+AM_CONDITIONAL(BUILD_PINENTRY_EFL, test "$pinentry_efl" = "yes")
+
+dnl
 dnl Check for GTK+-2 / GNOME3 pinentry programs.
 dnl
 AC_ARG_ENABLE(pinentry-gtk2,
@@ -645,7 +681,11 @@ else
               if test "$pinentry_tqt" = "yes"; then
                 PINENTRY_DEFAULT=pinentry-tqt
               else
-                AC_MSG_ERROR([[No pinentry enabled.]])
+                if test "$pinentry_efl" = "yes"; then
+                  PINENTRY_DEFAULT=pinentry-efl
+                else
+                  AC_MSG_ERROR([[No pinentry enabled.]])
+                fi
               fi
             fi
           fi
@@ -721,6 +761,7 @@ secmem/Makefile
 pinentry/Makefile
 curses/Makefile
 tty/Makefile
+efl/Makefile
 emacs/Makefile
 gtk+-2/Makefile
 gnome3/Makefile
@@ -744,6 +785,7 @@ AC_MSG_NOTICE([
 	Curses Pinentry ..: $pinentry_curses
 	TTY Pinentry .....: $pinentry_tty
 	Emacs Pinentry ...: $pinentry_emacs
+	EFL Pinentry .....: $pinentry_efl
 	GTK+-2 Pinentry ..: $pinentry_gtk_2
 	GNOME 3 Pinentry .: $pinentry_gnome_3
 	Qt Pinentry ......: $pinentry_qt $pinentry_qt_lib_version
diff --git a/efl/Makefile.am b/efl/Makefile.am
new file mode 100644
index 0000000..b986a04
--- /dev/null
+++ b/efl/Makefile.am
@@ -0,0 +1,38 @@
+# Makefile.am - PIN entry EFL frontend.
+# Copyright (C) 2017 Obsidian-Studios, Inc.
+# Author William L. Thomson Jr. <wlt@o-sinc.com>
+#
+# This file is part of PINENTRY.
+#
+# PINENTRY is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PINENTRY is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+
+## Process this file with automake to produce Makefile.in
+
+bin_PROGRAMS = pinentry-efl
+
+if FALLBACK_CURSES
+ncurses_include = $(NCURSES_INCLUDE)
+libcurses = ../pinentry/libpinentry-curses.a $(LIBCURSES) $(LIBICONV)
+else
+ncurses_include =
+libcurses =
+endif
+
+AM_CPPFLAGS = $(COMMON_CFLAGS) $(EFL_CFLAGS) $(ncurses_include) \
+	-I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
+LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \
+	$(COMMON_LIBS) $(LIBCAP) $(EFL_LIBS) $(libcurses)
+
+pinentry_efl_SOURCES = pinentry-efl.c
diff --git a/efl/pinentry-efl.c b/efl/pinentry-efl.c
new file mode 100644
index 0000000..ca99693
--- /dev/null
+++ b/efl/pinentry-efl.c
@@ -0,0 +1,623 @@
+/* pinentry-efl.c
+   Copyright (C) 2017 Obsidian-Studios, Inc.
+     Author William L. Thomson Jr. <wlt@o-sinc.com>
+
+   Based on pinentry-gtk2.c
+   Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
+   Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
+   Copyright (C) 2004 by Albrecht DreÃ <albrecht.dress@arcor.de>
+
+   pinentry-efl is a pinentry application for the EFL widget set.
+   It tries to follow the Gnome Human Interface Guide as close as
+   possible.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <Elementary.h>
+#include <Ecore_X.h>
+#include <gpg-error.h>
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#endif
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+#pragma GCC diagnostic pop
+#endif
+
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+#include "getopt.h"
+#endif /* HAVE_GETOPT_H */
+
+#include "pinentry.h"
+
+#ifdef FALLBACK_CURSES
+#include "pinentry-curses.h"
+#endif
+
+#define PGMNAME "pinentry-efl"
+
+#ifndef VERSION
+#define VERSION
+#endif
+
+#define ENTRY_HIDE "Hide entry"
+#define ENTRY_SHOW "Show entry"
+
+typedef enum { CONFIRM_CANCEL, CONFIRM_OK, CONFIRM_NOTOK } confirm_value_t;
+
+static const int WIDTH = 480;
+static const int BUTTON_HEIGHT = 27;
+static const int BUTTON_WIDTH = 70;
+static const int BUTTON_ICON_SIZE = 13;
+static const int PADDING = 5;
+
+static Eina_Bool got_input;
+static Ecore_Timer *timer;
+static Evas_Object *check_label;
+static Evas_Object *error_label;
+static Evas_Object *entry;
+static Evas_Object *repeat_entry;
+static Evas_Object *qualitybar;
+static Evas_Object *win;
+static char **pargv;
+static int grab_failed;
+static int passphrase_ok;
+static int confirm_mode;
+static int pargc;
+static confirm_value_t confirm_value;
+static pinentry_t pinentry;
+
+pinentry_cmd_handler_t pinentry_cmd_handler;
+
+static void
+quit (void)
+{
+  evas_object_del(win);
+  elm_exit();
+  ecore_main_loop_quit ();
+}
+
+static void
+delete_event (void *data EINA_UNUSED,
+              Evas_Object *obj EINA_UNUSED,
+              void *event EINA_UNUSED)
+{
+  pinentry->close_button = 1;
+  quit ();
+}
+
+static void
+changed_text_handler (void *data EINA_UNUSED,
+                      Evas_Object *obj,
+                      void *event EINA_UNUSED)
+{
+  const char *s;
+  int length;
+  int percent;
+
+  got_input = EINA_TRUE;
+
+  if (pinentry->repeat_passphrase && repeat_entry)
+    {
+      elm_object_text_set (repeat_entry, "");
+      elm_object_text_set (error_label, "");
+    }
+
+  if (!qualitybar || !pinentry->quality_bar)
+    return;
+
+  s = elm_object_text_get (obj);
+  if (!s)
+    s = "";
+  length = strlen (s);
+  percent = length? pinentry_inq_quality (pinentry, s, length) : 0;
+  evas_object_color_set(qualitybar,
+                        255 - ( 2.55 * percent ),
+                        2.55 * percent, 0, 255);
+  elm_progressbar_value_set (qualitybar, (double) percent / 100.0);
+}
+
+static void
+on_check (void *data EINA_UNUSED, Evas_Object *obj, void *event EINA_UNUSED)
+{
+  if(elm_check_state_get(obj))
+    {
+        elm_entry_password_set(entry, EINA_FALSE);
+        elm_object_text_set(check_label,ENTRY_HIDE);
+    }
+  else
+    {
+        elm_entry_password_set(entry, EINA_TRUE);
+        elm_object_text_set(check_label,ENTRY_SHOW);
+    }
+  evas_object_size_hint_min_set(check_label,
+                                ELM_SCALE_SIZE(BUTTON_WIDTH),
+                                ELM_SCALE_SIZE(BUTTON_HEIGHT));
+  evas_object_size_hint_align_set(check_label, 0, 1);
+}
+
+static void
+on_click (void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
+{
+  if (confirm_mode)
+    {
+      confirm_value = (confirm_value_t) data;
+      quit ();
+      return;
+    }
+
+  if (data)
+    {
+      const char *s;
+      const char *s2;
+
+      s = elm_entry_entry_get (entry);
+      if (!s)
+	s = "";
+
+      if (pinentry->repeat_passphrase && repeat_entry)
+	{
+	  s2 = elm_entry_entry_get (repeat_entry);
+	  if (!s2)
+	    s2 = "";
+	  if (strcmp (s, s2))
+	    {
+              elm_object_text_set(error_label,
+                                  pinentry->repeat_error_string?
+                                  pinentry->repeat_error_string:
+				   "not correctly repeated");
+              elm_object_focus_set(entry,EINA_TRUE);
+              return;
+	    }
+	  pinentry->repeat_okay = 1;
+	}
+
+      passphrase_ok = 1;
+      pinentry_setbufferlen (pinentry, strlen (s) + 1);
+      if (pinentry->pin)
+	strncpy (pinentry->pin, s, strlen(s) + 1);
+    }
+  quit ();
+}
+
+static void
+enter_callback (void *data, Evas_Object * obj, void *event_info EINA_UNUSED)
+{
+  if (data)
+    elm_object_focus_set (data, 1);
+  else
+    on_click ((void *) CONFIRM_OK, obj, NULL);
+}
+
+static Eina_Bool
+timeout_cb (const void * data)
+{
+  pinentry_t pe = (pinentry_t)data;
+  if (!got_input)
+    {
+      ecore_main_loop_quit();
+      if (pe)
+        pe->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+    }
+
+  timer = NULL;
+  return ECORE_CALLBACK_DONE;
+}
+
+static void
+create_window (void)
+{
+  char *txt;
+  Evas_Object *icon;
+  Evas_Object *obj;
+  Evas_Object *table;
+  int btn_txt_len = 0;
+  int row = 0;
+  int ok_len = 0;
+
+  win = elm_win_util_dialog_add(NULL,"pinentry","enter pin");
+  elm_win_autodel_set(win, EINA_TRUE);
+  elm_win_center(win,EINA_TRUE,EINA_TRUE);
+  evas_object_smart_callback_add(win, "delete,request", delete_event, NULL);
+
+  table = elm_table_add(win);
+  elm_table_padding_set(table,ELM_SCALE_SIZE(PADDING),0);
+  evas_object_size_hint_padding_set (table,
+                                     ELM_SCALE_SIZE(PADDING),
+                                     ELM_SCALE_SIZE(PADDING),
+                                     ELM_SCALE_SIZE(PADDING),
+                                     ELM_SCALE_SIZE(PADDING));
+  evas_object_show(table);
+
+  if (pinentry->title)
+    {
+      txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+                                    pinentry->title);
+      elm_win_title_set ( win, txt );
+      free (txt);
+    }
+
+  /* Description Label */
+  if (pinentry->description)
+    {
+      char* aligned;
+      int len;
+
+      obj = elm_label_add(table);
+      elm_label_line_wrap_set (obj, ELM_WRAP_WORD);
+      txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->description);
+      len = strlen(txt)+20; // 20 chars for align tag
+      aligned = calloc(len+1,sizeof(char));
+      if(aligned)
+        {
+          snprintf(aligned,len, "<align=left>%s</align>",txt);
+          elm_object_text_set(obj,aligned);
+          free (aligned);
+        } else
+          elm_object_text_set(obj,txt);
+      free (txt);
+      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
+      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
+      elm_table_pack(table, obj, 1, row, 5, 1);
+      evas_object_show(obj);
+      row++;
+    }
+  if (!confirm_mode && (pinentry->error || pinentry->repeat_passphrase))
+    {
+    /* Error Label */
+    if (pinentry->error)
+        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->error);
+      else
+        txt = "";
+      obj = elm_label_add(table);
+      evas_object_color_set(obj, 255, 0, 0, 255);
+      elm_object_text_set(obj,txt);
+      elm_object_style_set(obj,"slide_bounce");
+      elm_label_slide_duration_set(obj, 10);
+      elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
+      elm_label_slide_go(obj);
+      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, 0);
+      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0);
+      elm_table_pack(table, obj, 1, row, 5, 1);
+      evas_object_show(obj);
+      if (pinentry->error)
+        free (txt);
+      row++;
+    }
+
+  qualitybar = NULL;
+
+  if (!confirm_mode)
+    {
+
+    if (pinentry->prompt)
+      {
+        /* Entry/Prompt Label */
+        obj = elm_label_add(table);
+        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->prompt);
+        elm_object_text_set(obj,txt);
+        free (txt);
+        evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+        evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+        elm_table_pack(table, obj, 1, row, 1, 1);
+        evas_object_show(obj);
+      }
+
+      entry = elm_entry_add(table);
+      elm_entry_scrollable_set(entry, EINA_TRUE);
+      elm_scroller_policy_set(entry,
+                              ELM_SCROLLER_POLICY_OFF,
+                              ELM_SCROLLER_POLICY_OFF);
+      elm_entry_password_set(entry, EINA_TRUE);
+      elm_entry_single_line_set(entry, EINA_TRUE);
+      evas_object_size_hint_weight_set(entry, 0, 0);
+      evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0);
+      elm_table_pack(table, entry, 2, row, 4, 1);
+      evas_object_smart_callback_add(entry,
+                                     "changed",
+                                     changed_text_handler,
+                                     NULL);
+      evas_object_show(entry);
+      row++;
+
+      /* Check box */
+      obj = elm_check_add(table);
+      evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+      elm_table_pack(table, obj, 1, row, 1, 1);
+      evas_object_smart_callback_add(obj, "changed", on_check, NULL);
+      evas_object_show(obj);
+
+      /* Check Label */
+      check_label = elm_label_add(table);
+      on_check((void *)NULL, obj, (void *)NULL);
+      elm_table_pack(table, check_label, 2, row, 4, 1);
+      evas_object_show(check_label);
+      row++;
+
+      if (pinentry->quality_bar)
+	{
+          /* Quality Bar Label */
+	  obj = elm_label_add(table);
+          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+                                        pinentry->quality_bar);
+          elm_object_text_set(obj,txt);
+          free (txt);
+          evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+          evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+          elm_table_pack(table, obj, 1, row, 1, 1);
+          evas_object_show(obj);
+
+	  qualitybar = elm_progressbar_add(table);
+          evas_object_color_set(qualitybar, 255, 0, 0, 255);
+          evas_object_show(qualitybar);
+          if (pinentry->quality_bar_tt)
+	    elm_object_tooltip_text_set (qualitybar,
+					 pinentry->quality_bar_tt);
+          evas_object_size_hint_weight_set(qualitybar, EVAS_HINT_EXPAND, 0);
+          evas_object_size_hint_align_set(qualitybar, EVAS_HINT_FILL, 0);
+          elm_table_pack(table, qualitybar, 2, row, 4, 1);
+          row++;
+	}
+
+      if (pinentry->repeat_passphrase)
+        {
+          /* Repeat Label */
+	  obj = elm_label_add(table);
+          txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+                                        pinentry->repeat_passphrase);
+          elm_object_text_set(obj,txt);
+          free (txt);
+          evas_object_size_hint_weight_set(obj, 0, EVAS_HINT_EXPAND);
+          evas_object_size_hint_align_set(obj, 1, EVAS_HINT_FILL);
+          elm_table_pack(table, obj, 1, row, 1, 1);
+          evas_object_show(obj);
+
+          repeat_entry = elm_entry_add(table);
+          elm_entry_scrollable_set(repeat_entry, EINA_TRUE);
+          elm_scroller_policy_set(repeat_entry,
+                                  ELM_SCROLLER_POLICY_OFF,
+                                  ELM_SCROLLER_POLICY_OFF);
+          elm_entry_password_set(repeat_entry, EINA_TRUE);
+          elm_entry_single_line_set(repeat_entry, EINA_TRUE);
+          evas_object_size_hint_weight_set(repeat_entry, 0, 0);
+          evas_object_size_hint_align_set(repeat_entry, EVAS_HINT_FILL, 0);
+          elm_table_pack(table, repeat_entry, 2, row, 4, 1);
+	  evas_object_smart_callback_add (repeat_entry, "activated",
+					  enter_callback, NULL);
+          evas_object_show(repeat_entry);
+          evas_object_smart_callback_add (entry,
+                                          "activated",
+                                          enter_callback,
+                                          repeat_entry);
+          evas_object_smart_callback_add(repeat_entry,
+                                         "activated",
+                                         on_click,
+                                         (void *) CONFIRM_OK);
+          row++;
+        }
+      else
+        evas_object_smart_callback_add(entry,
+                                       "activated",
+                                       on_click,
+                                       (void *) CONFIRM_OK);
+  }
+
+  /* Cancel Button */
+  if (!pinentry->one_button)
+    {
+      obj = elm_button_add(table);
+      icon = elm_icon_add (table);
+      evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+      if (elm_icon_standard_set (icon, "dialog-cancel") ||
+          elm_icon_standard_set (icon, "window-close"))
+        {
+          evas_object_size_hint_min_set(icon,
+                                        ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
+                                        ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
+          elm_object_part_content_set(obj, "icon", icon);
+          evas_object_show (icon);
+        }
+      else
+        evas_object_del(icon);
+      if (pinentry->cancel || pinentry->default_cancel)
+        {
+          if(pinentry->cancel)
+            txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->cancel);
+          else
+            txt = pinentry_utf8_to_local (pinentry->lc_ctype,
+                                          pinentry->default_cancel);
+          if(txt[0]=='_')
+            elm_object_text_set(obj,txt+1);
+          else
+            elm_object_text_set(obj,txt);
+          btn_txt_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
+          free (txt);
+        }
+      else
+        elm_object_text_set(obj, "Cancel"); //STOCK_CANCEL
+      evas_object_size_hint_align_set(obj, 0, 0);
+      if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
+        evas_object_size_hint_min_set(obj,
+                                      btn_txt_len,
+                                      ELM_SCALE_SIZE(BUTTON_HEIGHT));
+      else
+        evas_object_size_hint_min_set(obj,
+                                      ELM_SCALE_SIZE(BUTTON_WIDTH),
+                                      ELM_SCALE_SIZE(BUTTON_HEIGHT));
+      elm_table_pack(table, obj, 4, row, 1, 1);
+      evas_object_smart_callback_add(obj,
+                                     "clicked",
+                                     on_click,
+                                     (void *) CONFIRM_CANCEL);
+      evas_object_show(obj);
+    }
+
+  /* OK Button */
+  obj = elm_button_add(table);
+  icon = elm_icon_add (table);
+  evas_object_size_hint_aspect_set (icon, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+  if (elm_icon_standard_set (icon, "dialog-ok") ||
+      elm_icon_standard_set (icon, "list-add"))
+    {
+      evas_object_size_hint_min_set(icon,
+                                    ELM_SCALE_SIZE(BUTTON_ICON_SIZE),
+                                    ELM_SCALE_SIZE(BUTTON_ICON_SIZE));
+      elm_object_part_content_set(obj, "icon", icon);
+      evas_object_show (icon);
+    }
+  else
+    evas_object_del(icon);
+  if (pinentry->ok || pinentry->default_ok)
+    {
+      if(pinentry->ok)
+        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->ok);
+      else
+        txt = pinentry_utf8_to_local (pinentry->lc_ctype, pinentry->default_ok);
+      if(txt[0]=='_')
+        elm_object_text_set(obj,txt+1);
+      else
+        elm_object_text_set(obj,txt);
+      ok_len = ELM_SCALE_SIZE(strlen(txt) * (PADDING * 1.5));
+      if(ok_len>btn_txt_len)
+        btn_txt_len = ok_len;
+      free (txt);
+    }
+  else
+    elm_object_text_set(obj,"OK"); //STOCK_OK
+  evas_object_size_hint_align_set(obj, 0, 0);
+  if(btn_txt_len>ELM_SCALE_SIZE(BUTTON_WIDTH))
+    evas_object_size_hint_min_set(obj,
+                                  btn_txt_len,
+                                  ELM_SCALE_SIZE(BUTTON_HEIGHT));
+  else
+    evas_object_size_hint_min_set(obj,
+                                  ELM_SCALE_SIZE(BUTTON_WIDTH),
+                                  ELM_SCALE_SIZE(BUTTON_HEIGHT));
+  elm_table_pack(table, obj, 5, row, 1, 1);
+  evas_object_smart_callback_add(obj, "clicked", on_click, (void *) CONFIRM_OK);
+  evas_object_show(obj);
+
+  /* Key/Lock Icon */
+  obj = elm_icon_add (win);
+  evas_object_size_hint_aspect_set (obj, EVAS_ASPECT_CONTROL_BOTH, 1, 1);
+  if (elm_icon_standard_set (obj, "dialog-password"))
+    {
+      double ic_size = WIDTH/5;
+      if(row==0)
+        ic_size = ic_size/3.5;
+      else if(row<4)
+        ic_size = ic_size - ic_size/row;
+      evas_object_size_hint_min_set(obj,
+                                    ELM_SCALE_SIZE(ic_size),
+                                    ELM_SCALE_SIZE(ic_size));
+      evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+      evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, 0.5);
+      elm_table_pack(table, obj, 0, 0, 1, row? row:1);
+      evas_object_show (obj);
+    }
+  else
+      evas_object_del(obj);
+
+  /* Box for padding */
+  obj = elm_box_add (win);
+  elm_box_pack_end (obj, table);
+  evas_object_show (obj);
+
+  elm_win_resize_object_add(win,obj);
+  evas_object_show(win);
+
+  if(entry)
+    elm_object_focus_set (entry, EINA_TRUE);
+
+  if (pinentry->timeout > 0)
+    timer = ecore_timer_add (pinentry->timeout,
+                             (Ecore_Task_Cb)timeout_cb,
+                             pinentry);
+}
+
+static int
+efl_cmd_handler (pinentry_t pe)
+{
+  int want_pass = !!pe->pin;
+
+  got_input = EINA_FALSE;
+  pinentry = pe;
+  confirm_value = CONFIRM_CANCEL;
+  passphrase_ok = 0;
+  confirm_mode = want_pass ? 0 : 1;
+  /* init ecore-x explicitly using DISPLAY since this can launch
+   * from console
+   */
+  if (pe->display)
+    ecore_x_init (pe->display);
+  elm_init (pargc, pargv);
+  create_window ();
+  ecore_main_loop_begin ();
+
+  if (timer)
+    {
+      ecore_timer_del (timer);
+      timer = NULL;
+    }
+
+  if (confirm_value == CONFIRM_CANCEL || grab_failed)
+    pe->canceled = 1;
+
+  pinentry = NULL;
+  if (want_pass)
+    {
+      if (passphrase_ok && pe->pin)
+	return strlen (pe->pin);
+      else
+	return -1;
+    }
+  else
+    return (confirm_value == CONFIRM_OK) ? 1 : 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+  pinentry_init (PGMNAME);
+
+#ifdef FALLBACK_CURSES
+  if (pinentry_have_display (argc, argv))
+    {
+#endif
+
+  pinentry_cmd_handler = efl_cmd_handler;
+  pargc = argc;
+  pargv = argv;
+
+#ifdef FALLBACK_CURSES
+    }
+  else
+    {
+      pinentry_cmd_handler = curses_cmd_handler;
+    }
+#endif
+
+  pinentry_parse_opts (argc, argv);
+  if (pinentry_loop ())
+    return 1;
+
+  return 0;
+}
--
2.8.0.rc3