FOSSology  4.4.0
Open Source License Compliance by Open Source Software
wget_agent.h
1 /*
2  SPDX-FileCopyrightText: © 2011-2014 Hewlett-Packard Development Company, L.P.
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 /*
8  * \file wget_agent.h
9  */
10 
11 #ifndef _WGET_AGENT_H
12 #define _WGET_AGENT_H 1
13 
14 /* specify support for files > 2G */
15 #define __USE_LARGEFILE64
16 
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <unistd.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <sys/wait.h>
23 #include <string.h>
24 #include <ctype.h>
25 #include <signal.h>
26 #include <grp.h>
27 #include <libgen.h>
28 
29 #define lstat64(x,y) lstat(x,y)
30 #define stat64(x,y) stat(x,y)
31 #define systemError(line, error, cmd) LOG_FATAL("[%s:%d] Error exit: %d, CMD:%s\n", __FILE__, line, WEXITSTATUS(error), cmd);
32 
33 typedef struct stat stat_t;
34 
35 #include "libfossology.h"
36 
37 #include "../../ununpack/agent/checksum.h"
38 
39 #define URLMAX 3072
40 #define STRMAX 2048
41 #define FILEPATH 2048
42 
43 extern char SQL[STRMAX];
44 
45 /* for the DB */
46 extern PGconn *pgConn;
47 /* input for this system */
48 extern long GlobalUploadKey;
49 extern char GlobalTempFile[STRMAX];
50 extern char GlobalURL[URLMAX];
51 extern char GlobalParam[STRMAX];
52 extern char GlobalType[STRMAX];
53 extern int GlobalImportGold; /* set to 0 to not store file in gold repository */
54 extern gid_t ForceGroup;
55 
56 /* for debugging */
57 extern int Debug;
58 
59 int IsFile(char *Fname, int Link);
60 void SafeExit (int rc);
61 int GetPosition(char *URL);
62 void DBLoadGold ();
63 int TaintURL(char *Sin, char *Sout, int SoutSize);
64 int GetURL(char *TempFile, char *URL, char *TempFileDir);
65 void SetEnv(char *S, char *TempFileDir);
66 char *PathCheck (char *DirPath);
67 
68 void Usage (char *Name);
69 
70 int Archivefs(char *Path, char *TempFile, char *TempFileDir, struct stat Status);
71 
72 int GetVersionControl();
73 
74 void GetProxy();
75 
77 
78 void MaskPassword();
79 
80 char* GetVersionControlCommand(int withPassword);
81 
82 #endif /* _WGET_AGENT_H */
83 
char SQL[256]
SQL query to execute.
Definition: adj2nest.c:78
PGconn * pgConn
Database connection.
Definition: adj2nest.c:86
Usage()
Print Usage statement.
Definition: fo_dbcheck.php:63
The main FOSSology C library.
void SafeExit(int rc)
Close scheduler and database connections, then exit.
Definition: utils.c:77
char * PathCheck(char *DirPath)
Check if path contains a "%U" or "%H". If so, substitute a unique ID for U.
Definition: utils.c:1662
int IsFile(long mode)
Check if the pfile_id is a file.
Definition: wc_agent.c:55
char GlobalParam[STRMAX]
Additional parameters.
Definition: wget_agent.c:27
char * GetVersionControlCommand(int withPassword)
get the command to run to get files from version control system
Definition: wget_agent.c:1118
char GlobalType[STRMAX]
Type of download (FILE/version control)
Definition: wget_agent.c:26
int GetURL(char *TempFile, char *URL, char *TempFileDir)
Do the wget.
Definition: wget_agent.c:328
int GetPosition(char *URL)
Get the position (ending + 1) of http|https|ftp:// of one url.
Definition: wget_agent.c:66
int TaintURL(char *Sin, char *Sout, int SoutSize)
Given a URL string, taint-protect it.
Definition: wget_agent.c:269
char GlobalURL[URLMAX]
URL to download.
Definition: wget_agent.c:25
int GetVersionControl()
Get source code from version control system.
Definition: wget_agent.c:566
void SetEnv(char *S, char *TempFileDir)
Convert input pairs into globals.
Definition: wget_agent.c:683
long GlobalUploadKey
Input for this system.
Definition: wget_agent.c:23
gid_t ForceGroup
Set to group id to be used for download files.
Definition: wget_agent.c:31
void MaskPassword()
Get the username from GlobalParam and create new parameters without password.
Definition: wget_agent.c:1063
void replace_url_with_auth()
Translate authentication of git clone.
Definition: wget_agent.c:1006
char GlobalTempFile[STRMAX]
Temp file to be used.
Definition: wget_agent.c:24
void DBLoadGold()
Insert a file into the database and repository.
Definition: wget_agent.c:81
void GetProxy()
Get proxy from fossology.conf.
Definition: wget_agent.c:916
int GlobalImportGold
Set to 0 to not store file in gold repository.
Definition: wget_agent.c:30
int Archivefs(char *Path, char *TempFile, char *TempFileDir, struct stat Status)
Copy downloaded files to temporary directory.
Definition: wget_agent.c:819