0002-fix-build-with-gcc-10.x.patch 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. Description: fix of FTBFS with gcc10
  2. Author: Thorsten Alteholz <debian@alteholz.de>
  3. Fetch from: <https://salsa.debian.org/debian-mobcom-team/smstools/-/blob/57a358a9eebbe2ca5639cc526f7027944ed95ea1/debian/patches/gcc10.patch>
  4. Signed-off-by: Michael Fischer <mf@go-sys.de>
  5. Index: smstools/src/smsd_cfg.h
  6. ===================================================================
  7. --- smstools.orig/src/smsd_cfg.h 2020-08-05 19:02:50.536596441 +0000
  8. +++ smstools/src/smsd_cfg.h 2020-08-05 19:33:22.915005150 +0000
  9. @@ -126,17 +126,17 @@
  10. #define ALPHABET_UNKNOWN 4
  11. #define ALPHABET_DEFAULT 0
  12. -char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
  13. -int process_id; // -1 for main task, all modems have numbers starting with 0.
  14. +extern char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
  15. +extern int process_id; // -1 for main task, all modems have numbers starting with 0.
  16. // This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
  17. -time_t process_start_time;
  18. +extern time_t process_start_time;
  19. -int modem_handle; // Handle for modem.
  20. +extern int modem_handle; // Handle for modem.
  21. -int put_command_timeouts;
  22. -unsigned long long put_command_sent; // 3.1.16beta.
  23. -char tmpdir[PATH_MAX]; // 3.1.16beta.
  24. +extern int put_command_timeouts;
  25. +extern unsigned long long put_command_sent; // 3.1.16beta.
  26. +extern char tmpdir[PATH_MAX]; // 3.1.16beta.
  27. typedef struct
  28. {
  29. @@ -284,204 +284,204 @@
  30. // NOTE for regular run intervals: effective value is at least delaytime.
  31. -char configfile[PATH_MAX]; // Path to config file
  32. -char d_spool[PATH_MAX]; // Spool directory
  33. -char d_failed[PATH_MAX]; // Failed spool directory
  34. -char d_failed_copy[PATH_MAX]; // 3.1.17.
  35. -char d_incoming[PATH_MAX]; // Incoming spool directory
  36. -char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
  37. -char d_report[PATH_MAX]; // Incoming report spool directory
  38. -char d_report_copy[PATH_MAX]; // 3.1.17.
  39. -char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
  40. -char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
  41. -char d_sent[PATH_MAX]; // Sent spool directory
  42. -char d_sent_copy[PATH_MAX]; // 3.1.17.
  43. -char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
  44. -char eventhandler[PATH_MAX]; // Global event handler program or script
  45. -char alarmhandler[PATH_MAX]; // Global alarm handler program or script
  46. -char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
  47. -int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
  48. -char logfile[PATH_MAX]; // Name or Handle of Log File
  49. -int loglevel; // Log Level (9=highest). Verbosity of log file.
  50. -_queue queues[NUMBER_OF_MODEMS]; // Queues
  51. -_device devices[NUMBER_OF_MODEMS]; // Modem devices
  52. -int delaytime; // sleep-time after workless
  53. -int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
  54. -int blocktime; // sleep-time after multiple errors
  55. -int blockafter; // Block modem after n errors
  56. -int errorsleeptime; // sleep-time after each error
  57. -int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
  58. -int receive_before_send; // if 1 smsd tries to receive one message before sending
  59. -int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
  60. -int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
  61. -int validity_period; // Validity period for messages.
  62. -int decode_unicode_text; // 1 if unicode text is decoded internally.
  63. -int internal_combine; // 1 if multipart message is combined internally.
  64. -int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
  65. -int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
  66. -int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
  67. - // outgoing directory to spooler. Works together with keep_filename.
  68. -int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
  69. -char regular_run[PATH_MAX]; // Script/program which is run regularly.
  70. -int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
  71. -char admin_to[SIZE_TO]; // Destination number for administrative messages.
  72. -int filename_preview; // Number of chars of message text to concatenate to filename.
  73. -int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
  74. -int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
  75. -int log_charconv; // 1 if character set conversion is logged.
  76. -int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
  77. -int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
  78. -int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
  79. -char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
  80. -int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
  81. -int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
  82. -int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
  83. -int ic_purge_interval; //
  84. -char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
  85. -char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
  86. -int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
  87. -int status_signal_quality; // 1 = signal quality is written to status file.
  88. -int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
  89. -int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
  90. -int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
  91. -int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
  92. -int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
  93. +extern char configfile[PATH_MAX]; // Path to config file
  94. +extern char d_spool[PATH_MAX]; // Spool directory
  95. +extern char d_failed[PATH_MAX]; // Failed spool directory
  96. +extern char d_failed_copy[PATH_MAX]; // 3.1.17.
  97. +extern char d_incoming[PATH_MAX]; // Incoming spool directory
  98. +extern char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
  99. +extern char d_report[PATH_MAX]; // Incoming report spool directory
  100. +extern char d_report_copy[PATH_MAX]; // 3.1.17.
  101. +extern char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
  102. +extern char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
  103. +extern char d_sent[PATH_MAX]; // Sent spool directory
  104. +extern char d_sent_copy[PATH_MAX]; // 3.1.17.
  105. +extern char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
  106. +extern char eventhandler[PATH_MAX]; // Global event handler program or script
  107. +extern char alarmhandler[PATH_MAX]; // Global alarm handler program or script
  108. +extern char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
  109. +extern int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
  110. +extern char logfile[PATH_MAX]; // Name or Handle of Log File
  111. +extern int loglevel; // Log Level (9=highest). Verbosity of log file.
  112. +extern _queue queues[NUMBER_OF_MODEMS]; // Queues
  113. +extern _device devices[NUMBER_OF_MODEMS]; // Modem devices
  114. +extern int delaytime; // sleep-time after workless
  115. +extern int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
  116. +extern int blocktime; // sleep-time after multiple errors
  117. +extern int blockafter; // Block modem after n errors
  118. +extern int errorsleeptime; // sleep-time after each error
  119. +extern int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
  120. +extern int receive_before_send; // if 1 smsd tries to receive one message before sending
  121. +extern int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
  122. +extern int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
  123. +extern int validity_period; // Validity period for messages.
  124. +extern int decode_unicode_text; // 1 if unicode text is decoded internally.
  125. +extern int internal_combine; // 1 if multipart message is combined internally.
  126. +extern int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
  127. +extern int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
  128. +extern int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
  129. +// outgoing directory to spooler. Works together with keep_filename.
  130. +extern int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
  131. +extern char regular_run[PATH_MAX]; // Script/program which is run regularly.
  132. +extern int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
  133. +extern char admin_to[SIZE_TO]; // Destination number for administrative messages.
  134. +extern int filename_preview; // Number of chars of message text to concatenate to filename.
  135. +extern int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
  136. +extern int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
  137. +extern int log_charconv; // 1 if character set conversion is logged.
  138. +extern int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
  139. +extern int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
  140. +extern int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
  141. +extern char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
  142. +extern int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
  143. +extern int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
  144. +extern int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
  145. +extern int ic_purge_interval; //
  146. +extern char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
  147. +extern char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
  148. +extern int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
  149. +extern int status_signal_quality; // 1 = signal quality is written to status file.
  150. +extern int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
  151. +extern int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
  152. +extern int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
  153. +extern int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
  154. +extern int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
  155. // 3.1.5:
  156. -int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
  157. +extern int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
  158. // 3.1.5:
  159. -int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
  160. +extern int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
  161. // 3.1.7:
  162. -int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
  163. +extern int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
  164. // 3.1.7:
  165. -mode_t conf_umask; // File mode creation mask for smsd and modem processes.
  166. +extern mode_t conf_umask; // File mode creation mask for smsd and modem processes.
  167. // 3.1.7:
  168. -int trim_text; // 1 = trailing whitespaces are removed from text:
  169. +extern int trim_text; // 1 = trailing whitespaces are removed from text:
  170. // 3.1.7:
  171. -int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
  172. +extern int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
  173. // 3.1.7:
  174. -int log_unmodified;
  175. +extern int log_unmodified;
  176. // 3.1.7:
  177. -char suspend_filename[PATH_MAX];
  178. +extern char suspend_filename[PATH_MAX];
  179. // 3.1.9:
  180. -int spool_directory_order;
  181. +extern int spool_directory_order;
  182. // 3.1.9: 1 if read_from_modem is logged.
  183. -int log_read_from_modem;
  184. +extern int log_read_from_modem;
  185. // 3.1.16beta2: log_read_timing for performance tuning.
  186. -int log_read_timing;
  187. +extern int log_read_timing;
  188. // 3.1.16beta:
  189. -int log_response_time;
  190. +extern int log_response_time;
  191. // 3.1.16beta2:
  192. -int default_alphabet;
  193. +extern int default_alphabet;
  194. // 3.1.17: Child process for the mainprocess:
  195. -char mainprocess_child[PATH_MAX];
  196. -char mainprocess_child_args[PATH_MAX];
  197. +extern char mainprocess_child[PATH_MAX];
  198. +extern char mainprocess_child_args[PATH_MAX];
  199. // 3.1.17: Notifier for the mainprocess:
  200. -int mainprocess_notifier;
  201. +extern int mainprocess_notifier;
  202. // 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
  203. -int eventhandler_use_copy;
  204. +extern int eventhandler_use_copy;
  205. // 3.1.17: This defines how long to sleep while looping:
  206. -int sleeptime_mainprocess;
  207. +extern int sleeptime_mainprocess;
  208. // 3.1.17: Defines how often PID is checked to detect if another smsd is running:
  209. -int check_pid_interval;
  210. +extern int check_pid_interval;
  211. // 3.1.18: start script/program for mainprocess:
  212. -char mainprocess_start[PATH_MAX];
  213. -char mainprocess_start_args[PATH_MAX];
  214. +extern char mainprocess_start[PATH_MAX];
  215. +extern char mainprocess_start_args[PATH_MAX];
  216. -int message_count; // Counter for sent messages. Multipart message is one message.
  217. +extern int message_count; // Counter for sent messages. Multipart message is one message.
  218. -volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
  219. -volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
  220. +extern volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
  221. +extern volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
  222. -char username[65]; // user and group name which are used to run.
  223. -char groupname[65]; // (max length is just a guess)
  224. +extern char username[65]; // user and group name which are used to run.
  225. +extern char groupname[65]; // (max length is just a guess)
  226. -char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
  227. -char pidfile[PATH_MAX]; // File where a process id is stored.
  228. +extern char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
  229. +extern char pidfile[PATH_MAX]; // File where a process id is stored.
  230. // Command line arguments:
  231. -char arg_username[65];
  232. -char arg_groupname[65];
  233. -char arg_infofile[PATH_MAX];
  234. -char arg_pidfile[PATH_MAX];
  235. -char arg_logfile[PATH_MAX];
  236. -int arg_terminal;
  237. +extern char arg_username[65];
  238. +extern char arg_groupname[65];
  239. +extern char arg_infofile[PATH_MAX];
  240. +extern char arg_pidfile[PATH_MAX];
  241. +extern char arg_logfile[PATH_MAX];
  242. +extern int arg_terminal;
  243. // 3.1.7:
  244. -char arg_7bit_packed[512];
  245. -int do_encode_decode_arg_7bit_packed;
  246. +extern char arg_7bit_packed[512];
  247. +extern int do_encode_decode_arg_7bit_packed;
  248. -int terminal; // 1 if smsd is communicating with terminal.
  249. -pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
  250. -char run_info[PATH_MAX]; // Information about external script/program execution.
  251. +extern int terminal; // 1 if smsd is communicating with terminal.
  252. +extern pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
  253. +extern char run_info[PATH_MAX]; // Information about external script/program execution.
  254. -char communicate[32]; // Device name for terminal communication mode.
  255. +extern char communicate[32]; // Device name for terminal communication mode.
  256. -char international_prefixes[PATH_MAX +1];
  257. -char national_prefixes[PATH_MAX +1];
  258. +extern char international_prefixes[PATH_MAX +1];
  259. +extern char national_prefixes[PATH_MAX +1];
  260. // Storage for startup errors:
  261. -char *startup_err_str;
  262. -int startup_err_count;
  263. +extern char *startup_err_str;
  264. +extern int startup_err_count;
  265. // Storage for PDU's:
  266. -char *incoming_pdu_store;
  267. -char *outgoing_pdu_store;
  268. -char *routed_pdu_store;
  269. +extern char *incoming_pdu_store;
  270. +extern char *outgoing_pdu_store;
  271. +extern char *routed_pdu_store;
  272. // Storage for getfile errors:
  273. -char *getfile_err_store;
  274. +extern char *getfile_err_store;
  275. // Text buffer for error messages:
  276. -char tb[SIZE_TB];
  277. +extern char tb[SIZE_TB];
  278. // Buffer for SIM memory checking:
  279. -char *check_memory_buffer;
  280. -size_t check_memory_buffer_size;
  281. +extern char *check_memory_buffer;
  282. +extern size_t check_memory_buffer_size;
  283. -int os_cygwin; // 1 if we are on Cygwin.
  284. +extern int os_cygwin; // 1 if we are on Cygwin.
  285. -char language_file[PATH_MAX]; // File name of translated headers.
  286. -char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
  287. -char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
  288. -char yes_word[SIZE_HEADER]; // "yes" printed as an output.
  289. -char no_word[SIZE_HEADER]; // "no"
  290. -char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
  291. -char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
  292. -char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
  293. -int translate_incoming; // 0 if incoming message headers are NOT transtaled.
  294. +extern char language_file[PATH_MAX]; // File name of translated headers.
  295. +extern char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
  296. +extern char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
  297. +extern char yes_word[SIZE_HEADER]; // "yes" printed as an output.
  298. +extern char no_word[SIZE_HEADER]; // "no"
  299. +extern char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
  300. +extern char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
  301. +extern char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
  302. +extern int translate_incoming; // 0 if incoming message headers are NOT transtaled.
  303. // 3.1.14:
  304. -int logtime_us;
  305. -int logtime_ms;
  306. +extern int logtime_us;
  307. +extern int logtime_ms;
  308. // 3.1.14:
  309. -int shell_test;
  310. +extern int shell_test;
  311. // Next two are for debugging purposes:
  312. -int enable_smsd_debug;
  313. -char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
  314. +extern int enable_smsd_debug;
  315. +extern char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
  316. // 3.1.20: Alt keys in communication mode:
  317. #define COMMUNICATE_A_KEY_COUNT 10
  318. -char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
  319. +extern char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
  320. /* initialize all variable with default values */
  321. Index: smstools/src/smsd_cfg.c
  322. ===================================================================
  323. --- smstools.orig/src/smsd_cfg.c 2020-07-27 19:00:41.616207603 +0000
  324. +++ smstools/src/smsd_cfg.c 2020-08-05 19:17:41.595712888 +0000
  325. @@ -38,6 +38,221 @@
  326. #include "modeminit.h"
  327. #include "charshift.h"
  328. +
  329. +/* global variables */
  330. +char process_title[32]; // smsd for main task, NOTIFIER or CHILD, name of a modem for other tasks.
  331. +int process_id; // -1 for main task, all modems have numbers starting with 0.
  332. + // This is the same as device, can be used like devices[process_id] if IS_MODEM_PROCESS.
  333. +
  334. +time_t process_start_time;
  335. +
  336. +int modem_handle; // Handle for modem.
  337. +
  338. +int put_command_timeouts;
  339. +unsigned long long put_command_sent; // 3.1.16beta.
  340. +char tmpdir[PATH_MAX]; // 3.1.16beta.
  341. +
  342. +// NOTE for regular run intervals: effective value is at least delaytime.
  343. +
  344. +char configfile[PATH_MAX]; // Path to config file
  345. +char d_spool[PATH_MAX]; // Spool directory
  346. +char d_failed[PATH_MAX]; // Failed spool directory
  347. +char d_failed_copy[PATH_MAX]; // 3.1.17.
  348. +char d_incoming[PATH_MAX]; // Incoming spool directory
  349. +char d_incoming_copy[PATH_MAX]; // 3.1.16beta2.
  350. +char d_report[PATH_MAX]; // Incoming report spool directory
  351. +char d_report_copy[PATH_MAX]; // 3.1.17.
  352. +char d_phonecalls[PATH_MAX]; // Incoming phonecalls data directory
  353. +char d_saved[PATH_MAX]; // Directory for smsd's internal use, concatenation storage files etc.
  354. +char d_sent[PATH_MAX]; // Sent spool directory
  355. +char d_sent_copy[PATH_MAX]; // 3.1.17.
  356. +char d_checked[PATH_MAX]; // Spool directory for checked messages (only used when no provider queues used)
  357. +char eventhandler[PATH_MAX]; // Global event handler program or script
  358. +char alarmhandler[PATH_MAX]; // Global alarm handler program or script
  359. +char checkhandler[PATH_MAX]; // Handler that checks if the sms file is valid.
  360. +int alarmlevel; // Alarm Level (9=highest). Verbosity of alarm handler.
  361. +char logfile[PATH_MAX]; // Name or Handle of Log File
  362. +int loglevel; // Log Level (9=highest). Verbosity of log file.
  363. +_queue queues[NUMBER_OF_MODEMS]; // Queues
  364. +_device devices[NUMBER_OF_MODEMS]; // Modem devices
  365. +int delaytime; // sleep-time after workless
  366. +int delaytime_mainprocess; // sleep-time after workless, main process. If -1, delaytime is used.
  367. +int blocktime; // sleep-time after multiple errors
  368. +int blockafter; // Block modem after n errors
  369. +int errorsleeptime; // sleep-time after each error
  370. +int autosplit; // Splitting of large text messages 0=no, 1=yes 2=number with text, 3=number with UDH
  371. +int receive_before_send; // if 1 smsd tries to receive one message before sending
  372. +int store_received_pdu; // 0=no, 1=unsupported pdu's only, 2=unsupported and 8bit/unicode, 3=all
  373. +int store_sent_pdu; // 0=no, 1=failed pdu's only, 2=failed and 8bit/unicode, 3=all
  374. +int validity_period; // Validity period for messages.
  375. +int decode_unicode_text; // 1 if unicode text is decoded internally.
  376. +int internal_combine; // 1 if multipart message is combined internally.
  377. +int internal_combine_binary; // 1 if multipart binary message is combined internally. Defaults to internal_combine.
  378. +int keep_filename; // 0 if unique filename is created to each directory when a message file is moved.
  379. +int store_original_filename; // 1 if an original filename is saved to message file when it's moved from
  380. + // outgoing directory to spooler. Works together with keep_filename.
  381. +int date_filename; // 1 or 2 if YYYYMMDD is included to the filename of incoming message.
  382. +char regular_run[PATH_MAX]; // Script/program which is run regularly.
  383. +int regular_run_interval; // Number of seconds between running a regular_run script/progdam.
  384. +char admin_to[SIZE_TO]; // Destination number for administrative messages.
  385. +int filename_preview; // Number of chars of message text to concatenate to filename.
  386. +int incoming_utf8; // 1 if incoming files are saved using UTF-8 character set.
  387. +int outgoing_utf8; // 1 if outgoing files are automatically converted from UTF-8 to ISO and GSM.
  388. +int log_charconv; // 1 if character set conversion is logged.
  389. +int log_single_lines; // 1 if linefeeds are removed from the modem response to be logged.
  390. +int executable_check; // 0 if eventhandler and other executables are NOT checked during the startup checking.
  391. +int keep_messages; // For testing purposes: messages are not deleted and smsd stops after first run.
  392. +char priviledged_numbers[SIZE_PRIVILEDGED_NUMBERS]; // Priviledged numbers in incoming messages.
  393. +int ic_purge_hours; // If internal_combine is used, concatenation storage is checked every ic_purge_interval minutes
  394. +int ic_purge_minutes; // and if there is message parts older than defined, they are handled or deleted.
  395. +int ic_purge_read; // 1 = message parts are stored as single messages. 0 = parts are just deleted.
  396. +int ic_purge_interval; //
  397. +char shell[PATH_MAX]; // Shell used to run eventhandler, defaults to /bin/sh
  398. +char adminmessage_device[32]; // Name of device used to send administrative messages of mainspooler.
  399. +int smart_logging; // 1 = if loglevel is less than 7, degug log is written is there has been any errors.
  400. +int status_signal_quality; // 1 = signal quality is written to status file.
  401. +int status_include_counters; // 1 = succeeded, failed and received counters are included in the status line.
  402. +int status_include_uptime; // 3.1.16beta: 1 = include started & uptime line in the status file.
  403. +int hangup_incoming_call; // 1 = if detected unexpected input contains RING and we want to end call.
  404. +int max_continuous_sending; // Defines when sending is breaked to do check/do other tasks. Time in minutes.
  405. +int voicecall_hangup_ath; // If ATH is used instead of AT+CHUP.
  406. +
  407. +// 3.1.5:
  408. +int trust_outgoing; // 1 = it's _sure_ that files are created by rename AND permissions are correct. Speeds up spooling.
  409. +
  410. +// 3.1.5:
  411. +int ignore_outgoing_priority; // 1 = Priority: high header is not checked. Speeds up spooling.
  412. +
  413. +// 3.1.7:
  414. +int ignore_exec_output; // 1 = stdout and stderr of eventhandlers is _not_ checked.
  415. +
  416. +// 3.1.7:
  417. +mode_t conf_umask; // File mode creation mask for smsd and modem processes.
  418. +
  419. +// 3.1.7:
  420. +int trim_text; // 1 = trailing whitespaces are removed from text:
  421. +
  422. +// 3.1.7:
  423. +int use_linux_ps_trick; // 1 = change argv[0] to "smsd: MAINPROCESS", "smsd: GSM1" etc.
  424. +
  425. +// 3.1.7:
  426. +int log_unmodified;
  427. +
  428. +// 3.1.7:
  429. +char suspend_filename[PATH_MAX];
  430. +
  431. +// 3.1.9:
  432. +int spool_directory_order;
  433. +
  434. +// 3.1.9: 1 if read_from_modem is logged.
  435. +int log_read_from_modem;
  436. +
  437. +// 3.1.16beta2: log_read_timing for performance tuning.
  438. +int log_read_timing;
  439. +
  440. +// 3.1.16beta:
  441. +int log_response_time;
  442. +
  443. +// 3.1.16beta2:
  444. +int default_alphabet;
  445. +
  446. +// 3.1.17: Child process for the mainprocess:
  447. +char mainprocess_child[PATH_MAX];
  448. +char mainprocess_child_args[PATH_MAX];
  449. +
  450. +// 3.1.17: Notifier for the mainprocess:
  451. +int mainprocess_notifier;
  452. +
  453. +// 3.1.17: If *_copy was made, evenhandler can use it instead of original file:
  454. +int eventhandler_use_copy;
  455. +
  456. +// 3.1.17: This defines how long to sleep while looping:
  457. +int sleeptime_mainprocess;
  458. +
  459. +// 3.1.17: Defines how often PID is checked to detect if another smsd is running:
  460. +int check_pid_interval;
  461. +
  462. +// 3.1.18: start script/program for mainprocess:
  463. +char mainprocess_start[PATH_MAX];
  464. +char mainprocess_start_args[PATH_MAX];
  465. +
  466. +int message_count; // Counter for sent messages. Multipart message is one message.
  467. +
  468. +volatile sig_atomic_t break_workless_delay; // To break the delay when SIGCONT is received.
  469. +volatile sig_atomic_t terminate; // To terminate when SIGTERM is received.
  470. +
  471. +char username[65]; // user and group name which are used to run.
  472. +char groupname[65]; // (max length is just a guess)
  473. +
  474. +char infofile[PATH_MAX]; // Hepler file for stopping the smsd smoothly.
  475. +char pidfile[PATH_MAX]; // File where a process id is stored.
  476. +
  477. +// Command line arguments:
  478. +char arg_username[65];
  479. +char arg_groupname[65];
  480. +char arg_infofile[PATH_MAX];
  481. +char arg_pidfile[PATH_MAX];
  482. +char arg_logfile[PATH_MAX];
  483. +int arg_terminal;
  484. +// 3.1.7:
  485. +char arg_7bit_packed[512];
  486. +int do_encode_decode_arg_7bit_packed;
  487. +
  488. +int terminal; // 1 if smsd is communicating with terminal.
  489. +pid_t device_pids[NUMBER_OF_MODEMS]; // Pid's of modem processes.
  490. +char run_info[PATH_MAX]; // Information about external script/program execution.
  491. +
  492. +char communicate[32]; // Device name for terminal communication mode.
  493. +
  494. +char international_prefixes[PATH_MAX +1];
  495. +char national_prefixes[PATH_MAX +1];
  496. +
  497. +// Storage for startup errors:
  498. +char *startup_err_str;
  499. +int startup_err_count;
  500. +
  501. +// Storage for PDU's:
  502. +char *incoming_pdu_store;
  503. +char *outgoing_pdu_store;
  504. +char *routed_pdu_store;
  505. +
  506. +// Storage for getfile errors:
  507. +char *getfile_err_store;
  508. +
  509. +// Text buffer for error messages:
  510. +char tb[SIZE_TB];
  511. +
  512. +// Buffer for SIM memory checking:
  513. +char *check_memory_buffer;
  514. +size_t check_memory_buffer_size;
  515. +
  516. +int os_cygwin; // 1 if we are on Cygwin.
  517. +
  518. +char language_file[PATH_MAX]; // File name of translated headers.
  519. +char yes_chars[SIZE_HEADER]; // Characters which mean "yes" in the yesno() question.
  520. +char no_chars[SIZE_HEADER]; // See details inside read_translation() function.
  521. +char yes_word[SIZE_HEADER]; // "yes" printed as an output.
  522. +char no_word[SIZE_HEADER]; // "no"
  523. +char datetime_format[SIZE_HEADER]; // strftime format string for time stamps (not inside status reports).
  524. +char logtime_format[SIZE_HEADER]; // 3.1.7: strftime format string for logging time stamps
  525. +char date_filename_format[SIZE_HEADER]; // 3.1.7: strftime format string for date_filename
  526. +int translate_incoming; // 0 if incoming message headers are NOT transtaled.
  527. +
  528. +// 3.1.14:
  529. +int logtime_us;
  530. +int logtime_ms;
  531. +
  532. +// 3.1.14:
  533. +int shell_test;
  534. +
  535. +// Next two are for debugging purposes:
  536. +int enable_smsd_debug;
  537. +char smsd_debug[SIZE_SMSD_DEBUG]; // Header of an outgoing message file.
  538. +
  539. +// 3.1.20: Alt keys in communication mode:
  540. +#define COMMUNICATE_A_KEY_COUNT 10
  541. +char communicate_a_keys[COMMUNICATE_A_KEY_COUNT][256];
  542. +
  543. char *msg_dir = "%s directory %s cannot be opened.";
  544. char *msg_file = "%s directory %s is not writable.";
  545. char *msg_not_executable = "is not executable for smsd.";
  546. Index: smstools/src/logging.c
  547. ===================================================================
  548. --- smstools.orig/src/logging.c 2020-07-27 19:00:41.612207583 +0000
  549. +++ smstools/src/logging.c 2020-08-05 19:27:38.373800111 +0000
  550. @@ -25,6 +25,16 @@
  551. #include "smsd_cfg.h"
  552. #include "stats.h"
  553. +
  554. +// 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
  555. +char logch_buffer[8192];
  556. +
  557. +char prch(char ch);
  558. +
  559. +// 3.1.16beta: changed type:
  560. +//int trouble_logging_started;
  561. +time_t trouble_logging_started;
  562. +
  563. int Filehandle = -1;
  564. int Level;
  565. int SavedLevel;
  566. Index: smstools/src/logging.h
  567. ===================================================================
  568. --- smstools.orig/src/logging.h 2020-07-27 19:00:41.612207583 +0000
  569. +++ smstools/src/logging.h 2020-08-05 19:27:52.077848035 +0000
  570. @@ -18,7 +18,7 @@
  571. #include <time.h>
  572. // 3.1.16beta2: Moved logch() and prch() from charset.c to logging.c:
  573. -char logch_buffer[8192];
  574. +extern char logch_buffer[8192];
  575. #ifdef __GNUC__
  576. void logch(char* format, ...) __attribute__ ((format(printf, 1, 2)));
  577. @@ -26,11 +26,11 @@
  578. void logch(char* format, ...);
  579. #endif
  580. -char prch(char ch);
  581. +extern char prch(char ch);
  582. // 3.1.16beta: changed type:
  583. //int trouble_logging_started;
  584. -time_t trouble_logging_started;
  585. +extern time_t trouble_logging_started;
  586. int change_loglevel(int new_level);
  587. void restore_loglevel();
  588. Index: smstools/src/stats.c
  589. ===================================================================
  590. --- smstools.orig/src/stats.c 2020-07-27 19:00:41.616207603 +0000
  591. +++ smstools/src/stats.c 2020-08-05 19:28:58.094078936 +0000
  592. @@ -29,6 +29,20 @@
  593. #include <mm.h>
  594. #endif
  595. +
  596. +_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
  597. +int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
  598. +time_t start_time; // Start time of smsd, allows statistic functions
  599. +int printstatus; // if 1 smsd outputs status on stdout
  600. +time_t last_stats; // time when the last stats file was created
  601. +char d_stats[PATH_MAX]; // path to statistic files
  602. +int stats_interval; // time between statistic files in seconds.
  603. +int stats_no_zeroes; // Suppress files that contain only zeroes
  604. +int status_interval; // time between updating status file in seconds
  605. +
  606. +char *shared_buffer;
  607. +
  608. +
  609. char newstatus[NUMBER_OF_MODEMS +1] = {0};
  610. char oldstatus[NUMBER_OF_MODEMS +1] = {0};
  611. Index: smstools/src/stats.h
  612. ===================================================================
  613. --- smstools.orig/src/stats.h 2020-07-27 19:00:41.616207603 +0000
  614. +++ smstools/src/stats.h 2020-08-05 19:29:14.750137182 +0000
  615. @@ -33,17 +33,17 @@
  616. int ber;
  617. } _stats;
  618. -_stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
  619. -int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
  620. -time_t start_time; // Start time of smsd, allows statistic functions
  621. -int printstatus; // if 1 smsd outputs status on stdout
  622. -time_t last_stats; // time when the last stats file was created
  623. -char d_stats[PATH_MAX]; // path to statistic files
  624. -int stats_interval; // time between statistic files in seconds.
  625. -int stats_no_zeroes; // Suppress files that contain only zeroes
  626. -int status_interval; // time between updating status file in seconds
  627. +extern _stats* statistics[NUMBER_OF_MODEMS]; // Statistic data (shared memory!)
  628. +extern int rejected_counter; // Statistic counter, rejected SM, number does not fit into any queue
  629. +extern time_t start_time; // Start time of smsd, allows statistic functions
  630. +extern int printstatus; // if 1 smsd outputs status on stdout
  631. +extern time_t last_stats; // time when the last stats file was created
  632. +extern char d_stats[PATH_MAX]; // path to statistic files
  633. +extern int stats_interval; // time between statistic files in seconds.
  634. +extern int stats_no_zeroes; // Suppress files that contain only zeroes
  635. +extern int status_interval; // time between updating status file in seconds
  636. -char *shared_buffer;
  637. +extern char *shared_buffer;
  638. /* Creates shared memory variables for statistic data */
  639. Index: smstools/src/blacklist.c
  640. ===================================================================
  641. --- smstools.orig/src/blacklist.c 2020-07-27 19:00:41.612207583 +0000
  642. +++ smstools/src/blacklist.c 2020-08-05 19:34:13.903183463 +0000
  643. @@ -23,6 +23,8 @@
  644. #include "alarm.h"
  645. #include "smsd_cfg.h"
  646. +char blacklist[256]; // Filename of the black-list
  647. +
  648. int inblacklist(char* msisdn)
  649. {
  650. FILE* file;
  651. Index: smstools/src/blacklist.h
  652. ===================================================================
  653. --- smstools.orig/src/blacklist.h 2020-07-27 19:00:41.612207583 +0000
  654. +++ smstools/src/blacklist.h 2020-08-05 19:34:04.903151994 +0000
  655. @@ -15,7 +15,7 @@
  656. #ifndef BLACK_H
  657. #define BLACK_H
  658. -char blacklist[256]; // Filename of the black-list
  659. +extern char blacklist[256]; // Filename of the black-list
  660. int inblacklist(char* msisdn);
  661. Index: smstools/src/whitelist.c
  662. ===================================================================
  663. --- smstools.orig/src/whitelist.c 2020-07-27 19:00:41.616207603 +0000
  664. +++ smstools/src/whitelist.c 2020-08-05 19:39:23.436266057 +0000
  665. @@ -23,6 +23,8 @@
  666. #include "alarm.h"
  667. #include "smsd_cfg.h"
  668. +char whitelist[256]; // Filename of the white-list
  669. +
  670. /* Used with >= 3.1x */
  671. int inwhitelist_q(char* msisdn, char *queuename)
  672. {
  673. Index: smstools/src/whitelist.h
  674. ===================================================================
  675. --- smstools.orig/src/whitelist.h 2020-07-27 19:00:41.616207603 +0000
  676. +++ smstools/src/whitelist.h 2020-08-05 19:34:29.959239624 +0000
  677. @@ -15,7 +15,7 @@
  678. #ifndef WHITE_H
  679. #define WHITE_H
  680. -char whitelist[256]; // Filename of the white-list
  681. +extern char whitelist[256]; // Filename of the white-list
  682. /* Used with >= 3.1x */
  683. int inwhitelist_q(char* msisdn, char *queuename);