diff --git a/Docs/Radio.txt b/Docs/Radio.txt index b00184a..383d17b 100755 --- a/Docs/Radio.txt +++ b/Docs/Radio.txt @@ -26,7 +26,13 @@ movgrab 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' - This both pipes it into 'mpg123' and writes it to 'darktrance.mp3' +A similar operation can be achived using the 'player' command-line switch (-P) rather than the 'output ' (-o) switch. e.g. +movgrab 'http://www.triplag.com/webradio/darkpsy/triplag-darkpsy-playlist.asx' -P '/usr/bin/mpg123 -' + +In this case it may be desired to use the option '-o none' which suppresses file output, so that output is just pumped to the player app. + +Since movgrab 3.1.0 there's been an option to have movgrab choose the player according to the content type of the data. This requires settings in a config file (see ConfigFile.txt). In this case use the switch '-P auto' and movgrab will select the appropriate player for the media type, provided that player has been set up in the config file. diff --git a/Docs/Usage.txt b/Docs/Usage.txt index e10b9d3..6b6c2ce 100755 --- a/Docs/Usage.txt +++ b/Docs/Usage.txt @@ -20,6 +20,9 @@ Using '-o -' will pump the movie data out of stdout, so you can feed it to anoth movgrab -o - http://www.youtube.com/watch?v=oP59tQf_njc | mplayer - +Useing '-o none' will suppress writing data to a file (used with the -P switch when movgrab is writing to a specified player program) + + But an even better solution is movgrab -s http://www.youtube.com/watch?v=oP59tQf_njc | mplayer - @@ -43,6 +46,9 @@ This command works the same as the -s streaming command, except that the file wi -P allows you to specify a 'Player program' (e.g. 'mplayer') to run when a certain percentage (default, 25%) of the file has been downloaded. +'-P auto' allows movgrab to select a player program matching a media type from entries in a config file (see 'ConfigFile.txt') + + -Pp allow you to set what percent of download to launch the 'Player program' at. -np Will write a 'now playing' file for ICY web-radio services that announce the current artist/track. diff --git a/common.h b/common.h index 519e04a..5ec5c9f 100755 --- a/common.h +++ b/common.h @@ -3,7 +3,7 @@ #define MOVGRAB_COMMON //This is doable through autoconf, but I'm sick of fighting with it -#define Version "3.1.0" +#define Version "3.1.1" #include "libUseful-2.8/libUseful.h" #include diff --git a/libUseful-2.8/Compression.c b/libUseful-2.8/Compression.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Compression.h b/libUseful-2.8/Compression.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/ConnectionChain.c b/libUseful-2.8/ConnectionChain.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/ConnectionChain.h b/libUseful-2.8/ConnectionChain.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/DataParser.c b/libUseful-2.8/DataParser.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/DataParser.h b/libUseful-2.8/DataParser.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/DataProcessing.c b/libUseful-2.8/DataProcessing.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/DataProcessing.h b/libUseful-2.8/DataProcessing.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/ConnectManager.txt b/libUseful-2.8/Docs/ConnectManager.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/DataProcessing.txt b/libUseful-2.8/Docs/DataProcessing.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/EncryptedFiles.txt b/libUseful-2.8/Docs/EncryptedFiles.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/GeneralFunctions.txt b/libUseful-2.8/Docs/GeneralFunctions.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/Hash.txt b/libUseful-2.8/Docs/Hash.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/Log.txt b/libUseful-2.8/Docs/Log.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/directory b/libUseful-2.8/Docs/directory old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/expect.txt b/libUseful-2.8/Docs/expect.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/file.txt b/libUseful-2.8/Docs/file.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/http.txt b/libUseful-2.8/Docs/http.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/includes.txt b/libUseful-2.8/Docs/includes.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/inet.txt b/libUseful-2.8/Docs/inet.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/list.txt b/libUseful-2.8/Docs/list.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/pty.txt b/libUseful-2.8/Docs/pty.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/socket.txt b/libUseful-2.8/Docs/socket.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/sound.txt b/libUseful-2.8/Docs/sound.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/string.txt b/libUseful-2.8/Docs/string.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Docs/unix_socket.txt b/libUseful-2.8/Docs/unix_socket.txt old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Encodings.c b/libUseful-2.8/Encodings.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Encodings.h b/libUseful-2.8/Encodings.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/EncryptedFiles.c b/libUseful-2.8/EncryptedFiles.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/EncryptedFiles.h b/libUseful-2.8/EncryptedFiles.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/FileSystem.c b/libUseful-2.8/FileSystem.c old mode 100644 new mode 100755 index 5338c41..198014d --- a/libUseful-2.8/FileSystem.c +++ b/libUseful-2.8/FileSystem.c @@ -31,7 +31,7 @@ char *SlashTerminateDirectoryPath(char *DirPath) { char *ptr, *RetStr=NULL; -if (! DirPath) return(CopyStr(DirPath,"/")); +if (! StrValid(DirPath)) return(CopyStr(DirPath,"/")); RetStr=DirPath; ptr=RetStr+StrLen(RetStr)-1; if (*ptr != '/') RetStr=AddCharToStr(RetStr,'/'); @@ -45,7 +45,8 @@ char *StripDirectorySlash(char *DirPath) char *ptr; //don't strip '/' (root dir) -if (StrLen(DirPath)==1) return(DirPath); +if (! StrValid(DirPath)) return(DirPath); +if (strcmp(DirPath,"/")==0) return(DirPath); ptr=DirPath+StrLen(DirPath)-1; if (*ptr == '/') *ptr='\0'; @@ -207,23 +208,15 @@ return(FALSE); int FileCopyWithProgress(const char *SrcPath, const char *DestPath, DATA_PROGRESS_CALLBACK Callback) { -STREAM *Src, *Dest; +STREAM *Src; +int result; Src=STREAMOpen(SrcPath,"r"); if (! Src) return(FALSE); if (Callback) STREAMAddProgressCallback(Src,Callback); -Dest=STREAMOpen(DestPath,"wc"); -if (! Dest) -{ +result=STREAMCopy(Src, DestPath); STREAMClose(Src); -return(FALSE); -} - -STREAMSendFile(Src, Dest, 0, SENDFILE_LOOP); -// | SENDFILE_KERNEL); -STREAMClose(Dest); -STREAMClose(Src); -return(TRUE); +return(result); } @@ -256,7 +249,7 @@ int FileSystemMount(const char *Dev, const char *MountPoint, const char *Type, c { const char *ptr, *p_Type, *p_MountPoint; char *Token=NULL; -int Flags=0, result; +int Flags=0, result, Perms=700; p_Type=Type; if (! StrValid(MountPoint)) @@ -282,11 +275,12 @@ while (ptr) else if (strcmp(Token,"noexec")==0) Flags |= MS_NOEXEC; else if (strcmp(Token,"nosuid")==0) Flags |= MS_NOSUID; else if (strcmp(Token,"nodev")==0) Flags |= MS_NODEV; + else if (strncmp(Token,"perms=",6)==0) Perms=strtol(Token+6,NULL,8); ptr=GetToken(ptr, " |,", &Token, GETTOKEN_MULTI_SEP); } Token=MCopyStr(Token,p_MountPoint,"/",NULL); -MakeDirPath(Token,0700); +MakeDirPath(Token,Perms); //must do a little dance for readonly bind mounts. We must first mount, then remount readonly if ((Flags & MS_BIND) && (Flags & MS_RDONLY)) @@ -302,6 +296,17 @@ return(result); } + +//if the system doesn't have these flags then define empty values for them +#ifndef UMOUNT_NOFOLLOW +#define UMOUNT_NOFOLLOW 0 +#endif + +#ifndef UMOUNT_DETACH +#define UMOUNT_DETACH 0 +#endif + + #define UMOUNT_RECURSE 1 #define UMOUNT_RMDIR 2 diff --git a/libUseful-2.8/FileSystem.h b/libUseful-2.8/FileSystem.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/GeneralFunctions.c b/libUseful-2.8/GeneralFunctions.c old mode 100644 new mode 100755 index 3a4144e..5cd5232 --- a/libUseful-2.8/GeneralFunctions.c +++ b/libUseful-2.8/GeneralFunctions.c @@ -166,16 +166,17 @@ return(GetRandomData(RetBuff,len,ALPHA_CHARS)); } -//It's not worth the extra dependancy on libm just to have power -double topower(double value, double power) +double ToPower(double val, double power) { -double i, result; +double result=0; +int i; -result=value; +result=val; for (i=1; i < power; i++) { - result *= value; + result=result * val; } + return(result); } @@ -189,14 +190,14 @@ val=strtod(Data,&ptr); while (isspace(*ptr)) ptr++; switch (*ptr) { -case 'k': val=val*1000; break; -case 'M': val=val*topower(1000,2); break; -case 'G': val=val*topower(1000,3); break; -case 'T': val=val*topower(1000,4); break; -case 'P': val=val*topower(1000,5); break; -case 'E': val=val*topower(1000,6); break; -case 'Z': val=val*topower(1000,7); break; -case 'Y': val=val*topower(1000,8); break; +case 'k': val=val * 1000; break; +case 'M': val=val * ToPower(1000,2); break; +case 'G': val=val * ToPower(1000,3); break; +case 'T': val=val * ToPower(1000,4); break; +case 'P': val=val * ToPower(1000,5); break; +case 'E': val=val * ToPower(1000,6); break; +case 'Z': val=val * ToPower(1000,7); break; +case 'Y': val=val * ToPower(1000,8); break; } return(val); @@ -216,13 +217,13 @@ val=Size; for (i=0; sufflist[i] !='\0'; i++) { - next=topower(1000,i+1); + next=ToPower(1000,i+1); if (next > val) break; } if ((sufflist[i] > 0) && (sufflist[i] !='\0')) { - val=val / topower(1000,i); + val=val / ToPower(1000,i); suffix=sufflist[i]; } diff --git a/libUseful-2.8/GeneralFunctions.h b/libUseful-2.8/GeneralFunctions.h old mode 100644 new mode 100755 index bb0f7ab..8ca597c --- a/libUseful-2.8/GeneralFunctions.h +++ b/libUseful-2.8/GeneralFunctions.h @@ -27,7 +27,6 @@ char *GetRandomData(char *RetBuff, int len, char *AllowedChars); char *GetRandomHexStr(char *RetBuff, int len); char *GetRandomAlphabetStr(char *RetBuff, int len); -int BASIC_FUNC_EXEC_COMMAND(void *Data); double FromMetric(const char *Data, int Type); const char *ToMetric(double Size, int Type); diff --git a/libUseful-2.8/Hash.c b/libUseful-2.8/Hash.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Hash.h b/libUseful-2.8/Hash.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/LICENCE b/libUseful-2.8/LICENCE old mode 100644 new mode 100755 diff --git a/libUseful-2.8/LinuxNamespaces.c b/libUseful-2.8/LinuxNamespaces.c deleted file mode 100644 index d332d17..0000000 --- a/libUseful-2.8/LinuxNamespaces.c +++ /dev/null @@ -1,154 +0,0 @@ - -void JailMount(const char *Dir) -{ -const char *ptr; - -ptr=Dir; -if (*ptr=='/') ptr++; -MakeDirPath(ptr,0700); -mount(Dir,ptr,"",MS_BIND,NULL); -mount(NULL,ptr,"",MS_REMOUNT|MS_BIND|MS_RDONLY,NULL); -} - -void InitSigHandler(int sig) -{ - -} - -void JailInitProcess(int tunfd, int linkfd, pid_t Child, const char *Dirs) -{ -int i; -ListNode *Connections=NULL; -STREAM *TunS=NULL, *LinkS=NULL, *S; -char *Token=NULL; -const char *ptr; -struct sigaction sa; - - if ((linkfd > -1) && (tunfd > -1)) - { - Connections=ListCreate(); - LinkS=STREAMFromFD(linkfd); - STREAMSetFlushType(LinkS, FLUSH_ALWAYS, 0, 0); - if (LinkS) ListAddItem(Connections, LinkS); - - TunS=STREAMFromFD(tunfd); - STREAMSetFlushType(TunS, FLUSH_ALWAYS, 0, 0); - if (TunS) ListAddItem(Connections, TunS); - } - - - //this process is init, the child will carry on executation - chroot("."); - ProcessSetTitle("init"); - - memset(&sa,0,sizeof(sa)); - sa.sa_handler=InitSigHandler; - sa.sa_flags=SA_NOCLDSTOP; - sigaction(SIGCHLD, &sa,NULL); - while (Connections) - { - S=STREAMSelect(Connections, NULL); - if (S==TunS) STREAMSendFile(S, LinkS, BUFSIZ, SENDFILE_KERNEL); - else if (S==LinkS) STREAMSendFile(S, TunS, BUFSIZ, SENDFILE_KERNEL); - if (waitpid(Child,NULL,WNOHANG) == -1) break; - } - - waitpid(Child,NULL,0); - - ptr=GetToken(Dirs, ":", &Token, GETTOKEN_QUOTES); - while (ptr) - { - umount(Token); - rmdir(Token); - ptr=GetToken(ptr, ":", &Token, GETTOKEN_QUOTES); - } - umount("/proc"); - rmdir("/proc"); - - STREAMClose(TunS); - STREAMClose(LinkS); - - _exit(0); -} - - -void LinuxNamespaceJail(int netfd, const char *HostName, const char *Dir, const char *Mounts, const char *Setup) -{ -int i, val; -char *Token=NULL; -const char *ptr; -int tunfd; - -unshare(CLONE_NEWPID); - -//fork again because CLONE_NEWPID only takes effect after another fork, and creates an 'init' process -if (fork()==0) -{ - unshare(CLONE_NEWNET); - - //do these all individually because any one of them might be rejected - unshare(CLONE_NEWIPC); - unshare(CLONE_NEWUTS); - //unshare(CLONE_NEWNS); - - val=StrLen(HostName); - if (val > 0) sethostname(HostName, val); - - //we must create this here so it can be setup by the setup - //script. However, only the init child process will need - //the file descriptor long term - tunfd=TunIface("eth0"); - if (StrValid(Setup)) system(Setup); - - //must after most unshares - mkdir("proc/",0777); - mount(NULL,"proc","proc",0,NULL); - mkdir("tmp/",0777); - mount(NULL,"tmp","tmpfs",0,NULL); - - - //these are mounted before forking off the init process - //to prevent race conditions. The init process will be - //the last process running in the jail though, and it - //will do the umounts - chdir(Dir); - ptr=GetToken(Mounts, ":", &Token, GETTOKEN_QUOTES); - while (ptr) - { - Token=SlashTerminateDirectoryPath(Token); - JailMount(Token); - ptr=GetToken(ptr, ":", &Token, GETTOKEN_QUOTES); - } - - //do last as we lose our root capabilities - //unshare(CLONE_NEWUSER); - - //NB NOT EQUAL ZERO - val=fork(); - if (val !=0) JailInitProcess(tunfd, netfd, val, Mounts); - else close(tunfd); - - //this process is the child of the init fork -} -else -{ - while(waitpid(-1,NULL,0) !=-1); - _exit(0); -} - -DestroyString(Token); -} - - -int NetPipeParse(const char *Value) -{ -const char *ptr; -int retfd, otherfd; - -otherfd=strtol(Value, &ptr, 10); -ptr++; -retfd=strtol(ptr, &ptr, 10); - -close(otherfd); -return(retfd); -} diff --git a/libUseful-2.8/Log.c b/libUseful-2.8/Log.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Log.h b/libUseful-2.8/Log.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Makefile b/libUseful-2.8/Makefile index 270b4b9..6f96de8 100644 --- a/libUseful-2.8/Makefile +++ b/libUseful-2.8/Makefile @@ -1,8 +1,8 @@ CC = gcc VERSION = 0.0.1 CFLAGS = -g -O2 -LIBS = -lz -lcrypto -lssl -lc -FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_EVP_BF_CBC=1 -DHAVE_EVP_RC2_CBC=1 -DHAVE_EVP_RC4=1 -DHAVE_EVP_DES_CBC=1 -DHAVE_EVP_DESX_CBC=1 -DHAVE_EVP_CAST5_CBC=1 -DHAVE_EVP_IDEA_CBC=1 -DHAVE_EVP_AES_128_CBC=1 -DHAVE_EVP_AES_256_CBC=1 -DUSE_OPENSSL_ADD_ALL_ALGORITHMS=1 -DHAVE_LIBZ=1 -DHAVE_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK +LIBS = -lc +FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -fPIC -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_OSS=1 -DHAVE_MADVISE -DHAVE_MADVISE_NOFORK -DHAVE_MADVISE_DONTDUMP -DHAVE_MLOCK prefix=/usr/local OBJ=string.o list.o socket.o unix_socket.o file.o tar.o Terminal.o FileSystem.o GeneralFunctions.o DataProcessing.o EncryptedFiles.o g711.o sound.o pty.o Log.o http.o inet.o expect.o base64.o crc32.o md5c.o sha1.o sha2.o whirlpool.o jh_ref.o Hash.o ssh.o Compression.o oauth.o libsettings.o Vars.o Time.o Markup.o SpawnPrograms.o Tokenizer.o PatternMatch.o URL.o DataParser.o ConnectionChain.o openssl.o Process.o Encodings.o RawData.o securemem.o diff --git a/libUseful-2.8/Makefile.in b/libUseful-2.8/Makefile.in old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Markup.c b/libUseful-2.8/Markup.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Markup.h b/libUseful-2.8/Markup.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/MessageBus.c b/libUseful-2.8/MessageBus.c old mode 100644 new mode 100755 index 1f8640e..ba6e2b7 --- a/libUseful-2.8/MessageBus.c +++ b/libUseful-2.8/MessageBus.c @@ -1,364 +1,193 @@ #include "MessageBus.h" -#include "defines.h" -#include "SpawnPrograms.h" -#include "http.h" -#define MESSAGEAGENT_BUSY 1 -typedef struct -{ -char *URL; -int MaxConnections; -int Timeout; -ListNode *Connections; -MSG_FUNC AgentFunction; -} TMessageBus; - -ListNode *MessageBusConnections=NULL; -STREAM *MessageS=NULL; - -// typedef void (*MSG_FUNC)(const char *PeerName, ListNode *Variables); - -void MessageBusRegister(const char *URL, int MaxConnections, int Timeout, MSG_FUNC AgentFunction) -{ -TMessageBus *MA; - -if (! MessageBusConnections) MessageBusConnections=ListCreate(); - -MA=(TMessageBus *) calloc(1,sizeof(TMessageBus)); -MA->URL=CopyStr(MA->URL, URL); -MA->Connections=ListCreate(); -MA->AgentFunction=AgentFunction; -ListAddItem(MessageBusConnections, MA); -} - - - -int MessageBusNativeRecv(STREAM *S, char **Source, ListNode *Vars) -{ -char *Tempstr=NULL, *EncName=NULL, *EncValue=NULL; -const char *ptr; -ListNode *Node; +ListNode *MBusConnections=NULL; -Tempstr=STREAMReadLine(Tempstr, S); -if (StrEnd(Tempstr)) +STREAM *MBusHandleConnectRequest(const char *URL) { - //could be blank (timeout) or null. DestroyString will figure it out - DestroyString(Tempstr); - return(FALSE); -} +STREAM *S=NULL; -StripTrailingWhitespace(Tempstr); -ptr=GetToken(Tempstr, "?", Source, 0); -while (ptr) +if (! URL) return(NULL); +switch (*URL) { - ptr=GetNameValuePair(ptr, "&","=", &EncName, &EncValue); - Node=ListAddItem(Vars, NULL); - Node->Tag=HTTPUnQuote(Node->Tag, EncName); - Node->Item=HTTPUnQuote(Node->Item, EncValue); -} - -DestroyString(Tempstr); -DestroyString(EncValue); -DestroyString(EncName); +case 't': +if (strncmp(URL,"tcp:",4)==0) S=STREAMOpen(URL,""); +break; -return(TRUE); } - -void JSONParse(const char *Doc, ListNode *Vars) +if (S) { -char *Prefix=NULL, *Name=NULL, *Value=NULL, *Tempstr=NULL, *tptr; -const char *ptr; - -ptr=Doc; -while (isspace(*ptr) || (*ptr=='{')) ptr++; -while (ptr) -{ - ptr=GetToken(ptr,",|:", &Name, GETTOKEN_MULTI_SEPARATORS); - if (strcmp(Name,"}")==0) - { - //we've come out of one level of nesting. remove last item from prefix - if (StrValid(Prefix)) - { - tptr=strrchr(Prefix, ':'); - if (tptr) - { - *tptr='\0'; - tptr=strrchr(tptr, ':'); - if (tptr) *tptr='\0'; - } - } - } - else - { - ptr=GetToken(ptr,",|:",&Value, GETTOKEN_MULTI_SEPARATORS); - if (strcmp(Value,"{")==0) Prefix=MCatStr(Prefix,Name,":",NULL); - else - { - Tempstr=MCopyStr(Tempstr, Prefix, Name, NULL); - SetVar(Vars, Tempstr, Value); - } - } + if (! MBusConnections) MBusConnections=ListCreate(); + ListAddNamedItem(MBusConnections, URL, S); } -DestroyString(Tempstr); -DestroyString(Prefix); -DestroyString(Name); -DestroyString(Value); +return(S); } -void XMLParse(const char *Doc, ListNode *Vars) -{ -char *Name=NULL, *Value=NULL, *Data=NULL, *Extra=NULL; -const char *ptr; - -ptr=XMLGetTag(Doc, NULL, &Name, &Data); -while (ptr) +typedef struct { - if (StrValid(Name)) - { - ptr=XMLGetTag(ptr, NULL, &Extra, &Value); - if (StrValid(Extra)) - { - if (*Name != '/') SetVar(Vars, Name, ""); - Name=CopyStr(Name, Extra); - } - else - { - if (*Name != '/')SetVar(Vars, Name, Value); - ptr=XMLGetTag(ptr, NULL, &Name, &Data); - } - } - else ptr=XMLGetTag(ptr, NULL, &Name, &Data); -} - -DestroyString(Name); -DestroyString(Data); -DestroyString(Value); -DestroyString(Extra); -} - +int Type; +int ConID; +char *URL; +int DataLen; +char *Data; +void *UserData; +STREAM *Broker; +} TMBusMsg -int MessageBusRecv(STREAM *S, char **Source, ListNode *Vars) +ListNode *MBusFindConnection(int ConID) { -char *Doc=NULL, *ptr; -HTTPInfoStruct *Info; ListNode *Curr; -TMessageBus *MA; -int result=FALSE; - -if (! Vars) return(FALSE); -if (! S) return(FALSE); -ListClear(Vars, DestroyString); - -if (S->Type==STREAM_TYPE_HTTP) -{ - Info=(HTTPInfoStruct *) STREAMGetItem(S, "HTTPInfo"); - if (Info) - { - HTTPTransact(Info); - Doc=HTTPReadDocument(Doc, S); - ptr=STREAMGetValue(S, "HTTP:Content-Type"); - if (strcmp(ptr, "application/json")==0) JSONParse(Doc, Vars); - if (strcmp(ptr, "application/xml")==0) XMLParse(Doc, Vars); - - HTTPInfoDestroy(Info); - DestroyString(Doc); - result=TRUE; - } -} -else result=MessageBusNativeRecv(S, Source, Vars); - -MA=(TMessageBus *) STREAMGetItem(S, "MessageBus:Agent"); -Curr=ListFindItem(MA->Connections, S); -if (Curr) Curr->ItemType=0; -if (! result) -{ - if (Curr) ListDeleteNode(Curr); - STREAMClose(S); -} - -return(result); -} +TMBusMsg *Item; - -int MessageBusHandler(void *p_MA) -{ -char *URL=NULL; -ListNode *Vars; -TMessageBus *MA; - -MA=(TMessageBus *) p_MA; -Vars=ListCreate(); -MessageS=STREAMFromDualFD(0,1); -MessageS->Type=STREAM_TYPE_MESSAGEBUS; -STREAMSetTimeout(MessageS, MA->Timeout * 100); -STREAMSetItem(MessageS, "MessageBus:Agent", MA); -while (MessageBusRecv(MessageS, &URL, Vars)) +Curr=ListGetNext(MBusConnections); +while (Curr) { - if (MA->AgentFunction) MA->AgentFunction(URL, Vars); +Item=(TMBusMsg *) Curr->Item; +if (Item->ConID==ConID) return(Item); +Curr=ListGetNext(Curr); } - -ListDestroy(Vars,DestroyString); -DestroyString(URL); +return(NULL); } - -STREAM *MessageBusConnect(TMessageBus *MA, const char *Args) +int MBusBrokerRecv(STREAM *S, TMBusMsg *Msg) { -STREAM *S; -char *Tempstr=NULL; -HTTPInfoStruct *HTTPInfo; +int Type, result; +uint32_t ConID; +STREAM *Con; +ListNode *Node; -Tempstr=MCopyStr(Tempstr, MA->URL, Args, NULL); -if (strncmp(MA->URL,"http:",5)==0) +Msg->Type=STREAMReadChar(S); +if (Type==STREAM_CLOSED) return(MBUS_FAIL); +STREAMReadBytes(S, &Msg->ConID, sizeof(uint32_t)); +Node=MBusFindConnection(Msg->ConID); +if (Node) { - HTTPInfo=HTTPInfoFromURL("GET", MA->URL); - S=HTTPConnect(HTTPInfo); - STREAMSetItem(S, "HTTPInfo", HTTPInfo); + Msg->URL=CopyStr(Msg->URL, Node->Tag); + Msg->UserData=Node->Item; } else { - S=STREAMSpawnFunction(MessageBusHandler, MA); - S->Type=STREAM_TYPE_MESSAGEBUS; -} - -if (S) STREAMSetItem(S, "MessageBus:Agent", MA); -DestroyString(Tempstr); -return(S); + Msg->URL=CopyStr(Msg->URL, ""); + Msg->UserData=NULL; } - - -STREAM *MessageBusAgentFindConnect(TMessageBus *MA, const char *Args) +switch(Type) { -STREAM *S=NULL; -ListNode *Curr; +case MBUS_CONNECT_RESULT: + result=STREAMReadChar(S); + if (result < 0) Msg->Result=FALSE; + else Msg->Result=TRUE; +break; - Curr=ListGetNext(MA->Connections); - while (Curr) - { - if (! Curr->ItemType) S=(STREAM *) Curr->Item; - Curr=ListGetNext(Curr); - } +case MBUS_SEND: +break; - if (! S) - { - S=MessageBusConnect(MA, Args); - Curr=ListAddItem(MA->Connections, S); - Curr->ItemType=MESSAGEAGENT_BUSY; - } - -return(S); +case MBUS_CLOSE: +break; } - - -STREAM *MessageBusFindConnect(const char *URL, const char *Args) -{ -ListNode *Curr; -TMessageBus *MA, *Found=NULL; -STREAM *S=NULL; - -Curr=ListGetNext(MessageBusConnections); -while (Curr) -{ - MA=(TMessageBus *) Curr->Item; - if (strcmp(MA->URL, URL)==0) - { - Found=MA; - break; - } - Curr=ListGetNext(Curr); +return(TRUE); } -if (Found) +int MBusClientRecv(STREAM *S, TMBusMsg *Msg) { - S=MessageBusAgentFindConnect(MA, Args); -} +int Type, result; +TMBusMsg *ConDetails; +uint32_t ConID; +STREAM *Con; -return(S); -} +Msg->Type=STREAMReadChar(S); +if (Type==STREAM_CLOSED) return(MBUS_FAIL); +STREAMReadBytes(S, &Msg->ConID, sizeof(uint32_t)); +ConDetails=MBusFindConnection(Msg->ConID); - -STREAM *MessageBusWrite(const char *URL, const char *Args) +switch(Type) { -char *Message=NULL; -STREAM *S=NULL; +case MBUS_CONNECT: + URL=STREAMReadLine(URL, S); + Con=MBusHandleConnectRequest(URL); + STREAMWriteChar(S, MBUS_CONNECT_RESULT); + STREAMWriteBytes(S, &ConID, sizeof(uint32_t)); + if (Con) STREAMWriteChar(S, TRUE); + else STREAMWriteChar(S, FALSE); + STREAMFlush(S); +break; -//we are a messagebus 'client' with a connection to a parent process -//so just write out of that -if (MessageS) S=MessageS; -else -{ - //we are a messagebus 'server' in the parent process, and must find the - //right connection to write to - S=MessageBusFindConnect(URL, Args); - if (! S) return(NULL); -} +case MBUS_SEND: + if (ConDetails) + { + } +break; -if (S->Type == STREAM_TYPE_MESSAGEBUS) -{ - Message=MCopyStr(Message, URL, "?", Args, "\r\n", NULL); - STREAMWriteLine(Message, S); - STREAMFlush(S); +case MBUS_CLOSE: +break; } -DestroyString(Message); -return(S); +return(TRUE); } - -STREAM *MessageBusSend(const char *URL, ListNode *Args) +STREAM *MBusFindBroker(const char *URL) { -char *Tempstr=NULL, *EncodedName=NULL, *EncodedValue=NULL; ListNode *Curr; -STREAM *S; -int result; +char *Token=NULL; +const char *ptr; -Tempstr=MCopyStr(Tempstr, URL, "?", NULL); -Curr=ListGetNext(Args); +Curr=GetNextListItem(MBusConnections); while (Curr) { - EncodedName=HTTPQuote(EncodedName, Curr->Tag); - EncodedValue=HTTPQuote(EncodedValue, (char *) Curr->Item); - Tempstr=MCatStr(Tempstr, EncodedName, "=", EncodedValue, "&", NULL); - Curr=ListGetNext(Curr); + if (Curr->ItemType==MBUS_BROKER) + { + ptr=GetToken(Curr->Tag,",",&Token,0); + while (ptr) + { + if (fnmatch(Token,Curr->Tag,0)==0) + { + DestroyString(Token); + return((STREAM *) Curr->Item); + } + ptr=GetToken(ptr,",",&Token,0); + } + } +Curr=GetNextListItem(Curr); } -S=MessageBusWrite(URL, Tempstr); - -DestroyString(Tempstr); -DestroyString(EncodedName); -DestroyString(EncodedValue); - -return(S); +DestroyString(Token); +return(NULL); } - -int MessageQueueAddToSelect(ListNode *SelectList) +int MBusConnect(const char *URL, void *UserData) { -ListNode *Curr; -TMessageBus *MA; +STREAM *Broker; +static uint32_t ConCount=0; +ListNode *Node; -Curr=ListGetNext(MessageBusConnections); -while (Curr) +Broker=MBusFindBroker(URL); +if (Broker) { - MA=(TMessageBus *) Curr->Item; - ListAppendItems(SelectList, MA->Connections, NULL); - Curr=ListGetNext(Curr); + STREAMWriteChar(Broker, MBUS_CONNECT); + ConCount++; + STREAMWriteBytes(Broker, &ConCount, sizeof(uint32_t)); + STREAMWriteString(URL, Broker); + STREAMWriteChar(Broker, '\n'); + STREAMFlush(Broker); + if (! MBusConnections) MBusConnections=ListCreate(); + Node=ListAddNamedItem(MBusConnections, URL, UserData); + Node->Hits=ConCount; + return(TRUE); } -return(TRUE); +return(FALSE); } + diff --git a/libUseful-2.8/MessageBus.h b/libUseful-2.8/MessageBus.h old mode 100644 new mode 100755 index ade5def..60086c8 --- a/libUseful-2.8/MessageBus.h +++ b/libUseful-2.8/MessageBus.h @@ -1,26 +1,29 @@ -#ifndef LIBUSEFUL_MESSAGE_BUS_H -#define LIBUSEFUL_MESSAGE_BUS_H +#ifndef LIBUSEFUL_MESSAGEBUS_H +#define LIBUSEFUL_MESSAGEBUS_H -//Vars gives us list node, and also 'GetVar' which is used in the -//.c module of this .h -#include "Vars.h" +#include "includes.h" +#include "defines.h" #include "file.h" -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*MSG_FUNC)(const char *PeerName, ListNode *Variables); +#define MBUS_CONNECTION 0 +#define MBUS_BROKER 1 -void MessageBusRegister(const char *URL, int MaxConnections, int Timeout, MSG_FUNC); -STREAM *MessageBusWrite(const char *URL, const char *Args); -STREAM *MessageBusSend(const char *URL, ListNode *Args); -int MessageBusRecv(STREAM *S, char **Source, ListNode *Vars); -int MessageQueueAddToSelect(ListNode *SelectList); +#define MBUS_FAIL 0 +#define MBUS_CONNECT 1 +#define MBUS_CONNECT_RESULT 2 +#define MBUS_SEND 3 +#define MBUS_CLOSE 4 -#ifdef __cplusplus -} -#endif +typedef struct +{ +int Type; +int ConID; +int Result; +char *URL; +int DataLen; +char *Data; +void *UserData; +} TMBusMsg #endif diff --git a/libUseful-2.8/PatternMatch.c b/libUseful-2.8/PatternMatch.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/PatternMatch.h b/libUseful-2.8/PatternMatch.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Process.c b/libUseful-2.8/Process.c old mode 100644 new mode 100755 index 19a6114..ba77841 --- a/libUseful-2.8/Process.c +++ b/libUseful-2.8/Process.c @@ -13,18 +13,6 @@ #include - -#define COMMS_COMBINE_STDERR 4 -#define PROC_DAEMON 8 -#define PROC_SETSID 16 -#define PROC_CTRL_TTY 32 -#define PROC_CHROOT 64 -#define PROC_JAIL 128 -#define PROC_SIGDEF 256 -#define PROC_CONTAINER 512 -#define PROC_CONTAINER_NET 1024 - - /*This is code to change the command-line of a program as visible in ps */ extern char **environ; @@ -392,18 +380,16 @@ DestroyString(Dir); } -void ProcessApplyConfig(const char *Config) +int ProcessApplyConfig(const char *Config) { char *User=NULL, *Group=NULL, *Dir=NULL, *HostName=NULL; char *Name=NULL, *Value=NULL; const char *ptr; struct rlimit limit; rlim_t val; -int Flags=0; +int Flags=0, i; long uid=0, gid=0; -int i; - User=CopyStr(User,""); Group=CopyStr(Group,""); ptr=GetNameValuePair(Config,"\\S","=",&Name,&Value); @@ -425,6 +411,8 @@ while (ptr) else if (strcasecmp(Name,"ctrltty")==0) Flags |= PROC_CTRL_TTY; else if (strcasecmp(Name,"jail")==0) Flags |= PROC_JAIL; else if (strcasecmp(Name,"container")==0) Flags |= PROC_CONTAINER; + else if (strcasecmp(Name,"trust")==0) Flags |= SPAWN_TRUST_COMMAND; + else if (strcasecmp(Name,"noshell")==0) Flags |= SPAWN_NOSHELL; else if (strcasecmp(Name,"mem")==0) { val=(rlim_t) FromMetric(Value, 0); @@ -513,6 +501,8 @@ DestroyString(Group); DestroyString(User); DestroyString(Name); DestroyString(Dir); + +return(Flags); } diff --git a/libUseful-2.8/Process.h b/libUseful-2.8/Process.h old mode 100644 new mode 100755 index 5b64567..2c412a6 --- a/libUseful-2.8/Process.h +++ b/libUseful-2.8/Process.h @@ -1,6 +1,22 @@ #ifndef LIBUSEFUL_PROCESS_H #define LIBUSEFUL_PROCESS_H + +#define COMMS_COMBINE_STDERR 4 +#define PROC_DAEMON 8 +#define PROC_SETSID 16 +#define PROC_CTRL_TTY 32 +#define PROC_CHROOT 64 +#define PROC_JAIL 128 +#define PROC_SIGDEF 256 +#define PROC_CONTAINER 512 +#define PROC_CONTAINER_NET 1024 + +//these must be compatible with PROC_ defines +#define SPAWN_NOSHELL 8192 +#define SPAWN_TRUST_COMMAND 16384 + + void CloseOpenFiles(); int SwitchUID(int uid); int SwitchGID(int gid); @@ -12,7 +28,7 @@ int CreateLockFile(char *FilePath,int Timeout); void ProcessTitleCaptureBuffer(char **argv); void ProcessSetTitle(char *FmtStr, ...); void ColLibDefaultSignalHandler(int sig); -void ProcessApplyConfig(const char *Config); +int ProcessApplyConfig(const char *Config); int demonize(); #endif diff --git a/libUseful-2.8/README b/libUseful-2.8/README old mode 100644 new mode 100755 diff --git a/libUseful-2.8/RawData.c b/libUseful-2.8/RawData.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/RawData.h b/libUseful-2.8/RawData.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/SpawnPrograms.c b/libUseful-2.8/SpawnPrograms.c old mode 100644 new mode 100755 index a1b1b0a..be1b6ee --- a/libUseful-2.8/SpawnPrograms.c +++ b/libUseful-2.8/SpawnPrograms.c @@ -6,12 +6,56 @@ #include "string.h" #include + +//This Function eliminates characters from a string that can be used to trivially achieve code-exec via the shell +char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) +{ +char *Tempstr=NULL; +char *BadChars=";|&`"; + +if (SafeLevel==SHELLSAFE_BLANK) +{ + Tempstr=CopyStr(RetStr,String); + strmrep(Tempstr,BadChars,' '); +} +else Tempstr=QuoteCharsInStr(RetStr,String,BadChars); + +if (strcmp(Tempstr,String) !=0) +{ + //if (EventCallback) EventCallback(String); +} +return(Tempstr); +} + + //This is the function we call in the child process for 'SpawnCommand' -int BASIC_FUNC_EXEC_COMMAND(void *Command) +int BASIC_FUNC_EXEC_COMMAND(void *Command, int Flags) { int result; +char *Token=NULL, *FinalCommand=NULL; +char **argv, *ptr; +int i; + +if (Flags & SPAWN_TRUST_COMMAND) FinalCommand=CopyStr(FinalCommand, (char *) Command); +else FinalCommand=MakeShellSafeString(FinalCommand, (char *) Command, 0); + +if (Flags & SPAWN_NOSHELL) +{ +argv=(char **) calloc(101,sizeof(char *)); +ptr=FinalCommand; +for (i=0; i < 100; i++) +{ + ptr=GetToken(ptr,"\\S",&Token,GETTOKEN_QUOTES); + if (! ptr) break; + argv[i]=CopyStr(argv[i],Token); +} +execv(argv[0],argv); +} +else result=execl("/bin/sh","/bin/sh","-c",(char *) Command,NULL); -result=execl("/bin/sh","/bin/sh","-c",(char *) Command,NULL); +//We'll never get to here unless something fails! +DestroyString(FinalCommand); +DestroyString(Token); return(result); } @@ -88,58 +132,12 @@ return(pid); - -//This Function eliminates characters from a string that can be used to trivially achieve code-exec via the shell -char *MakeShellSafeString(char *RetStr, const char *String, int SafeLevel) -{ -char *Tempstr=NULL; -char *BadChars=";|&`"; - -if (SafeLevel==SHELLSAFE_BLANK) -{ - Tempstr=CopyStr(RetStr,String); - strmrep(Tempstr,BadChars,' '); -} -else Tempstr=QuoteCharsInStr(RetStr,String,BadChars); - -if (strcmp(Tempstr,String) !=0) -{ - //if (EventCallback) EventCallback(String); -} -return(Tempstr); -} - - void SwitchProgram(const char *CommandLine, const char *Config) { -char **argv, *ptr; -char *Token=NULL, *SafeStr=NULL; -int i; - -//if (Flags & SPAWN_TRUST_COMMAND) SafeStr=CopyStr(SafeStr,CommandLine); -//else +int Flags; -SafeStr=MakeShellSafeString(SafeStr, CommandLine, 0); - -SafeStr=MakeShellSafeString(SafeStr,CommandLine,0); -argv=(char **) calloc(101,sizeof(char *)); -ptr=SafeStr; -for (i=0; i < 100; i++) -{ - ptr=GetToken(ptr,"\\S",&Token,GETTOKEN_QUOTES); - if (! ptr) break; - argv[i]=CopyStr(argv[i],Token); -} - -ProcessApplyConfig(Config); - -DestroyString(Token); -DestroyString(SafeStr); - -/* we are the child so we continue */ -execv(argv[0],argv); -//no point trying to free stuff here, we will no longer -//be the main program +Flags=ProcessApplyConfig(Config); +BASIC_FUNC_EXEC_COMMAND(CommandLine, SPAWN_NOSHELL|Flags); } @@ -179,6 +177,7 @@ pid_t PipeSpawnFunction(int *infd, int *outfd, int *errfd, BASIC_FUNC Func, void { pid_t pid; int channel1[2], channel2[2], channel3[2], DevNull=-1; +int Flags; if (infd) pipe(channel1); if (outfd) pipe(channel2); @@ -217,8 +216,8 @@ if (pid==0) else dup(DevNull); - ProcessApplyConfig(Config); - Func(Data); + Flags=ProcessApplyConfig(Config); + Func(Data, Flags); exit(0); } else // This is the parent process, not the spawned child @@ -258,7 +257,7 @@ return(PipeSpawnFunction(infd,outfd,errfd, BASIC_FUNC_EXEC_COMMAND, (void *) Com pid_t PseudoTTYSpawnFunction(int *ret_pty, BASIC_FUNC Func, void *Data, int Flags, const char *Config) { -pid_t pid=-1; +pid_t pid=-1, ConfigFlags; int tty, pty, i; if (PseudoTTYGrab(&pty, &tty, Flags)) @@ -280,8 +279,8 @@ if (PseudoTTYGrab(&pty, &tty, Flags)) //as it will be open on stdin/stdout close(tty); - if (StrValid(Config)) ProcessApplyConfig(Config); - Func((char *) Data); + ConfigFlags=ProcessApplyConfig(Config); + Func((char *) Data, ConfigFlags); _exit(0); } @@ -329,6 +328,7 @@ if (S) STREAMSetFlushType(S,FLUSH_LINE,0,0); Tempstr=FormatStr(Tempstr,"%d",pid); STREAMSetValue(S,"PeerPID",Tempstr); + S->Type=STREAM_TYPE_PIPE; } DestroyString(Tempstr); @@ -338,14 +338,5 @@ return(S); STREAM *STREAMSpawnCommand(const char *Command, const char *Config) { -STREAM *S=NULL; -char *Tempstr=NULL; - -//if (Flags & SPAWN_TRUST_COMMAND) Tempstr=CopyStr(Tempstr,Command); -//else -Tempstr=MakeShellSafeString(Tempstr, Command, 0); - -S=STREAMSpawnFunction(BASIC_FUNC_EXEC_COMMAND, Tempstr, Config); -DestroyString(Tempstr); -return(S); +return(STREAMSpawnFunction(BASIC_FUNC_EXEC_COMMAND, Command, Config)); } diff --git a/libUseful-2.8/SpawnPrograms.h b/libUseful-2.8/SpawnPrograms.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Terminal.c b/libUseful-2.8/Terminal.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Terminal.h b/libUseful-2.8/Terminal.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Time.c b/libUseful-2.8/Time.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Time.h b/libUseful-2.8/Time.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Tokenizer.c b/libUseful-2.8/Tokenizer.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Tokenizer.h b/libUseful-2.8/Tokenizer.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/URL.c b/libUseful-2.8/URL.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/URL.h b/libUseful-2.8/URL.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/Vars.c b/libUseful-2.8/Vars.c old mode 100644 new mode 100755 index cc9e2f8..57d3631 --- a/libUseful-2.8/Vars.c +++ b/libUseful-2.8/Vars.c @@ -8,7 +8,7 @@ ListNode *SetDetailVar(ListNode *Vars, const char *Name, const char *Data, int I ListNode *Node; char *Tempstr=NULL; -if (! Vars) return(NULL); +if (! Vars) return; Tempstr=CopyStr(Tempstr,Name); //strlwr(Tempstr); Node=ListFindNamedItem(Vars,Tempstr); diff --git a/libUseful-2.8/Vars.h b/libUseful-2.8/Vars.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/base64.c b/libUseful-2.8/base64.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/base64.h b/libUseful-2.8/base64.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/config.log b/libUseful-2.8/config.log deleted file mode 100644 index 1b5b577..0000000 --- a/libUseful-2.8/config.log +++ /dev/null @@ -1,657 +0,0 @@ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by configure, which was -generated by GNU Autoconf 2.69. Invocation command line was - - $ ./configure --disable-option-checking --prefix=/usr/local --enable-ssl --cache-file=/dev/null --srcdir=. - -## --------- ## -## Platform. ## -## --------- ## - -hostname = rack1 -uname -m = x86_64 -uname -r = 4.8.6-64 -uname -s = Linux -uname -v = #13 SMP Mon Nov 21 20:22:55 UTC 2016 - -/usr/bin/uname -p = unknown -/bin/uname -X = unknown - -/bin/arch = unknown -/usr/bin/arch -k = unknown -/usr/convex/getsysinfo = unknown -/usr/bin/hostinfo = unknown -/bin/machine = unknown -/usr/bin/oslevel = unknown -/bin/universe = unknown - -PATH: /usr/prebin -PATH: /usr/local/bin -PATH: /usr/bin -PATH: /usr/X11R7/bin -PATH: /bin -PATH: /usr/games/bin -PATH: . -PATH: /opt/chkrootkit-0.50/bin -PATH: /opt/gdbm-1.12/bin -PATH: /opt/git-2.10.2/bin -PATH: /opt/httpd/bin -PATH: /opt/lua-5.3.4/bin -PATH: /opt/mujs-b005928/bin -PATH: /opt/mujs/bin -PATH: /opt/perl-5.24.0/bin -PATH: /opt/radare-1.2.1/bin - - -## ----------- ## -## Core tests. ## -## ----------- ## - -configure:2148: checking for gcc -configure:2164: found /usr/bin/gcc -configure:2175: result: gcc -configure:2404: checking for C compiler version -configure:2413: gcc --version >&5 -gcc (GCC) 6.3.1 20170126 -Copyright (C) 2016 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -configure:2424: $? = 0 -configure:2413: gcc -v >&5 -Using built-in specs. -COLLECT_GCC=gcc -COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i486-pc-linux-gnu/6.3.1/lto-wrapper -Target: i486-pc-linux-gnu -Configured with: ../gcc-6-20170126-src/configure ../gcc-6.2.0-src/configure --prefix=/usr --sysconfdir=/etc --includedir=/usr/include --localstatedir=/var --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,c++,go --host=i486-pc-linux-gnu --build=i486-pc-linux-gnu --target=i486-pc-linux-gnu --enable-bootstrap -Thread model: posix -gcc version 6.3.1 20170126 (GCC) -configure:2424: $? = 0 -configure:2413: gcc -V >&5 -gcc: error: unrecognized command line option '-V' -gcc: fatal error: no input files -compilation terminated. -configure:2424: $? = 1 -configure:2413: gcc -qversion >&5 -gcc: error: unrecognized command line option '-qversion'; did you mean '--version'? -gcc: fatal error: no input files -compilation terminated. -configure:2424: $? = 1 -configure:2444: checking whether the C compiler works -configure:2466: gcc conftest.c >&5 -configure:2470: $? = 0 -configure:2518: result: yes -configure:2521: checking for C compiler default output file name -configure:2523: result: a.out -configure:2529: checking for suffix of executables -configure:2536: gcc -o conftest conftest.c >&5 -configure:2540: $? = 0 -configure:2562: result: -configure:2584: checking whether we are cross compiling -configure:2592: gcc -o conftest conftest.c >&5 -configure:2596: $? = 0 -configure:2603: ./conftest -configure:2607: $? = 0 -configure:2622: result: no -configure:2627: checking for suffix of object files -configure:2649: gcc -c conftest.c >&5 -configure:2653: $? = 0 -configure:2674: result: o -configure:2678: checking whether we are using the GNU C compiler -configure:2697: gcc -c conftest.c >&5 -configure:2697: $? = 0 -configure:2706: result: yes -configure:2715: checking whether gcc accepts -g -configure:2735: gcc -c -g conftest.c >&5 -configure:2735: $? = 0 -configure:2776: result: yes -configure:2793: checking for gcc option to accept ISO C89 -configure:2856: gcc -c -g -O2 conftest.c >&5 -configure:2856: $? = 0 -configure:2869: result: none needed -configure:2895: checking whether make sets $(MAKE) -configure:2917: result: yes -configure:2932: checking how to run the C preprocessor -configure:2963: gcc -E conftest.c -configure:2963: $? = 0 -configure:2977: gcc -E conftest.c -conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory - #include - ^ -compilation terminated. -configure:2977: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| /* end confdefs.h. */ -| #include -configure:3002: result: gcc -E -configure:3022: gcc -E conftest.c -configure:3022: $? = 0 -configure:3036: gcc -E conftest.c -conftest.c:9:28: fatal error: ac_nonexistent.h: No such file or directory - #include - ^ -compilation terminated. -configure:3036: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| /* end confdefs.h. */ -| #include -configure:3065: checking for grep that handles long lines and -e -configure:3123: result: /bin/grep -configure:3128: checking for egrep -configure:3190: result: /bin/grep -E -configure:3195: checking for ANSI C header files -configure:3215: gcc -c -g -O2 conftest.c >&5 -configure:3215: $? = 0 -configure:3288: gcc -o conftest -g -O2 conftest.c >&5 -configure:3288: $? = 0 -configure:3288: ./conftest -configure:3288: $? = 0 -configure:3299: result: yes -configure:3314: checking for special C compiler options needed for large files -configure:3359: result: no -configure:3365: checking for _FILE_OFFSET_BITS value needed for large files -configure:3390: gcc -c -g -O2 conftest.c >&5 -conftest.c:15:33: warning: left shift count >= width of type [-Wshift-count-overflow] - #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - ^ -conftest.c:16:23: note: in expansion of macro 'LARGE_OFF_T' - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - ^~~~~~~~~~~ -conftest.c:15:57: warning: left shift count >= width of type [-Wshift-count-overflow] - #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - ^ -conftest.c:16:23: note: in expansion of macro 'LARGE_OFF_T' - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - ^~~~~~~~~~~ -conftest.c:15:33: warning: left shift count >= width of type [-Wshift-count-overflow] - #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - ^ -conftest.c:17:13: note: in expansion of macro 'LARGE_OFF_T' - && LARGE_OFF_T % 2147483647 == 1) - ^~~~~~~~~~~ -conftest.c:15:57: warning: left shift count >= width of type [-Wshift-count-overflow] - #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) - ^ -conftest.c:17:13: note: in expansion of macro 'LARGE_OFF_T' - && LARGE_OFF_T % 2147483647 == 1) - ^~~~~~~~~~~ -conftest.c:16:7: error: variably modified 'off_t_is_large' at file scope - int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 - ^~~~~~~~~~~~~~ -configure:3390: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| #define STDC_HEADERS 1 -| /* end confdefs.h. */ -| #include -| /* Check that off_t can represent 2**63 - 1 correctly. -| We can't simply define LARGE_OFF_T to be 9223372036854775807, -| since some C++ compilers masquerading as C compilers -| incorrectly reject 9223372036854775807. */ -| #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) -| int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 -| && LARGE_OFF_T % 2147483647 == 1) -| ? 1 : -1]; -| int -| main () -| { -| -| ; -| return 0; -| } -configure:3414: gcc -c -g -O2 conftest.c >&5 -configure:3414: $? = 0 -configure:3422: result: 64 -configure:3517: checking for ptsname_r in -lc -configure:3542: gcc -o conftest -g -O2 conftest.c -lc >&5 -configure:3542: $? = 0 -configure:3551: result: yes -configure:3583: checking for sys/types.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for sys/stat.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for stdlib.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for string.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for memory.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for strings.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for inttypes.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for stdint.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3583: checking for unistd.h -configure:3583: gcc -c -g -O2 conftest.c >&5 -configure:3583: $? = 0 -configure:3583: result: yes -configure:3595: checking sys/sendfile.h usability -configure:3595: gcc -c -g -O2 conftest.c >&5 -configure:3595: $? = 0 -configure:3595: result: yes -configure:3595: checking sys/sendfile.h presence -configure:3595: gcc -E conftest.c -configure:3595: $? = 0 -configure:3595: result: yes -configure:3595: checking for sys/sendfile.h -configure:3595: result: yes -configure:3634: checking for SSL_library_init in -lssl -configure:3659: gcc -o conftest -g -O2 conftest.c -lssl -lc >&5 -configure:3659: $? = 0 -configure:3668: result: yes -configure:3681: checking for EVP_CIPHER_CTX_init in -lcrypto -configure:3706: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3706: $? = 0 -configure:3715: result: yes -configure:3731: checking for OpenSSL_add_all_algorithms -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -/tmp/ccCwcCNf.o: In function `main': -/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms' -collect2: error: ld returned 1 exit status -configure:3731: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| #define STDC_HEADERS 1 -| #define _FILE_OFFSET_BITS 64 -| #define HAVE_LIBC 1 -| #define HAVE_PTSNAME_R 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define USE_SENDFILE 1 -| #define HAVE_LIBSSL 1 -| #define HAVE_LIBCRYPTO 1 -| /* end confdefs.h. */ -| /* Define OpenSSL_add_all_algorithms to an innocuous variant, in case declares OpenSSL_add_all_algorithms. -| For example, HP-UX 11i declares gettimeofday. */ -| #define OpenSSL_add_all_algorithms innocuous_OpenSSL_add_all_algorithms -| -| /* System header to define __stub macros and hopefully few prototypes, -| which can conflict with char OpenSSL_add_all_algorithms (); below. -| Prefer to if __STDC__ is defined, since -| exists even on freestanding compilers. */ -| -| #ifdef __STDC__ -| # include -| #else -| # include -| #endif -| -| #undef OpenSSL_add_all_algorithms -| -| /* Override any GCC internal prototype to avoid an error. -| Use char because int might match the return type of a GCC -| builtin and then its argument prototype would still apply. */ -| #ifdef __cplusplus -| extern "C" -| #endif -| char OpenSSL_add_all_algorithms (); -| /* The GNU C library defines this for functions which it implements -| to always fail with ENOSYS. Some functions are actually named -| something starting with __ and the normal name is an alias. */ -| #if defined __stub_OpenSSL_add_all_algorithms || defined __stub___OpenSSL_add_all_algorithms -| choke me -| #endif -| -| int -| main () -| { -| return OpenSSL_add_all_algorithms (); -| ; -| return 0; -| } -configure:3731: result: no -configure:3731: checking for EVP_bf_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_rc2_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_rc4 -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_rc5_32_12_16_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -/tmp/ccorkH47.o: In function `main': -/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc' -collect2: error: ld returned 1 exit status -configure:3731: $? = 1 -configure: failed program was: -| /* confdefs.h */ -| #define PACKAGE_NAME "" -| #define PACKAGE_TARNAME "" -| #define PACKAGE_VERSION "" -| #define PACKAGE_STRING "" -| #define PACKAGE_BUGREPORT "" -| #define PACKAGE_URL "" -| #define STDC_HEADERS 1 -| #define _FILE_OFFSET_BITS 64 -| #define HAVE_LIBC 1 -| #define HAVE_PTSNAME_R 1 -| #define HAVE_SYS_TYPES_H 1 -| #define HAVE_SYS_STAT_H 1 -| #define HAVE_STDLIB_H 1 -| #define HAVE_STRING_H 1 -| #define HAVE_MEMORY_H 1 -| #define HAVE_STRINGS_H 1 -| #define HAVE_INTTYPES_H 1 -| #define HAVE_STDINT_H 1 -| #define HAVE_UNISTD_H 1 -| #define USE_SENDFILE 1 -| #define HAVE_LIBSSL 1 -| #define HAVE_LIBCRYPTO 1 -| #define HAVE_EVP_BF_CBC 1 -| #define HAVE_EVP_RC2_CBC 1 -| #define HAVE_EVP_RC4 1 -| /* end confdefs.h. */ -| /* Define EVP_rc5_32_12_16_cbc to an innocuous variant, in case declares EVP_rc5_32_12_16_cbc. -| For example, HP-UX 11i declares gettimeofday. */ -| #define EVP_rc5_32_12_16_cbc innocuous_EVP_rc5_32_12_16_cbc -| -| /* System header to define __stub macros and hopefully few prototypes, -| which can conflict with char EVP_rc5_32_12_16_cbc (); below. -| Prefer to if __STDC__ is defined, since -| exists even on freestanding compilers. */ -| -| #ifdef __STDC__ -| # include -| #else -| # include -| #endif -| -| #undef EVP_rc5_32_12_16_cbc -| -| /* Override any GCC internal prototype to avoid an error. -| Use char because int might match the return type of a GCC -| builtin and then its argument prototype would still apply. */ -| #ifdef __cplusplus -| extern "C" -| #endif -| char EVP_rc5_32_12_16_cbc (); -| /* The GNU C library defines this for functions which it implements -| to always fail with ENOSYS. Some functions are actually named -| something starting with __ and the normal name is an alias. */ -| #if defined __stub_EVP_rc5_32_12_16_cbc || defined __stub___EVP_rc5_32_12_16_cbc -| choke me -| #endif -| -| int -| main () -| { -| return EVP_rc5_32_12_16_cbc (); -| ; -| return 0; -| } -configure:3731: result: no -configure:3731: checking for EVP_des_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_desx_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_cast5_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_idea_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_aes_128_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3731: checking for EVP_aes_256_cbc -configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -configure:3731: $? = 0 -configure:3731: result: yes -configure:3741: checking that OpenSSL Library is at least version 0.9.7 -configure:3755: result: yes -configure:3782: checking for deflate in -lz -configure:3807: gcc -o conftest -g -O2 conftest.c -lz -lcrypto -lssl -lc >&5 -configure:3807: $? = 0 -configure:3816: result: yes -configure:3841: checking sys/soundcard.h usability -configure:3841: gcc -c -g -O2 conftest.c >&5 -configure:3841: $? = 0 -configure:3841: result: yes -configure:3841: checking sys/soundcard.h presence -configure:3841: gcc -E conftest.c -configure:3841: $? = 0 -configure:3841: result: yes -configure:3841: checking for sys/soundcard.h -configure:3841: result: yes -configure:4057: creating ./config.status - -## ---------------------- ## -## Running config.status. ## -## ---------------------- ## - -This file was extended by config.status, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = - CONFIG_HEADERS = - CONFIG_LINKS = - CONFIG_COMMANDS = - $ ./config.status - -on rack1 - -config.status:727: creating Makefile - -## ---------------- ## -## Cache variables. ## -## ---------------- ## - -ac_cv_c_compiler_gnu=yes -ac_cv_env_CC_set= -ac_cv_env_CC_value= -ac_cv_env_CFLAGS_set= -ac_cv_env_CFLAGS_value= -ac_cv_env_CPPFLAGS_set= -ac_cv_env_CPPFLAGS_value= -ac_cv_env_CPP_set= -ac_cv_env_CPP_value= -ac_cv_env_LDFLAGS_set= -ac_cv_env_LDFLAGS_value= -ac_cv_env_LIBS_set= -ac_cv_env_LIBS_value= -ac_cv_env_build_alias_set= -ac_cv_env_build_alias_value= -ac_cv_env_host_alias_set= -ac_cv_env_host_alias_value= -ac_cv_env_target_alias_set= -ac_cv_env_target_alias_value= -ac_cv_func_EVP_aes_128_cbc=yes -ac_cv_func_EVP_aes_256_cbc=yes -ac_cv_func_EVP_bf_cbc=yes -ac_cv_func_EVP_cast5_cbc=yes -ac_cv_func_EVP_des_cbc=yes -ac_cv_func_EVP_desx_cbc=yes -ac_cv_func_EVP_idea_cbc=yes -ac_cv_func_EVP_rc2_cbc=yes -ac_cv_func_EVP_rc4=yes -ac_cv_func_EVP_rc5_32_12_16_cbc=no -ac_cv_func_OpenSSL_add_all_algorithms=no -ac_cv_header_inttypes_h=yes -ac_cv_header_memory_h=yes -ac_cv_header_stdc=yes -ac_cv_header_stdint_h=yes -ac_cv_header_stdlib_h=yes -ac_cv_header_string_h=yes -ac_cv_header_strings_h=yes -ac_cv_header_sys_sendfile_h=yes -ac_cv_header_sys_soundcard_h=yes -ac_cv_header_sys_stat_h=yes -ac_cv_header_sys_types_h=yes -ac_cv_header_unistd_h=yes -ac_cv_lib_c_ptsname_r=yes -ac_cv_lib_crypto_EVP_CIPHER_CTX_init=yes -ac_cv_lib_ssl_SSL_library_init=yes -ac_cv_lib_z_deflate=yes -ac_cv_objext=o -ac_cv_path_EGREP='/bin/grep -E' -ac_cv_path_GREP=/bin/grep -ac_cv_prog_CPP='gcc -E' -ac_cv_prog_ac_ct_CC=gcc -ac_cv_prog_cc_c89= -ac_cv_prog_cc_g=yes -ac_cv_prog_make_make_set=yes -ac_cv_sys_file_offset_bits=64 -ac_cv_sys_largefile_CC=no - -## ----------------- ## -## Output variables. ## -## ----------------- ## - -CC='gcc' -CFLAGS='-g -O2' -CPP='gcc -E' -CPPFLAGS='' -DEFS='-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_EVP_BF_CBC=1 -DHAVE_EVP_RC2_CBC=1 -DHAVE_EVP_RC4=1 -DHAVE_EVP_DES_CBC=1 -DHAVE_EVP_DESX_CBC=1 -DHAVE_EVP_CAST5_CBC=1 -DHAVE_EVP_IDEA_CBC=1 -DHAVE_EVP_AES_128_CBC=1 -DHAVE_EVP_AES_256_CBC=1 -DUSE_OPENSSL_ADD_ALL_ALGORITHMS=1 -DHAVE_LIBZ=1 -DHAVE_OSS=1' -ECHO_C='' -ECHO_N='-n' -ECHO_T='' -EGREP='/bin/grep -E' -EXEEXT='' -GREP='/bin/grep' -LDFLAGS='' -LIBOBJS='' -LIBS='-lz -lcrypto -lssl -lc ' -LTLIBOBJS='' -OBJEXT='o' -PACKAGE_BUGREPORT='' -PACKAGE_NAME='' -PACKAGE_STRING='' -PACKAGE_TARNAME='' -PACKAGE_URL='' -PACKAGE_VERSION='' -PATH_SEPARATOR=':' -SET_MAKE='' -SHELL='/bin/sh' -VERSION='0.0.1' -ac_ct_CC='gcc' -bindir='${exec_prefix}/bin' -build_alias='' -datadir='${datarootdir}' -datarootdir='${prefix}/share' -docdir='${datarootdir}/doc/${PACKAGE}' -dvidir='${docdir}' -exec_prefix='${prefix}' -host_alias='' -htmldir='${docdir}' -includedir='${prefix}/include' -infodir='${datarootdir}/info' -libdir='${exec_prefix}/lib' -libexecdir='${exec_prefix}/libexec' -localedir='${datarootdir}/locale' -localstatedir='${prefix}/var' -mandir='${datarootdir}/man' -oldincludedir='/usr/include' -pdfdir='${docdir}' -prefix='/usr/local' -program_transform_name='s,x,x,' -psdir='${docdir}' -sbindir='${exec_prefix}/sbin' -sharedstatedir='${prefix}/com' -sysconfdir='${prefix}/etc' -target_alias='' - -## ----------- ## -## confdefs.h. ## -## ----------- ## - -/* confdefs.h */ -#define PACKAGE_NAME "" -#define PACKAGE_TARNAME "" -#define PACKAGE_VERSION "" -#define PACKAGE_STRING "" -#define PACKAGE_BUGREPORT "" -#define PACKAGE_URL "" -#define STDC_HEADERS 1 -#define _FILE_OFFSET_BITS 64 -#define HAVE_LIBC 1 -#define HAVE_PTSNAME_R 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_UNISTD_H 1 -#define USE_SENDFILE 1 -#define HAVE_LIBSSL 1 -#define HAVE_LIBCRYPTO 1 -#define HAVE_EVP_BF_CBC 1 -#define HAVE_EVP_RC2_CBC 1 -#define HAVE_EVP_RC4 1 -#define HAVE_EVP_DES_CBC 1 -#define HAVE_EVP_DESX_CBC 1 -#define HAVE_EVP_CAST5_CBC 1 -#define HAVE_EVP_IDEA_CBC 1 -#define HAVE_EVP_AES_128_CBC 1 -#define HAVE_EVP_AES_256_CBC 1 -#define USE_OPENSSL_ADD_ALL_ALGORITHMS 1 -#define HAVE_LIBZ 1 -#define HAVE_OSS 1 - -configure: exit 0 diff --git a/libUseful-2.8/config.status b/libUseful-2.8/config.status deleted file mode 100755 index 9a693ac..0000000 --- a/libUseful-2.8/config.status +++ /dev/null @@ -1,894 +0,0 @@ -#! /bin/sh -# Generated by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by $as_me, which was -generated by GNU Autoconf 2.69. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -# Files that config.status was made for. -config_files=" Makefile" - -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -ac_cs_config="'--disable-option-checking' '--prefix=/usr/local' '--enable-ssl' '--cache-file=/dev/null' '--srcdir=.'" -ac_cs_version="\ -config.status -configured by ./configure, generated by GNU Autoconf 2.69, - with options \"$ac_cs_config\" - -Copyright (C) 2012 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='/home/metacosm89/coding-2017/Movgrab/libUseful-2.8' -srcdir='.' -test -n "$AWK" || AWK=awk -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -if $ac_cs_recheck; then - set X /bin/sh './configure' '--disable-option-checking' '--prefix=/usr/local' '--enable-ssl' '--cache-file=/dev/null' '--srcdir=.' $ac_configure_extra_args --no-create --no-recursion - shift - $as_echo "running CONFIG_SHELL=/bin/sh $*" >&6 - CONFIG_SHELL='/bin/sh' - export CONFIG_SHELL - exec "$@" -fi - -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -cat >>"$ac_tmp/subs1.awk" <<\_ACAWK && -S["LTLIBOBJS"]="" -S["LIBOBJS"]="" -S["EGREP"]="/bin/grep -E" -S["GREP"]="/bin/grep" -S["CPP"]="gcc -E" -S["SET_MAKE"]="" -S["OBJEXT"]="o" -S["EXEEXT"]="" -S["ac_ct_CC"]="gcc" -S["CPPFLAGS"]="" -S["LDFLAGS"]="" -S["CFLAGS"]="-g -O2" -S["CC"]="gcc" -S["VERSION"]="0.0.1" -S["target_alias"]="" -S["host_alias"]="" -S["build_alias"]="" -S["LIBS"]="-lz -lcrypto -lssl -lc " -S["ECHO_T"]="" -S["ECHO_N"]="-n" -S["ECHO_C"]="" -S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DSTDC_HEADERS=1"\ -" -D_FILE_OFFSET_BITS=64 -DHAVE_LIBC=1 -DHAVE_PTSNAME_R=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_"\ -"H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_SENDFILE=1 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1 -DHAVE_EVP_BF_CBC"\ -"=1 -DHAVE_EVP_RC2_CBC=1 -DHAVE_EVP_RC4=1 -DHAVE_EVP_DES_CBC=1 -DHAVE_EVP_DESX_CBC=1 -DHAVE_EVP_CAST5_CBC=1 -DHAVE_EVP_IDEA_CBC=1 -DHAVE_EVP_AES_128_"\ -"CBC=1 -DHAVE_EVP_AES_256_CBC=1 -DUSE_OPENSSL_ADD_ALL_ALGORITHMS=1 -DHAVE_LIBZ=1 -DHAVE_OSS=1" -S["mandir"]="${datarootdir}/man" -S["localedir"]="${datarootdir}/locale" -S["libdir"]="${exec_prefix}/lib" -S["psdir"]="${docdir}" -S["pdfdir"]="${docdir}" -S["dvidir"]="${docdir}" -S["htmldir"]="${docdir}" -S["infodir"]="${datarootdir}/info" -S["docdir"]="${datarootdir}/doc/${PACKAGE}" -S["oldincludedir"]="/usr/include" -S["includedir"]="${prefix}/include" -S["localstatedir"]="${prefix}/var" -S["sharedstatedir"]="${prefix}/com" -S["sysconfdir"]="${prefix}/etc" -S["datadir"]="${datarootdir}" -S["datarootdir"]="${prefix}/share" -S["libexecdir"]="${exec_prefix}/libexec" -S["sbindir"]="${exec_prefix}/sbin" -S["bindir"]="${exec_prefix}/bin" -S["program_transform_name"]="s,x,x," -S["prefix"]="/usr/local" -S["exec_prefix"]="${prefix}" -S["PACKAGE_URL"]="" -S["PACKAGE_BUGREPORT"]="" -S["PACKAGE_STRING"]="" -S["PACKAGE_VERSION"]="" -S["PACKAGE_TARNAME"]="" -S["PACKAGE_NAME"]="" -S["PATH_SEPARATOR"]=":" -S["SHELL"]="/bin/sh" -_ACAWK -cat >>"$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} - ac_datarootdir_hack=' - s&@datadir@&${datarootdir}&g - s&@docdir@&${datarootdir}/doc/${PACKAGE}&g - s&@infodir@&${datarootdir}/info&g - s&@localedir@&${datarootdir}/locale&g - s&@mandir@&${datarootdir}/man&g - s&\${datarootdir}&${prefix}/share&g' ;; -esac -ac_sed_extra="/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -} - -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 diff --git a/libUseful-2.8/configure.ac b/libUseful-2.8/configure.ac old mode 100644 new mode 100755 diff --git a/libUseful-2.8/crc32.c b/libUseful-2.8/crc32.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/crc32.h b/libUseful-2.8/crc32.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/defines.h b/libUseful-2.8/defines.h old mode 100644 new mode 100755 index 3bb114c..0488dc8 --- a/libUseful-2.8/defines.h +++ b/libUseful-2.8/defines.h @@ -18,7 +18,7 @@ extern "C" { #endif -typedef int (*BASIC_FUNC)(void *Data); +typedef int (*BASIC_FUNC)(void *Data, int Flags); #ifdef __cplusplus diff --git a/libUseful-2.8/expect.c b/libUseful-2.8/expect.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/expect.h b/libUseful-2.8/expect.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/file.c b/libUseful-2.8/file.c old mode 100644 new mode 100755 index bb69107..56730ed --- a/libUseful-2.8/file.c +++ b/libUseful-2.8/file.c @@ -437,6 +437,7 @@ void STREAMClear(STREAM *S) { STREAMFlush(S); S->InStart=0; + S->InEnd=0; //clear input buffer, because anything might be hanging about in there and //we don't want sensitive data persisiting in memory xmemset(S->InputBuff,0,S->BuffSize); @@ -728,8 +729,14 @@ while (*ptr != '\0') switch (*ptr) { case 'c': Flags |= SF_CREATE; break; -case 'r': Flags |= SF_RDONLY; break; -case 'w': Flags |= SF_WRONLY | SF_CREATE| SF_TRUNC; break; +case 'r': + if (Flags & SF_WRONLY) Flags &= ~(SF_RDONLY | SF_WRONLY); + else Flags |= SF_RDONLY; +break; +case 'w': + if (Flags & SF_RDONLY) Flags &= ~(SF_RDONLY | SF_WRONLY); + else Flags |= SF_WRONLY | SF_CREATE| SF_TRUNC; +break; case 'a': Flags |= SF_APPEND | SF_CREATE; break; case 'm': Flags |= SF_MMAP ; break; case 's': Flags |= SF_SECURE; break; @@ -807,7 +814,9 @@ else { S=STREAMCreate(); S->Path=CopyStr(S->Path,URL); - if (! STREAMProtocolConnect(S, Proto, Host, Port, 0)) + if (Port > 0) Token=CopyStr(Token,Host); + else Token=CopyStr(Token,URL+StrLen(Proto)+1); + if (! STREAMProtocolConnect(S, Proto, Token, Port, 0)) { STREAMClose(S); S=NULL; @@ -960,9 +969,9 @@ return(fd); int STREAMReadCharsToBuffer(STREAM *S) { fd_set selectset; -int result=0, diff, read_result=0, WaitForBytes=TRUE; +int result=0, diff, read_result=0, WaitForBytes=TRUE, PeerPort; struct timeval tv; -char *tmpBuff=NULL; +char *tmpBuff=NULL, *Peer=NULL; #ifdef HAVE_LIBSSL void *SSL_CTX=NULL; #endif @@ -973,28 +982,29 @@ if (! S) return(0); //use to indicate a stream must be ignored for a while if (S->State & SS_EMBARGOED) return(0); -//we don't read to mmaped streams. We just update pointers to the mmap -if (S->Flags & SF_MMAP) +//number of bytes queued in STREAM +diff=S->InEnd-S->InStart; + +if (diff > 0) { - result=S->InEnd-S->InStart; - if (result < 1) return(STREAM_CLOSED); - return(result); + //for UDP we recv messages, and we must consume (or flush) all of one before getting the next + if (S->Type==STREAM_TYPE_UDP) return(diff); + + //we never read from an MMAP, it's just a block of memory that we copy bytes from + if (S->Flags & SF_MMAP) return(diff); } - - -if (S->InStart >= S->InEnd) +else { + //if we traverse all bytes in an MMAP, then we return STREAM_CLOSED to tell that we're at the end + if (S->Flags & SF_MMAP) return(STREAM_CLOSED); + + //if it's empty, then reset all the pointers for a fresh read S->InEnd=0; S->InStart=0; + diff=0; } -diff=S->InEnd-S->InStart; - -//if buffer is half full, or full 'cept for space at the start, then make room -if ( - (S->InStart > (S->BuffSize / 2)) || - ((S->InEnd >= S->BuffSize) && (S->InStart > 0)) - ) +if (S->InStart > (S->BuffSize / 2)) { memmove(S->InputBuff,S->InputBuff + S->InStart,diff); S->InStart=0; @@ -1025,9 +1035,9 @@ if ((S->Timeout > 0) && WaitForBytes) { FD_ZERO(&selectset); FD_SET(S->in_fd, &selectset); - result=(S->Timeout % 100); - tv.tv_usec=result * 10000; - tv.tv_sec=S->Timeout / 100; + result=(S->Timeout % 100); + tv.tv_usec=result * 10000; + tv.tv_sec=S->Timeout / 100; result=select(S->in_fd+1,&selectset,NULL,NULL,&tv); @@ -1063,9 +1073,17 @@ if (read_result==0) if (S->State & SS_SSL) { read_result=SSL_read((SSL *) SSL_CTX, tmpBuff, S->BuffSize-S->InEnd); + S->State |= SS_EMBARGOED; } else #endif + if (S->Type==STREAM_TYPE_UDP) + { + read_result=UDPRecv(S->in_fd, tmpBuff, S->BuffSize-S->InEnd, &Peer, &PeerPort); + STREAMSetValue(S, "Peer", Peer); + DestroyString(Peer); + } + else { if (S->Flags & SF_RDLOCK) flock(S->in_fd,LOCK_SH); read_result=read(S->in_fd, tmpBuff, S->BuffSize-S->InEnd); @@ -1087,16 +1105,21 @@ if (read_result==0) if (result < 0) { STREAMReadThroughProcessors(S, tmpBuff, 0); - read_result=0; + read_result=result; +} +else +{ + result=STREAMReadThroughProcessors(S, tmpBuff, result); + if (result > 0) read_result=result; } -else read_result=STREAMReadThroughProcessors(S, tmpBuff, result); +/* if (read_result < 1) { if (result < 0) read_result=result; else read_result=STREAM_NODATA; } - +*/ //We are not returning number of bytes read. We only return something if //there is a condition (like socket close) where the thing we are waiting for @@ -1660,6 +1683,39 @@ return(FALSE); +char *STREAMReadDocument(char *RetStr, STREAM *S) +{ +char *Tempstr=NULL; +int result, bytes_read=0; + +if (S->Size > 0) +{ + RetStr=SetStrLen(RetStr, S->Size); + while (bytes_read < S->Size) + { + result=STREAMReadBytes(S, RetStr+bytes_read,S->Size - bytes_read); + if (result > 0) bytes_read+=result; + else break; + } + RetStr[bytes_read]='\0'; +} +else +{ + RetStr=CopyStr(RetStr,""); + Tempstr=STREAMReadLine(Tempstr, S); + while (Tempstr) + { + RetStr=CatStr(RetStr, Tempstr); + Tempstr=STREAMReadLine(Tempstr, S); + } +} + +DestroyString(Tempstr); +return(RetStr); +} + + + char *STREAMGetValue(STREAM *S, const char *Name) { @@ -1932,3 +1988,19 @@ if ((result==STREAM_CLOSED) && (bytes_transferred==0) ) return(STREAM_CLOSED); return(bytes_transferred); } + +int STREAMCopy(STREAM *Src, const char *DestPath) +{ +STREAM *Dest; +int result; + +Dest=STREAMOpen(DestPath,"wc"); +if (! Dest) return(FALSE); + +result=STREAMSendFile(Src, Dest, 0, SENDFILE_LOOP); +// | SENDFILE_KERNEL); +STREAMClose(Dest); +return(result); +} + + diff --git a/libUseful-2.8/file.h b/libUseful-2.8/file.h old mode 100644 new mode 100755 index e30f739..b5901a2 --- a/libUseful-2.8/file.h +++ b/libUseful-2.8/file.h @@ -7,7 +7,7 @@ #include "list.h" -typedef enum {STREAM_TYPE_FILE, STREAM_TYPE_TTY, STREAM_TYPE_UNIX, STREAM_TYPE_UNIX_DGRAM, STREAM_TYPE_TCP, STREAM_TYPE_UDP, STREAM_TYPE_SSL, STREAM_TYPE_HTTP, STREAM_TYPE_CHUNKED_HTTP, STREAM_TYPE_MESSAGEBUS, STREAM_TYPE_UNIX_SERVER, STREAM_TYPE_TCP_SERVER, STREAM_TYPE_UNIX_ACCEPT, STREAM_TYPE_TCP_ACCEPT, STREAM_TYPE_TPROXY, STREAM_TYPE_UPROXY } ESTREAMType; +typedef enum {STREAM_TYPE_FILE, STREAM_TYPE_PIPE, STREAM_TYPE_TTY, STREAM_TYPE_UNIX, STREAM_TYPE_UNIX_DGRAM, STREAM_TYPE_TCP, STREAM_TYPE_UDP, STREAM_TYPE_SSL, STREAM_TYPE_HTTP, STREAM_TYPE_CHUNKED_HTTP, STREAM_TYPE_MESSAGEBUS, STREAM_TYPE_UNIX_SERVER, STREAM_TYPE_TCP_SERVER, STREAM_TYPE_UNIX_ACCEPT, STREAM_TYPE_TCP_ACCEPT, STREAM_TYPE_TPROXY, STREAM_TYPE_UPROXY } ESTREAMType; #define STREAM_FLUSH -1 @@ -170,6 +170,7 @@ int STREAMCheckForBytes(STREAM *); int STREAMCheckForWaitingChar(STREAM *S,unsigned char check_char); int STREAMCountWaitingBytes(STREAM *); int STREAMReadToString(STREAM *S, char **RetStr, int *len, const char *Term); +char *STREAMReadDocument(char *RetStr, STREAM *S); STREAM *STREAMSelect(ListNode *Streams, struct timeval *timeout); void STREAMSetValue(STREAM *S, const char *Name, const char *Value); @@ -178,6 +179,9 @@ void STREAMSetItem(STREAM *S, const char *Name, void *Item); void *STREAMGetItem(STREAM *S, const char *Name); unsigned long STREAMSendFile(STREAM *In, STREAM *Out, unsigned long Max, int Flags); +int STREAMCopy(STREAM *Src, const char *DestPath); + + #ifdef __cplusplus } diff --git a/libUseful-2.8/g711.c b/libUseful-2.8/g711.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/g711.h b/libUseful-2.8/g711.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/http.c b/libUseful-2.8/http.c old mode 100644 new mode 100755 index 6521024..c5bc9b0 --- a/libUseful-2.8/http.c +++ b/libUseful-2.8/http.c @@ -73,6 +73,7 @@ return(TRUE); } + int HTTPChunkedRead(TProcessingModule *Mod, const char *InBuff, int InLen, char **OutBuff, int *OutLen, int Flush) { size_t len=0, bytes_out=0; @@ -154,6 +155,7 @@ return(bytes_out); } + int HTTPChunkedClose(TProcessingModule *Mod) { THTTPChunk *Chunk; @@ -495,14 +497,6 @@ char *AppendCookies(char *InStr, ListNode *CookieList) return(Tempstr); } - -void HTTPClearCookies() -{ -ListClear(Cookies, DestroyString); -} - - - int HTTPHandleWWWAuthenticate(char *Line, int *Type, char **Config) { char *ptr, *ptr2, *Token=NULL, *Name=NULL, *Value=NULL; @@ -1092,7 +1086,7 @@ while (ptr) } if (Info->Flags & HTTP_TUNNEL) STREAMAddConnectionHop(S,Info->Proxy); -Tempstr=FormatStr(Tempstr,"tcp:%s:%d",Host,Port); +Tempstr=FormatStr(Tempstr,"tcp:%s:%d/",Host,Port); if (STREAMConnect(S,Tempstr,Flags)) { S->Type=STREAM_TYPE_HTTP; @@ -1130,6 +1124,8 @@ if (g_Flags & HTTP_REQ_HTTPS) return(S); if (!S) S=HTTPSetupConnection(Info, FALSE); +S->Path=FormatStr(S->Path,"%s://%s:%d/%s",Info->Protocol,Info->Host,Info->Port,Info->Doc); + return(S); } @@ -1263,39 +1259,6 @@ while (result > 0) } -char *HTTPReadDocument(char *RetStr, STREAM *S) -{ -char *Tempstr=NULL, *ptr; -int result, bytes_read=0, len=0; - -ptr=STREAMGetValue(S, "HTTP:Content-Length"); -if (ptr) len=atoi(ptr); - -if (len > 0) -{ - RetStr=SetStrLen(RetStr,len); - while (bytes_read < len) - { - result=STREAMReadBytes(S, RetStr+bytes_read,len-bytes_read); - if (result > 0) bytes_read+=result; - else break; - } - RetStr[bytes_read]='\0'; -} -else -{ - RetStr=CopyStr(RetStr,""); - Tempstr=STREAMReadLine(Tempstr, S); - while (Tempstr) - { - RetStr=CatStr(RetStr, Tempstr); - Tempstr=STREAMReadLine(Tempstr, S); - } -} - -DestroyString(Tempstr); -return(RetStr); -} int HTTPDownload(char *URL,char *Login,char *Password, STREAM *S) { diff --git a/libUseful-2.8/http.h b/libUseful-2.8/http.h old mode 100644 new mode 100755 index be87bd4..3e1b050 --- a/libUseful-2.8/http.h +++ b/libUseful-2.8/http.h @@ -93,7 +93,6 @@ char *HTTPUnQuote(char *RetBuff, const char *Str); void HTTPSetVar(const char *Name, const char *Var); -void HTTPClearCookies(); void HTTPInfoDestroy(void *p_Info); void HTTPInfoSetValues(HTTPInfoStruct *Info, const char *Host, int Port, const char *Logon, const char *Password, const char *Method, const char *Doc, const char *ContentType, int ContentLength); diff --git a/libUseful-2.8/includes.h b/libUseful-2.8/includes.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/inet.c b/libUseful-2.8/inet.c old mode 100644 new mode 100755 index b3058a1..075e94d --- a/libUseful-2.8/inet.c +++ b/libUseful-2.8/inet.c @@ -125,7 +125,7 @@ printf("GEOX: %d %s\n",S, Tempstr); if (S) { STREAMSetTimeout(S,100); - Tempstr=HTTPReadDocument(Tempstr,S); + Tempstr=STREAMReadDocument(Tempstr,S); printf("GEO2: %s\n",Tempstr); ptr=GetToken(Tempstr, ",", &Token,0); //IP ptr=GetToken(ptr, ",", &Token,0); //CountryCode diff --git a/libUseful-2.8/inet.h b/libUseful-2.8/inet.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/install-sh b/libUseful-2.8/install-sh old mode 100644 new mode 100755 diff --git a/libUseful-2.8/jh_ref.c b/libUseful-2.8/jh_ref.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/jh_ref.h b/libUseful-2.8/jh_ref.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/libUseful.h b/libUseful-2.8/libUseful.h old mode 100644 new mode 100755 index dec04e6..c1d23eb --- a/libUseful-2.8/libUseful.h +++ b/libUseful-2.8/libUseful.h @@ -40,7 +40,7 @@ #include "PatternMatch.h" #include "ConnectionChain.h" #include "SpawnPrograms.h" -#include "MessageBus.h" +//#include "MessageBus.h" #include "DataParser.h" #include "URL.h" #include "sound.h" diff --git a/libUseful-2.8/libsettings.c b/libUseful-2.8/libsettings.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/libsettings.h b/libUseful-2.8/libsettings.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/list.c b/libUseful-2.8/list.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/list.h b/libUseful-2.8/list.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/md5-global.h b/libUseful-2.8/md5-global.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/md5.h b/libUseful-2.8/md5.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/md5c.c b/libUseful-2.8/md5c.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/oauth.c b/libUseful-2.8/oauth.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/oauth.h b/libUseful-2.8/oauth.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/openssl.c b/libUseful-2.8/openssl.c old mode 100644 new mode 100755 index 7bf9b22..26ac3d9 --- a/libUseful-2.8/openssl.c +++ b/libUseful-2.8/openssl.c @@ -187,7 +187,6 @@ const SSL_CIPHER *Cipher; char *Tempstr=NULL; Cipher=SSL_get_current_cipher((const SSL *) ptr); - if (Cipher) { Tempstr=FormatStr(Tempstr,"%d",SSL_CIPHER_get_bits(Cipher,NULL)); @@ -235,6 +234,8 @@ BIO *b; } #endif + + int OpenSSLVerifyCertificate(STREAM *S) { int RetVal=FALSE; @@ -268,8 +269,13 @@ if (cert) ptr=GetNameValuePair(ptr,"/","=",&Name,&Value); } + if (StrValid(S->Path)) + { ParseURL(S->Path,NULL,&Name,NULL,NULL,NULL,NULL,NULL); val=X509_check_host(cert, Name, StrLen(Name), 0, NULL); + } + else val=0; + if (val!=1) STREAMSetValue(S,"SSL-Certificate-Verify","Certificate hostname missmatch"); else @@ -417,7 +423,6 @@ if (S) OpenSSLQueryCipher(S); OpenSSLVerifyCertificate(S); - result=TRUE; } } @@ -528,6 +533,7 @@ if (S) { result=SSL_accept(ssl); if (result != TRUE) result=SSL_get_error(ssl,result); + switch (result) { case SSL_ERROR_WANT_READ: diff --git a/libUseful-2.8/openssl.h b/libUseful-2.8/openssl.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/pty.c b/libUseful-2.8/pty.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/pty.h b/libUseful-2.8/pty.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/securemem.c b/libUseful-2.8/securemem.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/securemem.h b/libUseful-2.8/securemem.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/sha1.c b/libUseful-2.8/sha1.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/sha1.h b/libUseful-2.8/sha1.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/sha2.c b/libUseful-2.8/sha2.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/sha2.h b/libUseful-2.8/sha2.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/socket.c b/libUseful-2.8/socket.c old mode 100644 new mode 100755 index 7afcc53..0ccaf4f --- a/libUseful-2.8/socket.c +++ b/libUseful-2.8/socket.c @@ -287,7 +287,25 @@ int BindSock(int Type, const char *Address, int Port, int Flags) salen=SockAddrCreate(&sa, Address, Port); if (salen==0) return(-1); - fd=socket(sa->sa_family, Type, 0); + if (Flags & BIND_RAW) + { + if (Type==SOCK_STREAM) fd=socket(sa->sa_family, SOCK_RAW, IPPROTO_TCP); + else if (Type==SOCK_DGRAM) fd=socket(sa->sa_family, SOCK_RAW, IPPROTO_UDP); + } + else fd=socket(sa->sa_family, Type, 0); + + //REISEADDR and REUSEPORT must be set BEFORE bind + result=1; + #ifdef SO_REUSEADDR + setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&result,sizeof(result)); + #endif + +/* + #ifdef SO_REUSEPORT + setsockopt(fd,SOL_SOCKET,SO_REUSEPORT,&result,sizeof(result)); + #endif +*/ + result=bind(fd, sa, salen); free(sa); @@ -299,8 +317,7 @@ int BindSock(int Type, const char *Address, int Port, int Flags) //No reason to pass server/listen fdets across an exec if (Flags & BIND_CLOEXEC) fcntl(fd, F_SETFD, FD_CLOEXEC); - result=1; - setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,&result,sizeof(result)); + if (Flags & BIND_LISTEN) result=listen(fd,10); @@ -395,15 +412,16 @@ const char *GetInterfaceIP(const char *Interface) { int fd, result; struct ifreq ifr; - + + if (! StrValid(Interface)) return(""); fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd==-1) return(""); ifr.ifr_addr.sa_family = AF_INET; strncpy(ifr.ifr_name, Interface, IFNAMSIZ-1); result=ioctl(fd, SIOCGIFADDR, &ifr); - if (result==-1) return(""); close(fd); + if (result==-1) return(""); return(inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr)); } @@ -536,10 +554,6 @@ return(UDPSend(S->out_fd, Host, Port, Data, len)); int IPServerInit(int Type, const char *Address, int Port) { int sock; -//struct sockaddr_storage sa; -struct sockaddr_in *sa4; -struct sockaddr_in6 *sa6; -int result; const char *p_Addr=NULL, *ptr; @@ -556,10 +570,7 @@ return(sock); int IPServerInit(int Type, const char *Address, int Port) { -struct sockaddr_in sa; -int result; const char *ptr=NULL; -socklen_t salen; int sock; @@ -596,6 +607,36 @@ return(sock); } +STREAM *STREAMFromSock(int sock, int Type, const char *Peer, const char *DestIP, int DestPort) +{ +STREAM *S; +char *Tempstr=NULL; + +S=STREAMFromFD(sock); +if (! S) return(S); + +S->Type=Type; +if (StrValid(Peer)) +{ +if (strncmp(Peer,"::ffff:",7)==0) STREAMSetValue(S,"Peer",Peer+7); +else STREAMSetValue(S,"Peer",Peer); +} + +if (StrValid(DestIP)) +{ + if (strncmp(DestIP,"::ffff:",7)==0) STREAMSetValue(S,"DestIP",DestIP+7); + else STREAMSetValue(S,"DestIP",DestIP); + if (DestPort > 0) + { + Tempstr=FormatStr(Tempstr, "%d",DestPort); + STREAMSetValue(S,"DestPort",Tempstr); + } +} + +DestroyString(Tempstr); + +return(S); +} STREAM *STREAMServerInit(const char *URL) { @@ -624,12 +665,6 @@ else if (strcmp(Proto,"unixdgram")==0) fd=UnixServerInit(SOCK_DGRAM,Host); Type=STREAM_TYPE_UNIX_DGRAM; } -else if (strcmp(Proto,"uproxy")==0) -{ - fd=IPServerInit(SOCK_DGRAM,Host,Port); - Type=STREAM_TYPE_UPROXY; - if (fd > -1) SockSetOptions(fd,SOCK_TPROXY,0); -} break; case 't': @@ -647,11 +682,8 @@ else if (strcmp(Proto,"tproxy")==0) break; } -if (fd > -1) -{ - S=STREAMFromFD(fd); - S->Type=Type; -} +S=STREAMFromSock(fd, Type, NULL, Host, Port); +if (S) S->Path=CopyStr(S->Path, URL); DestroyString(Proto); DestroyString(Host); @@ -678,6 +710,7 @@ break; case STREAM_TYPE_TCP_SERVER: fd=IPServerAccept(Serv->in_fd, &Tempstr); +GetSockDetails(fd, &DestIP, &DestPort, NULL, NULL); type=STREAM_TYPE_TCP_ACCEPT; break; @@ -692,21 +725,7 @@ return(Serv); break; } -if (fd > -1) -{ -S=STREAMFromFD(fd); - -if (strncmp(Tempstr,"::ffff:",7)==0) STREAMSetValue(S,"Peer",Tempstr+7); -else STREAMSetValue(S,"Peer",Tempstr); -if (StrValid(DestIP)) -{ - if (strncmp(DestIP,"::ffff:",7)==0) STREAMSetValue(S,"DestIP",DestIP+7); - else STREAMSetValue(S,"DestIP",DestIP); - Tempstr=FormatStr(Tempstr, "%d",DestPort); - STREAMSetValue(S,"DestPort",Tempstr); -} -S->Type=type; -} +S=STREAMFromSock(fd, type, Tempstr, DestIP, DestPort); DestroyString(Tempstr); DestroyString(DestIP); @@ -860,8 +879,8 @@ close(sock); return(-1); } -return(sock); +return(sock); } @@ -1043,6 +1062,7 @@ if ((HopNo==0) && StrValid(Host)) if (result==TRUE) { + S->Path=FormatStr(S->Path,"tcp:%s:%d/",Host,Port); if (Flags & CONNECT_NONBLOCK) { S->State |=SS_CONNECTING; diff --git a/libUseful-2.8/socket.h b/libUseful-2.8/socket.h old mode 100644 new mode 100755 index 564f088..056b54c --- a/libUseful-2.8/socket.h +++ b/libUseful-2.8/socket.h @@ -19,6 +19,7 @@ #define BIND_LISTEN 1 #define BIND_CLOEXEC 2 +#define BIND_RAW 4 #ifdef __cplusplus diff --git a/libUseful-2.8/sound.c b/libUseful-2.8/sound.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/sound.h b/libUseful-2.8/sound.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/ssh.c b/libUseful-2.8/ssh.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/ssh.h b/libUseful-2.8/ssh.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/string.c b/libUseful-2.8/string.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/string.h b/libUseful-2.8/string.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/tar.c b/libUseful-2.8/tar.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/tar.h b/libUseful-2.8/tar.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/unix_socket.c b/libUseful-2.8/unix_socket.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/unix_socket.h b/libUseful-2.8/unix_socket.h old mode 100644 new mode 100755 diff --git a/libUseful-2.8/whirlpool.c b/libUseful-2.8/whirlpool.c old mode 100644 new mode 100755 diff --git a/libUseful-2.8/whirlpool.h b/libUseful-2.8/whirlpool.h old mode 100644 new mode 100755 diff --git a/settings.c b/settings.c index be3302b..7f62352 100644 --- a/settings.c +++ b/settings.c @@ -56,7 +56,7 @@ fprintf(stdout," example: flv:640x480,flv,mp4,mp3\n"); fprintf(stdout," Use -T to get a list of formats the site offers\n"); fprintf(stdout," Use * to mean 'any format' (the default)\n"); fprintf(stdout," example: flv:640x480,mp4:640x480,*\n"); -fprintf(stdout,"'-o' specifies output file ( '-' for stdout)\n"); +fprintf(stdout,"'-o' specifies output file ( '-' for stdout, 'none' to suppress writing)\n"); fprintf(stdout,"'+o' add an output file to list of output files ( '-' for stdout)\n"); fprintf(stdout,"'-x' try to avoid 'family filter' on some sites\n"); fprintf(stdout,"'-n' For pages with multiple movies (not movie formats, but movies) specifes item selection for download. Argument has the form:\n");