Install tinc as a service under Windows (MinGW). Remove cleanup_and_exit(),

either exit() directly on errors or let main_loop() shutdown gracefully.
This commit is contained in:
Guus Sliepen 2003-08-02 20:50:38 +00:00
parent 7c34122af7
commit f08fc359a0
9 changed files with 410 additions and 175 deletions

View file

@ -79,3 +79,17 @@ void cp_trace()
);
}
#endif
#ifdef HAVE_MINGW
char *winerror(int err) {
static char buf[1024];
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, sizeof(buf), NULL)) {
strncpy(buf, _("(unable to format errormessage)"), sizeof(buf));
};
return buf;
}
#endif

View file

@ -38,4 +38,8 @@ extern void cp_trace(void);
extern void hex2bin(char *src, char *dst, int length);
extern void bin2hex(char *src, char *dst, int length);
#ifdef HAVE_MINGW
extern char *winerror(int);
#endif
#endif /* __TINC_UTILS_H__ */

299
po/nl.po
View file

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tinc 1.0-cvs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2003-07-29 13:04+0200\n"
"POT-Creation-Date: 2003-08-02 17:51+0200\n"
"PO-Revision-Date: 2003-05-06 23:10+0200\n"
"Last-Translator: Guus Sliepen <guus@sliepen.eu.org>\n"
"Language-Team: Dutch <vertaling@nl.linux.org>\n"
@ -46,69 +46,69 @@ msgstr ""
"Netwerk adres en prefix lengte komen niet overeen bij configuratievariabele %"
"s in %s regel %d"
#: src/conf.c:338
#: src/conf.c:339
#, c-format
msgid "Cannot open config file %s: %s"
msgstr "Kan configuratie bestand %s niet openen: %s"
#: src/conf.c:376
#: src/conf.c:388
#, c-format
msgid "No value for variable `%s' on line %d while reading config file %s"
msgstr ""
"Geen waarde voor variabele `%s' op regel %d tijdens het lezen van "
"configuratie bestand %s"
#: src/conf.c:411
#: src/conf.c:419
#, c-format
msgid "Failed to read `%s': %s"
msgstr "Lezen van `%s' mislukte: %s"
#: src/conf.c:429
#: src/conf.c:437
#, c-format
msgid "`%s' is not an absolute path"
msgstr "`%s' is geen absoluut pad"
#: src/conf.c:445 src/conf.c:473
#: src/conf.c:453 src/conf.c:481
#, c-format
msgid "Couldn't stat `%s': %s"
msgstr "Kon `%s' niet statten: %s"
#: src/conf.c:450 src/conf.c:481
#: src/conf.c:458 src/conf.c:489
#, c-format
msgid "`%s' is owned by UID %d instead of %d"
msgstr "`%s' is eigendom van UID %d in plaats van %d"
#: src/conf.c:456 src/conf.c:487
#: src/conf.c:464 src/conf.c:495
#, c-format
msgid "Warning: `%s' is a symlink"
msgstr "Waarschuwing: `%s' is een symbolische link"
#: src/conf.c:459 src/conf.c:490
#: src/conf.c:467 src/conf.c:498
#, c-format
msgid "Unable to read symbolic link `%s': %s"
msgstr "Kan symbolische link `%s' niet lezen: %s"
#: src/conf.c:501
#: src/conf.c:509
#, c-format
msgid "`%s' has unsecure permissions"
msgstr "`%s' heeft onveilige permissies"
#: src/conf.c:523
#: src/conf.c:531
#, c-format
msgid "Please enter a file to save %s to [%s]: "
msgstr "Geef een bestand om de %s naar de schrijven [%s]: "
#: src/conf.c:530
#: src/conf.c:538
#, c-format
msgid "Error while reading stdin: %s\n"
msgstr "Fout tijdens lezen van standaardinvoer: %s\n"
#: src/conf.c:558
#: src/conf.c:566
#, c-format
msgid "Error opening file `%s': %s\n"
msgstr "Fout bij het openen van het bestand `%s': %s\n"
#: src/conf.c:567
#: src/conf.c:575
#, c-format
msgid ""
"The file `%s' (or any of the leading directories) has unsafe permissions.\n"
@ -174,56 +174,56 @@ msgstr "Fout op metadata socket voor %s (%s) tijdens lezen: %s"
msgid "Metadata read buffer overflow for %s (%s)"
msgstr "Metadata leesbuffer overloop voor %s (%s)"
#: src/net.c:58
#: src/net.c:59
msgid "Purging unreachable nodes"
msgstr "Verwijderen onbereikbare nodes"
#: src/net.c:65
#: src/net.c:66
#, c-format
msgid "Purging node %s (%s)"
msgstr "Verwijdering node %s (%s)"
#: src/net.c:146
#: src/net.c:147
#, c-format
msgid "Closing connection with %s (%s)"
msgstr "Beëindigen verbinding met %s (%s)"
#: src/net.c:199
#: src/net.c:200
#, c-format
msgid "%s (%s) didn't respond to PING"
msgstr "%s (%s) antwoordde niet op ping"
#: src/net.c:208
#: src/net.c:209
#, c-format
msgid "Old connection_t for %s (%s) status %04x still lingering, deleting..."
msgstr ""
"Oude connection_t voor %s (%s) status %04x nog steeds aanwezig, wordt "
"verwijderd..."
#: src/net.c:213
#: src/net.c:214
#, c-format
msgid "Timeout from %s (%s) during authentication"
msgstr "Timeout van %s (%s) tijdens authenticatie"
#: src/net.c:255
#: src/net.c:256
#, c-format
msgid "Error while connecting to %s (%s): %s"
msgstr "Fout tijdens schrijven naar %s (%s): %s"
#: src/net.c:308
#: src/net.c:309
#, c-format
msgid "Error while waiting for input: %s"
msgstr "Fout tijdens wachten op invoer: %s"
#: src/net.c:339
#: src/net.c:340
msgid "Regenerating symmetric key"
msgstr "Hergenereren symmetrische sleutel"
#: src/net.c:356
#: src/net.c:357
msgid "Flushing event queue"
msgstr "Legen taakrij"
#: src/net.c:380
#: src/net.c:381
msgid "Unable to reread configuration file, exitting."
msgstr "Kan configuratiebestand niet herlezen, beëindigen."
@ -269,9 +269,13 @@ msgstr "Fout tijdens comprimeren pakket naar %s (%s)"
msgid "Setting outgoing packet priority to %d"
msgstr "Instellen prioriteit uitgaand pakket op %d"
#: src/net_packet.c:309 src/net_setup.c:459 src/net_socket.c:74
#: src/net_socket.c:122 src/net_socket.c:153 src/tincd.c:388 src/process.c:261
#: src/process.c:289 src/cygwin/device.c:150 src/cygwin/device.c:181
#: src/net_packet.c:309 src/net_setup.c:457 src/net_socket.c:74
#: src/net_socket.c:122 src/net_socket.c:153 src/tincd.c:394 src/tincd.c:428
#: src/process.c:389 src/process.c:417 src/cygwin/device.c:155
#: src/cygwin/device.c:186 src/mingw/device.c:81 src/mingw/device.c:90
#: src/mingw/device.c:95 src/mingw/device.c:247 src/mingw/device.c:254
#: src/mingw/device.c:259 src/mingw/device.c:266 src/mingw/device.c:275
#: src/mingw/device.c:282
#, c-format
msgid "System call `%s' failed: %s"
msgstr "Systeemaanroep `%s' mislukte: %s"
@ -407,16 +411,16 @@ msgstr "Onzinnige MAC lengte!"
msgid "Bogus compression level!"
msgstr "Onzinnig compressieniveau!"
#: src/net_setup.c:481
#: src/net_setup.c:479
#, c-format
msgid "Listening on %s"
msgstr "Luisterend op %s"
#: src/net_setup.c:492
#: src/net_setup.c:490
msgid "Ready"
msgstr "Gereed"
#: src/net_setup.c:494
#: src/net_setup.c:492
msgid "Unable to create any listening socket!"
msgstr "Kon geen enkele luistersocket aanmaken!"
@ -509,27 +513,27 @@ msgstr "Verbinding van %s"
msgid "Invalid name for outgoing connection in %s line %d"
msgstr "Ongeldige naam voor uitgaande verbinding in %s regel %d"
#: src/netutl.c:52 src/netutl.c:77
#: src/netutl.c:50 src/netutl.c:73
#, c-format
msgid "Error looking up %s port %s: %s\n"
msgstr "Fout bij het opzoeken van %s poort %s: %s\n"
#: src/netutl.c:102
#: src/netutl.c:98
#, c-format
msgid "Error while translating addresses: %s"
msgstr "Fout tijdens vertalen adressen: %s"
#: src/netutl.c:130
#: src/netutl.c:126
#, c-format
msgid "Error while looking up hostname: %s"
msgstr "Fout bij het opzoeken van hostnaam: %s"
#: src/netutl.c:134
#: src/netutl.c:130
#, c-format
msgid "%s port %s"
msgstr "%s poort %s"
#: src/netutl.c:171
#: src/netutl.c:167
#, c-format
msgid "sockaddrcmp() was called with unknown address family %d, exitting!"
msgstr ""
@ -595,11 +599,11 @@ msgstr "Fout tijdens afhandelen %s van %s (%s)"
msgid "Bogus data received from %s (%s)"
msgstr "Onzinnige data ontvangen van %s (%s)"
#: src/protocol.c:220
#: src/protocol.c:219
msgid "Already seen request"
msgstr "Verzoek reeds gezien"
#: src/protocol.c:250
#: src/protocol.c:249
#, c-format
msgid "Aging past requests: deleted %d, left %d\n"
msgstr "Veroudering vorige verzoeken: %d gewist, %d overgebleven\n"
@ -801,25 +805,25 @@ msgstr ""
msgid "net2str() was called with unknown subnet type %d, exiting!"
msgstr "net2str() werd aangeroepen met onbekend subnet type %d, beëindigen!"
#: src/subnet.c:406
#: src/subnet.c:403
msgid "Subnet list:"
msgstr "Subnet lijst:"
#: src/subnet.c:411
#: src/subnet.c:408
#, c-format
msgid " %s owner %s"
msgstr " %s eigenaar %s"
#: src/subnet.c:415
#: src/subnet.c:412
msgid "End of subnet list."
msgstr "Einde van subnet lijst."
#: src/tincd.c:99
#: src/tincd.c:105
#, c-format
msgid "Try `%s --help' for more information.\n"
msgstr "Probeer `%s --help' voor meer informatie.\n"
#: src/tincd.c:102
#: src/tincd.c:108
#, c-format
msgid ""
"Usage: %s [option]...\n"
@ -828,7 +832,7 @@ msgstr ""
"Gebruik: %s [optie]...\n"
"\n"
#: src/tincd.c:103
#: src/tincd.c:109
msgid ""
" -c, --config=DIR Read configuration options from DIR.\n"
" -D, --no-detach Don't fork and detach.\n"
@ -857,13 +861,13 @@ msgstr ""
" --version Geef versie informatie en beëindig.\n"
"\n"
#: src/tincd.c:114
#: src/tincd.c:120
msgid "Report bugs to tinc@nl.linux.org.\n"
msgstr ""
"Meld fouten in het programma aan tinc@nl.linux.org;\n"
"Meld fouten in de vertaling aan vertaling@nl.linux.org.\n"
#: src/tincd.c:172
#: src/tincd.c:178
#, c-format
msgid ""
"Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, "
@ -872,7 +876,7 @@ msgstr ""
"Ongeldig argument `%s'; SIGNAAL moet een getal zijn of één van HUP, TERM, "
"KILL, USR1, USR2, WINCH, INT of ALRM.\n"
#: src/tincd.c:191
#: src/tincd.c:197
#, c-format
msgid ""
"Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n"
@ -880,24 +884,24 @@ msgstr ""
"Ongeldig argument `%s'; BITS moet een nummer zijn gelijk aan of groter dan "
"512.\n"
#: src/tincd.c:280
#: src/tincd.c:286
#, c-format
msgid "Generating %d bits keys:\n"
msgstr "Bezig met genereren van een %d bits sleutel:\n"
#: src/tincd.c:284
#: src/tincd.c:290
msgid "Error during key generation!\n"
msgstr "Fout tijdens genereren sleutel!\n"
#: src/tincd.c:287
#: src/tincd.c:293
msgid "Done.\n"
msgstr "Klaar.\n"
#: src/tincd.c:290
#: src/tincd.c:296
msgid "private RSA key"
msgstr "geheime RSA sleutel"
#: src/tincd.c:296 src/tincd.c:315
#: src/tincd.c:302 src/tincd.c:321
msgid ""
"Appending key to existing contents.\n"
"Make sure only one key is stored in the file.\n"
@ -905,21 +909,21 @@ msgstr ""
"Sleutel wordt toegevoegd aan bestaande inhoud.\n"
"Let er op dat er slechts één sleutel in het bestand is.\n"
#: src/tincd.c:309
#: src/tincd.c:315
msgid "public RSA key"
msgstr "openbare RSA sleutel"
#: src/tincd.c:344
#: src/tincd.c:350
msgid "Both netname and configuration directory given, using the latter..."
msgstr ""
"Zowel netnaam als configuratiemap zijn gegeven, laatste wordt gebruikt..."
#: src/tincd.c:364
#: src/tincd.c:370
#, c-format
msgid "%s version %s (built %s %s, protocol %d)\n"
msgstr "%s versie %s (gemaakt %s %s, protocol %d)\n"
#: src/tincd.c:366
#: src/tincd.c:372
msgid ""
"Copyright (C) 1998-2003 Ivo Timmermans, Guus Sliepen and others.\n"
"See the AUTHORS file for a complete list.\n"
@ -936,24 +940,24 @@ msgstr ""
"en je bent welkom om het te distribueren onder bepaalde voorwaarden;\n"
"zie het bestand COPYING voor details.\n"
#: src/tincd.c:392
#: src/tincd.c:398
msgid "mlockall() not supported on this platform!"
msgstr "mlockall() wordt niet ondersteund op dit platform!"
#: src/tincd.c:416
#: src/tincd.c:422
msgid "Error initializing LZO compressor!"
msgstr "Fout tijdens initialiseren LZO compressor!"
#: src/tincd.c:429
#: src/tincd.c:442
msgid "Unrecoverable error"
msgstr "Onherstelbare fout"
#: src/tincd.c:433
#: src/tincd.c:446
#, c-format
msgid "Restarting in %d seconds!"
msgstr "Herstart in %d seconden!"
#: src/tincd.c:436 src/process.c:352
#: src/tincd.c:449 src/process.c:480
msgid "Not restarting."
msgstr "Geen herstart."
@ -966,105 +970,150 @@ msgstr "Geheugen uitgeput (kon geen %d bytes reserveren), beëindigen."
msgid "Terminating"
msgstr "Beëindigen"
#: src/process.c:105
#: src/process.c:107 src/process.c:148
#, fuzzy
msgid "Could not open service manager"
msgstr "Kon `%s' niet twee keer openen: %s"
#: src/process.c:114
#, c-format
msgid "%s service already installed"
msgstr ""
#: src/process.c:132
#, fuzzy, c-format
msgid "Could not create service: %d"
msgstr "Kon `%s' niet twee keer openen: %s"
#: src/process.c:136
#, c-format
msgid "%s service installed"
msgstr ""
#: src/process.c:140
#, c-format
msgid "%s service started"
msgstr ""
#: src/process.c:155
#, fuzzy
msgid "Could not open service"
msgstr "Kon `%s' niet twee keer openen: %s"
#: src/process.c:160
#, fuzzy
msgid "Could not remove service"
msgstr "Kon `%s' niet twee keer openen: %s"
#: src/process.c:164
#, c-format
msgid "%s service removed"
msgstr ""
#: src/process.c:203
#, c-format
msgid "Error starting service control dispatcher: %d"
msgstr ""
#: src/process.c:226
#, c-format
msgid "A tincd is already running for net `%s' with pid %d.\n"
msgstr "Een tincd draait al voor net `%s' met pid %d.\n"
#: src/process.c:108
#: src/process.c:229
#, c-format
msgid "A tincd is already running with pid %d.\n"
msgstr "Een tincd draait al met pid %d.\n"
#: src/process.c:134
#: src/process.c:255
#, c-format
msgid "No other tincd is running for net `%s'.\n"
msgstr "Geen andere tincd draait voor net `%s'.\n"
#: src/process.c:137
#: src/process.c:258
msgid "No other tincd is running.\n"
msgstr "Geen andere tincd draait.\n"
#: src/process.c:146
#: src/process.c:267
#, c-format
msgid "The tincd for net `%s' is no longer running. "
msgstr "De tincd voor net `%s' draait niet meer. "
#: src/process.c:149
#: src/process.c:270
msgid "The tincd is no longer running. "
msgstr "De tincd draait niet meer. "
#: src/process.c:151
#: src/process.c:272
msgid "Removing stale lock file.\n"
msgstr "Verwijdering oud vergrendelingsbestand.\n"
#: src/process.c:182
#: src/process.c:305
#, c-format
msgid "Couldn't detach from terminal: %s"
msgstr "Kon niet ontkoppelen van terminal: %s"
#: src/process.c:196
#: src/process.c:324
#, c-format
msgid "tincd %s (%s %s) starting, debug level %d"
msgstr "tincd %s (%s %s) start, debug niveau %d"
#: src/process.c:232
#: src/process.c:360
#, c-format
msgid "Could not execute `%s': %s"
msgstr "Kon `%s' niet uitvoeren: %s"
#: src/process.c:267
#: src/process.c:395
#, c-format
msgid "Executing script %s"
msgstr "Uitvoeren script %s"
#: src/process.c:274
#: src/process.c:402
#, c-format
msgid "Process %d (%s) exited with non-zero status %d"
msgstr "Proces %d (%s) beëindigde met status %d"
#: src/process.c:280
#: src/process.c:408
#, c-format
msgid "Process %d (%s) was killed by signal %d (%s)"
msgstr "Proces %d (%s) was gestopt door signaal %d (%s)"
#: src/process.c:284
#: src/process.c:412
#, c-format
msgid "Process %d (%s) terminated abnormally"
msgstr "Proces %d (%s) abnormaal beëindigd"
#: src/process.c:314
#: src/process.c:442
msgid "Got TERM signal"
msgstr "Kreeg TERM signaal"
#: src/process.c:321
#: src/process.c:449
msgid "Got QUIT signal"
msgstr "Kreeg QUIT signaal"
#: src/process.c:327
#: src/process.c:455
#, c-format
msgid "Got another fatal signal %d (%s): not restarting."
msgstr "Kreeg nog een fataal signaal %d (%s): geen herstart."
#: src/process.c:336
#: src/process.c:464
#, c-format
msgid "Got fatal signal %d (%s)"
msgstr "Kreeg fataal signaal %d (%s)"
#: src/process.c:340
#: src/process.c:468
msgid "Trying to re-execute in 5 seconds..."
msgstr "Poging tot herstarten over 5 seconden..."
#: src/process.c:359
#: src/process.c:487
msgid "Got HUP signal"
msgstr "Kreeg HUP signaal"
#: src/process.c:366
#: src/process.c:494
#, c-format
msgid "Reverting to old debug level (%d)"
msgstr "Herstellen van oud debug niveau (%d)"
#: src/process.c:372
#: src/process.c:500
#, c-format
msgid ""
"Temporarily setting debug level to 5. Kill me with SIGINT again to go back "
@ -1073,41 +1122,41 @@ msgstr ""
"Tijdelijk instellen debug niveau op 5. Zend nog een SIGINT signaal om niveau "
"%d te herstellen."
#: src/process.c:381
#: src/process.c:509
msgid "Got ALRM signal"
msgstr "Kreeg ALRM signaal"
#: src/process.c:405
#: src/process.c:533
#, c-format
msgid "Got unexpected signal %d (%s)"
msgstr "Kreeg onverwacht signaal %d (%s)"
#: src/process.c:411
#: src/process.c:539
#, c-format
msgid "Ignored signal %d (%s)"
msgstr "Signaal %d (%s) genegeerd"
#: src/process.c:465
#: src/process.c:593
#, c-format
msgid "Installing signal handler for signal %d (%s) failed: %s\n"
msgstr "Installeren van signaal afhandelaar voor signaal %d (%s) faalde: %s\n"
#: src/route.c:107
#: src/route.c:104
#, c-format
msgid "Learned new MAC address %hx:%hx:%hx:%hx:%hx:%hx"
msgstr "Nieuw MAC adres %hx:%hx:%hx:%hx:%hx:%hx geleerd"
#: src/route.c:140
#: src/route.c:137
#, c-format
msgid "MAC address %hx:%hx:%hx:%hx:%hx:%hx expired"
msgstr "MAC adres %hx:%hx:%hx:%hx:%hx:%hx verlopen"
#: src/route.c:249
#: src/route.c:246
#, c-format
msgid "Cannot route packet: unknown IPv4 destination address %d.%d.%d.%d"
msgstr "Kan pakket niet routeren: onbekend IPv4 doeladres %d.%d.%d.%d"
#: src/route.c:340
#: src/route.c:337
#, c-format
msgid ""
"Cannot route packet: unknown IPv6 destination address %hx:%hx:%hx:%hx:%hx:%"
@ -1116,19 +1165,19 @@ msgstr ""
"Kan pakket niet routeren: onbekend IPv6 doeladres %hx:%hx:%hx:%hx:%hx:%hx:%"
"hx:%hx"
#: src/route.c:392
#: src/route.c:389
msgid ""
"Cannot route packet: received unknown type neighbor solicitation request"
msgstr ""
"Kan pakket niet routeren: ontvangst van onbekend type neighbor solicitation "
"verzoek"
#: src/route.c:409
#: src/route.c:406
msgid "Cannot route packet: checksum error for neighbor solicitation request"
msgstr ""
"Kan pakket niet routeren: checksum fout voor neighbor solicitation verzoek"
#: src/route.c:418
#: src/route.c:415
#, c-format
msgid ""
"Cannot route packet: neighbor solicitation request for unknown address %hx:%"
@ -1137,16 +1186,16 @@ msgstr ""
"Kan pakket niet routeren: neighbor solicitation verzoek voor onbekend adres %"
"hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx"
#: src/route.c:497
#: src/route.c:494
msgid "Cannot route packet: received unknown type ARP request"
msgstr "Kan pakket niet routeren: ontvangst van onbekend type ARP verzoek"
#: src/route.c:506
#: src/route.c:503
#, c-format
msgid "Cannot route packet: ARP request for unknown address %d.%d.%d.%d"
msgstr "Kan pakket niet routeren: ARP verzoek voor onbekend adres %d.%d.%d.%d"
#: src/route.c:561
#: src/route.c:558
#, c-format
msgid "Cannot route packet: unknown type %hx"
msgstr "Kan pakket niet routeren: onbekend type %hx"
@ -1222,50 +1271,50 @@ msgstr "%s is een %s"
#: src/linux/device.c:137 src/linux/device.c:148 src/linux/device.c:159
#: src/freebsd/device.c:75 src/solaris/device.c:126 src/netbsd/device.c:78
#: src/darwin/device.c:75 src/cygwin/device.c:250 src/mingw/device.c:184
#: src/raw_socket/device.c:114
#: src/darwin/device.c:75 src/cygwin/device.c:254 src/mingw/device.c:118
#: src/mingw/device.c:309 src/raw_socket/device.c:114
#, c-format
msgid "Error while reading from %s %s: %s"
msgstr "Fout tijdens lezen van %s %s: %s"
#: src/linux/device.c:170 src/freebsd/device.c:84 src/solaris/device.c:138
#: src/netbsd/device.c:90 src/darwin/device.c:87 src/cygwin/device.c:259
#: src/mingw/device.c:193 src/raw_socket/device.c:123
#: src/netbsd/device.c:90 src/darwin/device.c:87 src/cygwin/device.c:263
#: src/mingw/device.c:318 src/raw_socket/device.c:123
#, c-format
msgid "Read packet of %d bytes from %s"
msgstr "Pakket van %d bytes gelezen van %s"
#: src/linux/device.c:180 src/freebsd/device.c:94 src/solaris/device.c:148
#: src/netbsd/device.c:101 src/darwin/device.c:97 src/cygwin/device.c:271
#: src/mingw/device.c:205 src/raw_socket/device.c:134
#: src/netbsd/device.c:100 src/darwin/device.c:97 src/cygwin/device.c:275
#: src/mingw/device.c:331 src/raw_socket/device.c:133
#, c-format
msgid "Writing packet of %d bytes to %s"
msgstr "Pakket van %d bytes geschreven naar %s"
#: src/linux/device.c:187 src/linux/device.c:194 src/linux/device.c:203
#: src/solaris/device.c:152 src/netbsd/device.c:105
#: src/raw_socket/device.c:138
#: src/solaris/device.c:152 src/netbsd/device.c:104
#: src/raw_socket/device.c:137
#, c-format
msgid "Can't write to %s %s: %s"
msgstr "Kan niet schrijven naar %s %s: %s"
#: src/linux/device.c:219 src/freebsd/device.c:112 src/solaris/device.c:166
#: src/netbsd/device.c:119 src/darwin/device.c:115 src/cygwin/device.c:288
#: src/mingw/device.c:222 src/raw_socket/device.c:152
#: src/netbsd/device.c:118 src/darwin/device.c:115 src/cygwin/device.c:292
#: src/mingw/device.c:348 src/raw_socket/device.c:151
#, c-format
msgid "Statistics for %s %s:"
msgstr "Statistieken voor %s %s:"
#: src/linux/device.c:220 src/freebsd/device.c:113 src/solaris/device.c:167
#: src/netbsd/device.c:120 src/darwin/device.c:116 src/cygwin/device.c:289
#: src/mingw/device.c:223 src/raw_socket/device.c:153
#: src/netbsd/device.c:119 src/darwin/device.c:116 src/cygwin/device.c:293
#: src/mingw/device.c:349 src/raw_socket/device.c:152
#, c-format
msgid " total bytes in: %10d"
msgstr " totaal aantal bytes in: %10d"
#: src/linux/device.c:221 src/freebsd/device.c:114 src/solaris/device.c:168
#: src/netbsd/device.c:121 src/darwin/device.c:117 src/cygwin/device.c:290
#: src/mingw/device.c:224 src/raw_socket/device.c:154
#: src/netbsd/device.c:120 src/darwin/device.c:117 src/cygwin/device.c:294
#: src/mingw/device.c:350 src/raw_socket/device.c:153
#, c-format
msgid " total bytes out: %10d"
msgstr " totaal aantal bytes uit: %10d"
@ -1321,50 +1370,54 @@ msgstr "NetBSD tun apparaat"
msgid "MacOS/X tun device"
msgstr "MaxOS/X tun apparaat"
#: src/cygwin/device.c:89 src/cygwin/device.c:111 src/mingw/device.c:84
#: src/mingw/device.c:106
#: src/cygwin/device.c:89 src/mingw/device.c:161
msgid "Unable to read registry"
msgstr "Kon registry niet lezen"
#: src/cygwin/device.c:136 src/mingw/device.c:130
#: src/cygwin/device.c:138 src/mingw/device.c:209
msgid "No Windows tap device found!"
msgstr "Geen Windows tap apparaat gevonden!"
#: src/cygwin/device.c:159
#: src/cygwin/device.c:164
msgid "Could not open Windows tap device for writing!"
msgstr "Kon Windows tap apparaat niet openen om te schrijven!"
#: src/cygwin/device.c:168 src/mingw/device.c:152
#: src/cygwin/device.c:173 src/mingw/device.c:234
msgid "Could not get MAC address from Windows tap device!"
msgstr "Kon MAC adres niet achterhalen van Windows tap apparaat!"
#: src/cygwin/device.c:195
#: src/cygwin/device.c:202
msgid "Could not open Windows tap device for reading!"
msgstr "Kon Windows tap apparaat niet openen om te lezen!"
#: src/cygwin/device.c:201
#: src/cygwin/device.c:208
msgid "Tap reader forked and running."
msgstr "Taplezer is geforked en draait."
#: src/cygwin/device.c:218
#: src/cygwin/device.c:225
msgid "Tap reader failed!"
msgstr "Taplezer faalde!"
#: src/cygwin/device.c:225 src/mingw/device.c:163
#: src/cygwin/device.c:229 src/mingw/device.c:288
msgid "Windows tap device"
msgstr "Windows tap apparaat"
#: src/cygwin/device.c:227 src/mingw/device.c:165
#: src/cygwin/device.c:231 src/mingw/device.c:290
#, c-format
msgid "%s (%s) is a %s"
msgstr "%s (%s) is een %s"
#: src/cygwin/device.c:275 src/mingw/device.c:209
#: src/cygwin/device.c:279 src/mingw/device.c:335
#, c-format
msgid "Error while writing to %s %s"
msgstr "Fout tijdens schrijven naar %s %s"
#: src/mingw/device.c:145
#: src/mingw/device.c:99
#, fuzzy
msgid "Tap reader running"
msgstr "Taplezer is geforked en draait."
#: src/mingw/device.c:227
#, c-format
msgid "%s (%s) is no a usable Windows tap device!"
msgstr "%s (%s) is geen bruikbaar Windows tap apparaat!"

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: logger.c,v 1.1.2.8 2003/07/29 22:59:00 guus Exp $
$Id: logger.c,v 1.1.2.9 2003/08/02 20:50:38 guus Exp $
*/
#include "system.h"
@ -71,6 +71,7 @@ void logger(int priority, const char *format, ...) {
fprintf(logfile, "%ld %s[%d]: ", time(NULL), logident, logpid);
vfprintf(logfile, format, ap);
fprintf(logfile, "\n");
fflush(logfile);
break;
case LOGMODE_SYSLOG:
#ifdef HAVE_SYSLOG_H

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.c,v 1.35.4.195 2003/07/29 22:59:00 guus Exp $
$Id: net.c,v 1.35.4.196 2003/08/02 20:50:38 guus Exp $
*/
#include "system.h"
@ -42,6 +42,7 @@
#include "xalloc.h"
bool do_purge = false;
volatile bool running;
time_t now = 0;
@ -280,7 +281,7 @@ static void check_network_activity(fd_set * f)
/*
this is where it all happens...
*/
void main_loop(void)
int main_loop(void)
{
fd_set fset;
struct timeval tv;
@ -294,7 +295,9 @@ void main_loop(void)
last_config_check = now;
srand(now);
for(;;) {
running = true;
while(running) {
now = time(NULL);
tv.tv_sec = 1 + (rand() & 7); /* Approx. 5 seconds, randomized to prevent global synchronisation effects */
@ -310,7 +313,7 @@ void main_loop(void)
strerror(errno));
cp_trace();
dump_connections();
return;
return 1;
}
continue;
@ -379,7 +382,7 @@ void main_loop(void)
if(!read_server_config()) {
logger(LOG_ERR, _("Unable to reread configuration file, exitting."));
exit(1);
return 1;
}
/* Close connections to hosts that have a changed or deleted host config file */
@ -405,8 +408,8 @@ void main_loop(void)
/* Try to make outgoing connections */
try_outgoing_connections();
}
}
continue;
}
}
return 0;
}

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: net.h,v 1.9.4.68 2003/07/29 22:59:00 guus Exp $
$Id: net.h,v 1.9.4.69 2003/08/02 20:50:38 guus Exp $
*/
#ifndef __TINC_NET_H__
@ -135,7 +135,7 @@ extern bool setup_network_connections(void);
extern void setup_outgoing_connection(struct outgoing_t *);
extern void try_outgoing_connections(void);
extern void close_network_connections(void);
extern void main_loop(void);
extern int main_loop(void);
extern void terminate_connection(struct connection_t *, bool);
extern void flush_queue(struct node_t *);
extern bool read_rsa_public_key(struct connection_t *);

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.c,v 1.1.2.60 2003/07/31 14:24:19 guus Exp $
$Id: process.c,v 1.1.2.61 2003/08/02 20:50:38 guus Exp $
*/
#include "system.h"
@ -43,6 +43,7 @@ extern char *identname;
extern char *pidfilename;
extern char **g_argv;
extern bool use_logfile;
extern volatile bool running;
sigset_t emptysigset;
@ -70,24 +71,154 @@ static int fcloseall(void)
}
#endif
/*
Close network connections, and terminate neatly
*/
void cleanup_and_exit(int c)
{
cp();
#ifdef HAVE_MINGW
extern char *identname;
extern char *program_name;
extern char **g_argv;
close_network_connections();
static SC_HANDLE manager = NULL;
static SC_HANDLE service = NULL;
static SERVICE_STATUS status = {0};
static SERVICE_STATUS_HANDLE statushandle = 0;
ifdebug(CONNECTIONS)
dump_device_stats();
bool install_service(void) {
char command[4096] = "";
char **argp;
logger(LOG_NOTICE, _("Terminating"));
closelogger();
exit(c);
manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(!manager) {
logger(LOG_ERR, _("Could not open service manager: %s"), winerror(GetLastError()));
return false;
}
if(!strchr(program_name, '\\')) {
GetCurrentDirectory(sizeof(command), command);
strncat(command, "\\", sizeof(command));
}
strncat(command, program_name, sizeof(command));
for(argp = g_argv + 1; *argp; argp++) {
strncat(command, " ", sizeof(command));
strncat(command, *argp, sizeof(command));
}
service = CreateService(manager, identname, identname,
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
command, "NDIS", NULL, NULL, NULL, NULL);
if(!service) {
logger(LOG_ERR, _("Could not create %s service: %s"), identname, winerror(GetLastError()));
return false;
}
logger(LOG_INFO, _("%s service installed"), identname);
if(!StartService(service, 0, NULL))
logger(LOG_WARNING, _("Could not start %s service: %s"), identname, winerror(GetLastError()));
else
logger(LOG_INFO, _("%s service started"), identname);
return true;
}
bool remove_service(void) {
manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if(!manager) {
logger(LOG_ERR, _("Could not open service manager: %s"), winerror(GetLastError()));
return false;
}
service = OpenService(manager, identname, SERVICE_ALL_ACCESS);
if(!service) {
logger(LOG_ERR, _("Could not open %s service: %s"), identname, winerror(GetLastError()));
return false;
}
if(!ControlService(service, SERVICE_CONTROL_STOP, &status))
logger(LOG_ERR, _("Could not stop %s service: %s"), identname, winerror(GetLastError()));
else
logger(LOG_INFO, _("%s service stopped"), identname);
if(!DeleteService(service)) {
logger(LOG_ERR, _("Could not remove %s service: %s"), identname, winerror(GetLastError()));
return false;
}
logger(LOG_INFO, _("%s service removed"), identname);
return true;
}
DWORD WINAPI controlhandler(DWORD request, DWORD type, LPVOID boe, LPVOID bah) {
switch(request) {
case SERVICE_CONTROL_STOP:
logger(LOG_NOTICE, _("Got %s request"), "SERVICE_CONTROL_STOP");
running = false;
break;
case SERVICE_CONTROL_SHUTDOWN:
logger(LOG_NOTICE, _("Got %s request"), "SERVICE_CONTROL_SHUTDOWN");
running = false;
break;
default:
logger(LOG_WARNING, _("Got unexpected request %d"), request);
return ERROR_CALL_NOT_IMPLEMENTED;
}
return NO_ERROR;
}
VOID WINAPI run_service(DWORD argc, LPTSTR* argv)
{
int err = 1;
extern int main2(int argc, char **argv);
status.dwServiceType = SERVICE_WIN32;
status.dwCurrentState = SERVICE_RUNNING;
status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
status.dwWin32ExitCode = 0;
status.dwServiceSpecificExitCode = 0;
status.dwCheckPoint = 0;
status.dwWaitHint = 0;
statushandle = RegisterServiceCtrlHandlerEx(identname, controlhandler, NULL);
if (!statushandle) {
logger(LOG_ERR, _("System call `%s' failed: %s"), "RegisterServiceCtrlHandlerEx", winerror(GetLastError()));
err = 1;
} else {
SetServiceStatus(statushandle, &status);
err = main2(argc, argv);
status.dwCurrentState = SERVICE_STOPPED;
status.dwWin32ExitCode = err;
SetServiceStatus(statushandle, &status);
}
return;
}
bool init_service(void) {
SERVICE_TABLE_ENTRY services[] = {
{identname, run_service},
{NULL, NULL}
};
if(!StartServiceCtrlDispatcher(services)) {
if(GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT) {
return false;
}
else
logger(LOG_ERR, _("System call `%s' failed: %s"), "StartServiceCtrlDispatcher", winerror(GetLastError()));
}
return true;
}
#endif
#ifndef HAVE_MINGW
/*
check for an existing tinc for this net, and write pid to pidfile
@ -151,9 +282,11 @@ bool kill_other(int signal)
fprintf(stderr, _("Removing stale lock file.\n"));
remove_pid(pidfilename);
}
#endif
return true;
#else
return remove_service();
#endif
}
/*
@ -170,14 +303,14 @@ bool detach(void)
#ifndef HAVE_MINGW
if(!write_pidfile())
return false;
#endif
/* If we succeeded in doing that, detach */
closelogger();
#endif
#ifdef HAVE_FORK
if(do_detach) {
#ifndef HAVE_MINGW
if(daemon(0, 0)) {
fprintf(stderr, _("Couldn't detach from terminal: %s"),
strerror(errno));
@ -188,8 +321,11 @@ bool detach(void)
if(!write_pid(pidfilename))
return false;
}
#else
if(!statushandle)
exit(install_service());
#endif
}
openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
@ -312,14 +448,13 @@ bool execute_script(const char *name, char **envp)
static RETSIGTYPE sigterm_handler(int a)
{
logger(LOG_NOTICE, _("Got TERM signal"));
cleanup_and_exit(0);
running = false;
}
static RETSIGTYPE sigquit_handler(int a)
{
logger(LOG_NOTICE, _("Got QUIT signal"));
cleanup_and_exit(0);
running = false;
}
static RETSIGTYPE fatal_signal_square(int a)

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: process.h,v 1.1.2.18 2003/07/30 21:52:41 guus Exp $
$Id: process.h,v 1.1.2.19 2003/08/02 20:50:38 guus Exp $
*/
#ifndef __TINC_PROCESS_H__
@ -31,6 +31,5 @@ extern void setup_signals(void);
extern bool execute_script(const char *, char **);
extern bool detach(void);
extern bool kill_other(int);
extern void cleanup_and_exit(int) __attribute__ ((__noreturn__));
#endif /* __TINC_PROCESS_H__ */

View file

@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: tincd.c,v 1.10.4.79 2003/07/30 11:50:45 guus Exp $
$Id: tincd.c,v 1.10.4.80 2003/08/02 20:50:38 guus Exp $
*/
#include "system.h"
@ -77,7 +77,8 @@ char *identname = NULL; /* program name for syslog */
char *pidfilename = NULL; /* pid file location */
char *logfilename = NULL; /* log file location */
char **g_argv; /* a copy of the cmdline arguments */
char **environment; /* A pointer to the environment on startup */
int exitstatus = 0;
static struct option const long_options[] = {
{"config", required_argument, NULL, 'c'},
@ -119,11 +120,9 @@ static void usage(bool status)
" --version Output version information and exit.\n\n"));
printf(_("Report bugs to tinc@nl.linux.org.\n"));
}
exit(status);
}
static void parse_options(int argc, char **argv, char **envp)
static bool parse_options(int argc, char **argv)
{
int r;
int option_index = 0;
@ -178,10 +177,13 @@ static void parse_options(int argc, char **argv, char **envp)
fprintf(stderr, _("Invalid argument `%s'; SIGNAL must be a number or one of HUP, TERM, KILL, USR1, USR2, WINCH, INT or ALRM.\n"),
optarg);
usage(true);
return false;
}
}
} else
kill_tincd = SIGTERM;
#else
kill_tincd = 1;
#endif
break;
@ -197,6 +199,7 @@ static void parse_options(int argc, char **argv, char **envp)
fprintf(stderr, _("Invalid argument `%s'; BITS must be a number equal to or greater than 512.\n"),
optarg);
usage(true);
return false;
}
generate_keys &= ~7; /* Round it to bytes */
@ -228,11 +231,14 @@ static void parse_options(int argc, char **argv, char **envp)
case '?':
usage(true);
return false;
default:
break;
}
}
return true;
}
/* This function prettyprints the key generation process */
@ -354,7 +360,7 @@ static void make_names(void)
}
}
int main(int argc, char **argv, char **envp)
int main(int argc, char **argv)
{
program_name = argv[0];
@ -362,8 +368,9 @@ int main(int argc, char **argv, char **envp)
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
environment = envp;
parse_options(argc, argv, envp);
if(!parse_options(argc, argv))
return 1;
make_names();
if(show_version) {
@ -378,11 +385,13 @@ int main(int argc, char **argv, char **envp)
return 0;
}
if(show_help)
if(show_help) {
usage(false);
return 0;
}
if(kill_tincd)
exit(!kill_other(kill_tincd));
return !kill_other(kill_tincd);
openlogger("tinc", LOGMODE_STDERR);
@ -412,31 +421,48 @@ int main(int argc, char **argv, char **envp)
if(generate_keys) {
read_server_config();
exit(!keygen(generate_keys));
return !keygen(generate_keys);
}
if(!read_server_config())
exit(1);
return 1;
if(lzo_init() != LZO_E_OK) {
logger(LOG_ERR, _("Error initializing LZO compressor!"));
exit(1);
return 1;
}
#ifdef HAVE_MINGW
if(WSAStartup(MAKEWORD(2, 2), &wsa_state)) {
logger(LOG_ERR, _("System call `%s' failed: %s"), "WSAStartup", strerror(errno));
exit(1);
logger(LOG_ERR, _("System call `%s' failed: %s"), "WSAStartup", winerror(GetLastError()));
return 1;
}
if(!do_detach || !init_service())
return main2(argc, argv);
else
return 1;
}
int main2(int argc, char **argv)
{
#endif
if(!detach())
exit(1);
return 1;
for(;;) {
if(setup_network_connections()) {
main_loop();
cleanup_and_exit(1);
int status;
status = main_loop();
close_network_connections();
ifdebug(CONNECTIONS)
dump_device_stats();
logger(LOG_NOTICE, _("Terminating"));
return status;
}
logger(LOG_ERR, _("Unrecoverable error"));
@ -447,7 +473,7 @@ int main(int argc, char **argv, char **envp)
sleep(maxtimeout);
} else {
logger(LOG_ERR, _("Not restarting."));
exit(1);
return 1;
}
}
}